Code refactoring & Port to 1.21
28
build.gradle
@@ -1,18 +1,15 @@
|
||||
plugins {
|
||||
id 'fabric-loom' version '0.10-SNAPSHOT'
|
||||
id 'fabric-loom' version '1.7-SNAPSHOT'
|
||||
id 'maven-publish'
|
||||
}
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
sourceCompatibility = JavaVersion.VERSION_21
|
||||
targetCompatibility = JavaVersion.VERSION_21
|
||||
|
||||
archivesBaseName = project.archives_base_name
|
||||
version = project.mod_version
|
||||
group = project.maven_group
|
||||
|
||||
minecraft {
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven { url "https://jitpack.io" }
|
||||
maven { url "https://maven.blamejared.com" }
|
||||
@@ -20,6 +17,7 @@ repositories {
|
||||
maven {
|
||||
url = "https://api.modrinth.com/maven"
|
||||
}
|
||||
maven { url 'https://maven.nucleoid.xyz' }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -31,16 +29,18 @@ dependencies {
|
||||
// Fabric API. This is technically optional, but you probably want it anyway.
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||
|
||||
modImplementation("vazkii.patchouli:Patchouli:${project.patchouli_version}"){
|
||||
exclude module: "fabric-api"
|
||||
}
|
||||
|
||||
modImplementation ("com.terraformersmc:modmenu:${project.mod_menu_version}"){
|
||||
exclude module: "fabric-api"
|
||||
}
|
||||
// modImplementation("vazkii.patchouli:Patchouli:${project.patchouli_version}"){
|
||||
// exclude module: "fabric-api"
|
||||
// }
|
||||
|
||||
modImplementation "maven.modrinth:midnightlib:${midnightlib_version}"
|
||||
include "maven.modrinth:midnightlib:${midnightlib_version}"
|
||||
|
||||
modImplementation include("eu.pb4:polymer-core:${polymer_version}")
|
||||
modImplementation include("eu.pb4:polymer-blocks:${polymer_version}")
|
||||
modImplementation include("eu.pb4:polymer-resource-pack:${polymer_version}")
|
||||
modImplementation include("eu.pb4:polymer-virtual-entity:${polymer_version}")
|
||||
modImplementation include("eu.pb4:factorytools:${factorytools_version}")
|
||||
}
|
||||
|
||||
processResources {
|
||||
@@ -59,7 +59,7 @@ tasks.withType(JavaCompile).configureEach {
|
||||
it.options.encoding = "UTF-8"
|
||||
|
||||
// Minecraft 1.17 (21w19a) upwards uses Java 16.
|
||||
it.options.release = 17
|
||||
it.options.release = 21
|
||||
}
|
||||
|
||||
java {
|
||||
|
||||
@@ -3,18 +3,19 @@ org.gradle.jvmargs=-Xmx2G
|
||||
|
||||
# Fabric Properties
|
||||
# check these on https://fabricmc.net/use
|
||||
minecraft_version=1.18.2
|
||||
yarn_mappings=1.18.2+build.2
|
||||
loader_version=0.13.3
|
||||
minecraft_version=1.21
|
||||
yarn_mappings=1.21+build.9
|
||||
loader_version=0.15.11
|
||||
|
||||
# Mod Properties
|
||||
mod_version = 4.2.0
|
||||
mod_version = 4.3.0
|
||||
maven_group = eu.midnightdust.motschen
|
||||
archives_base_name = decorative
|
||||
|
||||
# Dependencies
|
||||
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
||||
fabric_version=0.48.0+1.18.2
|
||||
mod_menu_version = 2.0.0-beta.7
|
||||
midnightlib_version=0.4.0
|
||||
fabric_version=0.100.7+1.21
|
||||
midnightlib_version=1.5.7-fabric
|
||||
patchouli_version=1.18.2-67-FABRIC
|
||||
polymer_version=0.9.6+1.21
|
||||
factorytools_version=0.3.1+1.21
|
||||
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
@@ -13,7 +13,6 @@ import eu.midnightdust.motschen.decorative.init.Pool;
|
||||
import eu.midnightdust.motschen.decorative.init.Signs;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.BlockEntityRendererRegistry;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry;
|
||||
@@ -21,6 +20,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.client.color.block.BlockColorProvider;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRendererFactories;
|
||||
import net.minecraft.util.DyeColor;
|
||||
|
||||
public class DecorativeClient implements ClientModInitializer {
|
||||
@@ -80,12 +80,10 @@ public class DecorativeClient implements ClientModInitializer {
|
||||
BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getCutout(),DecorativeMain.WallClock);
|
||||
BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getTranslucent(),DecorativeMain.BirdBath);
|
||||
|
||||
BlockEntityRendererRegistry.register(BlockEntities.CeilingFanBlockEntity, CeilingFanRenderer::new);
|
||||
|
||||
BlockEntityRendererRegistry.register(BlockEntities.ChoppingLogBlockEntity, ChoppingLogBlockEntityRenderer::new);
|
||||
|
||||
BlockEntityRendererRegistry.register(BlockEntities.WallClockBlockEntity, WallClockRenderer::new);
|
||||
BlockEntityRendererRegistry.register(BlockEntities.DigitalClockBlockEntity, DigitalClockRenderer::new);
|
||||
BlockEntityRendererFactories.register(BlockEntities.CeilingFanBlockEntity, CeilingFanRenderer::new);
|
||||
BlockEntityRendererFactories.register(BlockEntities.ChoppingLogBlockEntity, ChoppingLogBlockEntityRenderer::new);
|
||||
BlockEntityRendererFactories.register(BlockEntities.WallClockBlockEntity, WallClockRenderer::new);
|
||||
BlockEntityRendererFactories.register(BlockEntities.DigitalClockBlockEntity, DigitalClockRenderer::new);
|
||||
}
|
||||
public void registerBlockColor(Block block, Block templateBlock) {
|
||||
ColorProviderRegistry.BLOCK.register((type, pos, world, layer) -> {
|
||||
|
||||
@@ -9,37 +9,49 @@ import eu.midnightdust.motschen.decorative.blockstates.Program;
|
||||
import eu.midnightdust.motschen.decorative.config.DecorativeConfig;
|
||||
import eu.midnightdust.motschen.decorative.init.*;
|
||||
import eu.midnightdust.motschen.decorative.sound.DecorativeSoundEvents;
|
||||
import eu.midnightdust.motschen.decorative.util.RegistryUtil;
|
||||
import eu.midnightdust.motschen.decorative.world.OreFeatures;
|
||||
import eu.pb4.polymer.core.api.block.SimplePolymerBlock;
|
||||
import eu.pb4.polymer.core.api.item.PolymerItemGroupUtils;
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.fabric.api.client.itemgroup.FabricItemGroupBuilder;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.state.property.EnumProperty;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static eu.midnightdust.motschen.decorative.util.RegistryUtil.registerFurniture;
|
||||
import static eu.midnightdust.motschen.decorative.util.RegistryUtil.registerGarden;
|
||||
import static eu.midnightdust.motschen.decorative.util.RegistryUtil.registerTraffic;
|
||||
|
||||
|
||||
public class DecorativeMain implements ModInitializer {
|
||||
public static final String MOD_ID = "decorative";
|
||||
|
||||
public static final ItemGroup IndoorGroup = FabricItemGroupBuilder.build(new Identifier(MOD_ID, "indoor"), () -> new ItemStack(DecorativeMain.Television));
|
||||
public static final ItemGroup TrafficGroup = FabricItemGroupBuilder.build(new Identifier(MOD_ID, "traffic"), () -> new ItemStack(DecorativeMain.TrafficCone));
|
||||
public static final ItemGroup GardenGroup = FabricItemGroupBuilder.build(new Identifier(MOD_ID, "garden"), () -> new ItemStack(LogsWithAxes.OakChoppingLog));
|
||||
public static final ItemGroup PoolGroup = FabricItemGroupBuilder.build(new Identifier(MOD_ID, "pool"), () -> new ItemStack(Pool.BEACH_BALL_ITEM));
|
||||
public static ItemGroup IndoorGroup;
|
||||
public static ItemGroup TrafficGroup;
|
||||
public static ItemGroup GardenGroup;
|
||||
public static ItemGroup PoolGroup;
|
||||
public static final EnumProperty<Program> PROGRAM = EnumProperty.of("program", Program.class);
|
||||
public static final EnumProperty<PoolShape> POOL_SHAPE = EnumProperty.of("shape", PoolShape.class);
|
||||
public static final EnumProperty<Part> PART = EnumProperty.of("part", Part.class);
|
||||
public static final EnumProperty<CeilingFanStage> STAGE = EnumProperty.of("stage", CeilingFanStage.class);
|
||||
public static Block RockyAsphalt = new Block(FabricBlockSettings.copyOf(Blocks.COAL_ORE));
|
||||
public static Block Road = new Block(FabricBlockSettings.copyOf(Blocks.STONE));
|
||||
public static Block RockyAsphalt = simpleBlock(Blocks.COAL_ORE);
|
||||
public static Block Road = simpleBlock(Blocks.STONE);
|
||||
public static Block RoadWhiteShort = new RotatableBlock();
|
||||
public static Block RoadWhiteLong = new RotatableBlock();
|
||||
public static Block TrafficCone = new TrafficCone();
|
||||
public static Block Guardrail = new Guardrail();
|
||||
public static Block SignPost = new SignPost();
|
||||
public static Block KitchenTiles = new Block(FabricBlockSettings.copyOf(Blocks.STONE));
|
||||
public static Block KitchenTiles = simpleBlock(Blocks.STONE);
|
||||
public static Block Television = new Television();
|
||||
public static Block OldTelevision = new OldTelevision();
|
||||
public static Block CeilingFan = new CeilingFan();
|
||||
@@ -55,58 +67,43 @@ public class DecorativeMain implements ModInitializer {
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
MidnightConfig.init("decorative", DecorativeConfig.class);
|
||||
MidnightConfig.init(MOD_ID, DecorativeConfig.class);
|
||||
|
||||
IndoorGroup = createGroup(id("indoor"), DecorativeMain.Television);
|
||||
TrafficGroup = createGroup(id("traffic"), DecorativeMain.TrafficCone);
|
||||
GardenGroup = createGroup(id("garden"), LogsWithAxes.OakChoppingLog);
|
||||
PoolGroup = createGroup(id("pool"), Pool.BEACH_BALL_ITEM);
|
||||
|
||||
BlockEntities.init();
|
||||
|
||||
// Traffic //
|
||||
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"rocky_asphalt"), RockyAsphalt);
|
||||
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"rocky_asphalt"), new BlockItem(RockyAsphalt, new Item.Settings().group(DecorativeMain.TrafficGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"road"), Road);
|
||||
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"road"), new BlockItem(Road, new Item.Settings().group(DecorativeMain.TrafficGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"road_white_short"), RoadWhiteShort);
|
||||
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"road_white_short"), new BlockItem(RoadWhiteShort, new Item.Settings().group(DecorativeMain.TrafficGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"road_white_long"), RoadWhiteLong);
|
||||
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"road_white_long"), new BlockItem(RoadWhiteLong, new Item.Settings().group(DecorativeMain.TrafficGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"traffic_cone"), TrafficCone);
|
||||
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"traffic_cone"), new BlockItem(TrafficCone, new Item.Settings().group(DecorativeMain.TrafficGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"fire_hydrant"), FireHydrant);
|
||||
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"fire_hydrant"), new BlockItem(FireHydrant, new Item.Settings().group(DecorativeMain.TrafficGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"guardrail"), Guardrail);
|
||||
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"guardrail"), new BlockItem(Guardrail, new Item.Settings().group(DecorativeMain.TrafficGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"sign_post"), SignPost);
|
||||
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"sign_post"), new BlockItem(SignPost, new Item.Settings().group(DecorativeMain.TrafficGroup)));
|
||||
registerTraffic(id("rocky_asphalt"), RockyAsphalt);
|
||||
registerTraffic(id("road"), Road);
|
||||
registerTraffic(id("road_white_short"), RoadWhiteShort);
|
||||
registerTraffic(id("road_white_long"), RoadWhiteLong);
|
||||
registerTraffic(id("traffic_cone"), TrafficCone);
|
||||
registerTraffic(id("fire_hydrant"), FireHydrant);
|
||||
registerTraffic(id("guardrail"), Guardrail);
|
||||
registerTraffic(id("sign_post"), SignPost);
|
||||
Signs.init();
|
||||
|
||||
//Garden//
|
||||
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"stone_path"), StonePath);
|
||||
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"stone_path"), new BlockItem(StonePath, new Item.Settings().group(DecorativeMain.GardenGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"bird_bath"), BirdBath);
|
||||
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"bird_bath"), new BlockItem(BirdBath, new Item.Settings().group(DecorativeMain.GardenGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"water_pump"), WaterPump);
|
||||
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"water_pump"), new BlockItem(WaterPump, new Item.Settings().group(DecorativeMain.GardenGroup)));
|
||||
registerGarden(id("stone_path"), StonePath);
|
||||
registerGarden(id("bird_bath"), BirdBath);
|
||||
registerGarden(id("water_pump"), WaterPump);
|
||||
LogsWithAxes.init();
|
||||
Pool.init();
|
||||
|
||||
//Furniture//
|
||||
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"kitchen_tiles"), KitchenTiles);
|
||||
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"kitchen_tiles"), new BlockItem(KitchenTiles, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"wall_clock"), WallClock);
|
||||
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"wall_clock"), new BlockItem(WallClock, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"television"), Television);
|
||||
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"television"), new BlockItem(Television, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"old_television"), OldTelevision);
|
||||
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"old_television"), new BlockItem(OldTelevision, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"ceilingfan"), CeilingFan);
|
||||
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"ceilingfan"), new BlockItem(CeilingFan, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"shower_head"), ShowerHead);
|
||||
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"shower_head"), new BlockItem(ShowerHead, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"sliding_door"), SlidingDoor);
|
||||
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"sliding_door"), new BlockItem(SlidingDoor, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"christmas_tree"), ChristmasTree);
|
||||
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"christmas_tree"), new BlockItem(ChristmasTree, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(MOD_ID,"christmas_lights"), ChristmasLights);
|
||||
Registry.register(Registry.ITEM, new Identifier(MOD_ID,"christmas_lights"), new BlockItem(ChristmasLights, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
registerFurniture(id("kitchen_tiles"), KitchenTiles);
|
||||
registerFurniture(id("wall_clock"), WallClock);
|
||||
registerFurniture(id("television"), Television);
|
||||
registerFurniture(id("old_television"), OldTelevision);
|
||||
registerFurniture(id("ceilingfan"), CeilingFan);
|
||||
registerFurniture(id("shower_head"), ShowerHead);
|
||||
registerFurniture(id("sliding_door"), SlidingDoor);
|
||||
registerFurniture(id("christmas_tree"), ChristmasTree);
|
||||
registerFurniture(id("christmas_lights"), ChristmasLights);
|
||||
|
||||
Lamps.init();
|
||||
DoubleLamps.init();
|
||||
@@ -114,4 +111,32 @@ public class DecorativeMain implements ModInitializer {
|
||||
OreFeatures.init();
|
||||
new DecorativeSoundEvents();
|
||||
}
|
||||
public static Identifier id(String path) {
|
||||
return Identifier.of(MOD_ID, path);
|
||||
}
|
||||
public static ItemGroup createGroup(Identifier id, ItemConvertible icon) {
|
||||
ItemGroup group;
|
||||
Text name = Text.translatable("itemGroup."+id.getNamespace()+"."+id.getPath());
|
||||
|
||||
if (DecorativeConfig.polymerIntegration) {
|
||||
group = PolymerItemGroupUtils.builder().displayName(name).icon(() -> new ItemStack(icon)).entries(((displayContext, entries) -> {
|
||||
List<ItemStack> groupItems = new ArrayList<>();
|
||||
RegistryUtil.groupItems.stream().filter(itemEntry -> itemEntry.groupName() == name).forEach(itemEntry -> groupItems.add(itemEntry.stack()));
|
||||
entries.addAll(groupItems);
|
||||
})).build();
|
||||
PolymerItemGroupUtils.registerPolymerItemGroup(id, group);
|
||||
} else {
|
||||
group = FabricItemGroup.builder().displayName(name).icon(() -> new ItemStack(icon)).entries(((displayContext, entries) -> {
|
||||
List<ItemStack> groupItems = new ArrayList<>();
|
||||
RegistryUtil.groupItems.stream().filter(itemEntry -> itemEntry.groupName() == name).forEach(itemEntry -> groupItems.add(itemEntry.stack()));
|
||||
entries.addAll(groupItems);
|
||||
})).build();
|
||||
Registry.register(Registries.ITEM_GROUP, id, group);
|
||||
}
|
||||
return group;
|
||||
}
|
||||
public static Block simpleBlock(Block base) {
|
||||
if (DecorativeConfig.polymerIntegration) return new SimplePolymerBlock(AbstractBlock.Settings.copy(base), base);
|
||||
else return new Block(AbstractBlock.Settings.copy(base));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,23 @@
|
||||
package eu.midnightdust.motschen.decorative.block;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.cauldron.CauldronBehavior;
|
||||
import net.minecraft.component.ComponentMap;
|
||||
import net.minecraft.component.DataComponentTypes;
|
||||
import net.minecraft.component.type.PotionContentsComponent;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.item.ItemPlacementContext;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.potion.PotionUtil;
|
||||
import net.minecraft.potion.Potions;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.IntProperty;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.ItemActionResult;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
@@ -30,36 +32,36 @@ public class BirdBath extends AbstractCauldronBlock {
|
||||
public static final IntProperty LEVEL = IntProperty.of("level",0,3);
|
||||
|
||||
public BirdBath() {
|
||||
super(FabricBlockSettings.copy(Blocks.WATER_CAULDRON).nonOpaque().sounds(BlockSoundGroup.STONE), CauldronBehavior.WATER_CAULDRON_BEHAVIOR);
|
||||
super(AbstractBlock.Settings.copy(Blocks.WATER_CAULDRON).nonOpaque().sounds(BlockSoundGroup.STONE), CauldronBehavior.WATER_CAULDRON_BEHAVIOR);
|
||||
}
|
||||
@Override
|
||||
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
|
||||
ItemStack itemStack = player.getStackInHand(hand);
|
||||
if (itemStack.getItem().equals(Items.WATER_BUCKET) || (itemStack.getItem().equals(Items.POTION) && PotionUtil.getPotion(itemStack).equals(Potions.WATER))) {
|
||||
if (itemStack.getItem().equals(Items.WATER_BUCKET)) {
|
||||
protected ItemActionResult onUseWithItem(ItemStack stack, BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
|
||||
if (stack.getItem().equals(Items.WATER_BUCKET) || (stack.getItem().equals(Items.POTION) && stack.getComponents().contains(DataComponentTypes.POTION_CONTENTS) && stack.getComponents().get(DataComponentTypes.POTION_CONTENTS).matches(Potions.WATER))) {
|
||||
if (stack.getItem().equals(Items.WATER_BUCKET)) {
|
||||
world.setBlockState(pos, state.with(LEVEL, 3));
|
||||
if (!player.isCreative()) player.setStackInHand(hand, new ItemStack(Items.BUCKET));
|
||||
return ActionResult.SUCCESS;
|
||||
return ItemActionResult.SUCCESS;
|
||||
}
|
||||
else if (!state.get(LEVEL).equals(3)) {
|
||||
world.setBlockState(pos, state.with(LEVEL, state.get(LEVEL) + 1));
|
||||
if (!player.isCreative()) player.setStackInHand(hand, new ItemStack(Items.GLASS_BOTTLE));
|
||||
return ActionResult.SUCCESS;
|
||||
return ItemActionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
if (itemStack.getItem().equals(Items.BUCKET) || (itemStack.getItem().equals(Items.GLASS_BOTTLE))) {
|
||||
if (itemStack.getItem().equals(Items.BUCKET) && state.get(LEVEL).equals(3)) {
|
||||
if (stack.getItem().equals(Items.BUCKET) || (stack.getItem().equals(Items.GLASS_BOTTLE))) {
|
||||
if (stack.getItem().equals(Items.BUCKET) && state.get(LEVEL).equals(3)) {
|
||||
world.setBlockState(pos, state.with(LEVEL, 0));
|
||||
if (!player.isCreative()) player.setStackInHand(hand, new ItemStack(Items.WATER_BUCKET));
|
||||
return ActionResult.SUCCESS;
|
||||
return ItemActionResult.SUCCESS;
|
||||
}
|
||||
else if (!itemStack.getItem().equals(Items.BUCKET) && !state.get(LEVEL).equals(0)) {
|
||||
else if (!stack.getItem().equals(Items.BUCKET) && !state.get(LEVEL).equals(0)) {
|
||||
world.setBlockState(pos, state.with(LEVEL, state.get(LEVEL) - 1));
|
||||
if (!player.isCreative()) player.setStackInHand(hand, PotionUtil.setPotion(new ItemStack(Items.POTION), Potions.WATER));
|
||||
return ActionResult.SUCCESS;
|
||||
stack.applyComponentsFrom(ComponentMap.builder().add(DataComponentTypes.POTION_CONTENTS, new PotionContentsComponent(Potions.WATER)).build());
|
||||
if (!player.isCreative()) player.setStackInHand(hand, stack);
|
||||
return ItemActionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
return ActionResult.FAIL;
|
||||
return ItemActionResult.FAIL;
|
||||
}
|
||||
@Override
|
||||
public boolean isFull(BlockState state) {
|
||||
@@ -70,6 +72,12 @@ public class BirdBath extends AbstractCauldronBlock {
|
||||
protected boolean canBeFilledByDripstone(Fluid fluid) {
|
||||
return fluid == Fluids.WATER;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MapCodec<? extends AbstractCauldronBlock> getCodec() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double getFluidHeight(BlockState state) {
|
||||
return (6.0D + (double)state.get(LEVEL) * 3.0D) / 16.0D;
|
||||
|
||||
@@ -1,15 +1,21 @@
|
||||
package eu.midnightdust.motschen.decorative.block;
|
||||
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import eu.midnightdust.motschen.decorative.blockstates.CeilingFanStage;
|
||||
import eu.midnightdust.motschen.decorative.DecorativeMain;
|
||||
import eu.midnightdust.motschen.decorative.block.blockentity.CeilingFanBlockEntity;
|
||||
import eu.midnightdust.motschen.decorative.init.BlockEntities;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockEntityProvider;
|
||||
import net.minecraft.block.BlockRenderType;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.BlockWithEntity;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.block.entity.BlockEntityTicker;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.block.entity.BrewingStandBlockEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemPlacementContext;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
@@ -18,7 +24,6 @@ import net.minecraft.sound.SoundEvents;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.EnumProperty;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
@@ -32,7 +37,7 @@ public class CeilingFan extends BlockWithEntity implements BlockEntityProvider {
|
||||
private static final EnumProperty<CeilingFanStage> STAGE = DecorativeMain.STAGE;
|
||||
|
||||
public CeilingFan() {
|
||||
super(FabricBlockSettings.copy(Blocks.BLACK_CONCRETE).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
super(AbstractBlock.Settings.copy(Blocks.BLACK_CONCRETE).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
this.setDefaultState(this.stateManager.getDefaultState().with(STAGE, CeilingFanStage.OFF));
|
||||
}
|
||||
|
||||
@@ -43,8 +48,14 @@ public class CeilingFan extends BlockWithEntity implements BlockEntityProvider {
|
||||
@Nullable
|
||||
@Override
|
||||
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type) {
|
||||
return checkType(type, BlockEntities.CeilingFanBlockEntity, CeilingFanBlockEntity::tick);
|
||||
return validateTicker(type, BlockEntities.CeilingFanBlockEntity, CeilingFanBlockEntity::tick);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MapCodec<? extends BlockWithEntity> getCodec() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderType getRenderType(BlockState state) {
|
||||
return BlockRenderType.MODEL;
|
||||
@@ -52,14 +63,11 @@ public class CeilingFan extends BlockWithEntity implements BlockEntityProvider {
|
||||
|
||||
@Override
|
||||
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
|
||||
return super.getPlacementState(itemPlacementContext)
|
||||
.with(STAGE, CeilingFanStage.OFF);
|
||||
return super.getPlacementState(itemPlacementContext).with(STAGE, CeilingFanStage.OFF);
|
||||
}
|
||||
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
|
||||
if (state.get(STAGE) == CeilingFanStage.OFF) {world.setBlockState(pos, state.with(STAGE, CeilingFanStage.LEVEL_1));}
|
||||
if (state.get(STAGE) == CeilingFanStage.LEVEL_1) {world.setBlockState(pos, state.with(STAGE, CeilingFanStage.LEVEL_2));}
|
||||
if (state.get(STAGE) == CeilingFanStage.LEVEL_2) {world.setBlockState(pos, state.with(STAGE, CeilingFanStage.LEVEL_3));}
|
||||
if (state.get(STAGE) == CeilingFanStage.LEVEL_3) {world.setBlockState(pos, state.with(STAGE, CeilingFanStage.OFF));}
|
||||
@Override
|
||||
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) {
|
||||
world.setBlockState(pos, state.with(STAGE, state.get(STAGE).next()));
|
||||
|
||||
world.playSound(player, pos, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.2f, 0.5f);
|
||||
return ActionResult.SUCCESS;
|
||||
@@ -74,8 +82,7 @@ public class CeilingFan extends BlockWithEntity implements BlockEntityProvider {
|
||||
return SHAPE;
|
||||
}
|
||||
static {
|
||||
VoxelShape shape = createCuboidShape(-3, 5, -3, 19, 16, 19);
|
||||
SHAPE = shape;
|
||||
SHAPE = createCuboidShape(-3, 5, -3, 19, 16, 19);
|
||||
}
|
||||
public boolean canPlaceAt(BlockState state, WorldView worldView, BlockPos pos) {
|
||||
return !worldView.isAir(pos.up());
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
package eu.midnightdust.motschen.decorative.block;
|
||||
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import eu.midnightdust.motschen.decorative.block.blockentity.ChoppingLogBlockEntity;
|
||||
import eu.midnightdust.motschen.decorative.init.BlockEntities;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockEntityProvider;
|
||||
import net.minecraft.block.BlockRenderType;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.BlockWithEntity;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.HorizontalFacingBlock;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.block.entity.BlockEntityTicker;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
@@ -23,14 +30,14 @@ public class ChoppingLog extends BlockWithEntity implements BlockEntityProvider
|
||||
private static final DirectionProperty FACING = HorizontalFacingBlock.FACING;
|
||||
|
||||
public ChoppingLog() {
|
||||
super(FabricBlockSettings.copy(Blocks.OAK_PLANKS).nonOpaque().sounds(BlockSoundGroup.WOOD));
|
||||
super(AbstractBlock.Settings.copy(Blocks.OAK_PLANKS).nonOpaque().sounds(BlockSoundGroup.WOOD));
|
||||
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
|
||||
return Objects.requireNonNull(super.getPlacementState(itemPlacementContext))
|
||||
.with(FACING, itemPlacementContext.getPlayerFacing().getOpposite());
|
||||
.with(FACING, itemPlacementContext.getPlayerLookDirection().getOpposite());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -49,8 +56,14 @@ public class ChoppingLog extends BlockWithEntity implements BlockEntityProvider
|
||||
@Nullable
|
||||
@Override
|
||||
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type) {
|
||||
return checkType(type, BlockEntities.ChoppingLogBlockEntity, ChoppingLogBlockEntity::tick);
|
||||
return validateTicker(type, BlockEntities.ChoppingLogBlockEntity, ChoppingLogBlockEntity::tick);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MapCodec<? extends BlockWithEntity> getCodec() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderType getRenderType(BlockState state) {
|
||||
return BlockRenderType.MODEL;
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
package eu.midnightdust.motschen.decorative.block;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.*;
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.HorizontalFacingBlock;
|
||||
import net.minecraft.block.RedstoneLampBlock;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemPlacementContext;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
@@ -29,12 +35,12 @@ public class ChristmasLights extends HorizontalFacingBlock {
|
||||
public static final BooleanProperty LIT = RedstoneLampBlock.LIT;
|
||||
|
||||
public ChristmasLights() {
|
||||
super(FabricBlockSettings.copy(Blocks.REDSTONE_LAMP).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
super(AbstractBlock.Settings.copy(Blocks.REDSTONE_LAMP).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH).with(LIT, Boolean.FALSE));
|
||||
}
|
||||
|
||||
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
|
||||
world.setBlockState(pos, state.with(LIT, Boolean.valueOf(!state.get(LIT))));
|
||||
world.setBlockState(pos, state.with(LIT, !state.get(LIT)));
|
||||
world.playSound(player, pos, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.2f, 0.5f);
|
||||
return ActionResult.SUCCESS;
|
||||
}
|
||||
@@ -42,7 +48,7 @@ public class ChristmasLights extends HorizontalFacingBlock {
|
||||
@Override
|
||||
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
|
||||
return super.getPlacementState(itemPlacementContext)
|
||||
.with(FACING, itemPlacementContext.getPlayerFacing().getOpposite())
|
||||
.with(FACING, itemPlacementContext.getPlayerLookDirection().getOpposite())
|
||||
.with(LIT, Boolean.FALSE);
|
||||
}
|
||||
|
||||
@@ -53,13 +59,13 @@ public class ChristmasLights extends HorizontalFacingBlock {
|
||||
}
|
||||
@Override
|
||||
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) {
|
||||
switch (state.get(FACING)) {
|
||||
case NORTH: return NORTH_SHAPE;
|
||||
case EAST: return EAST_SHAPE;
|
||||
case SOUTH: return SOUTH_SHAPE;
|
||||
case WEST: return WEST_SHAPE;
|
||||
default: return super.getOutlineShape(state, view, pos, context);
|
||||
}
|
||||
return switch (state.get(FACING)) {
|
||||
case NORTH -> NORTH_SHAPE;
|
||||
case EAST -> EAST_SHAPE;
|
||||
case SOUTH -> SOUTH_SHAPE;
|
||||
case WEST -> WEST_SHAPE;
|
||||
default -> super.getOutlineShape(state, view, pos, context);
|
||||
};
|
||||
}
|
||||
static {
|
||||
VoxelShape shape = createCuboidShape(-16, 3, 6, 32, 17, 9);
|
||||
@@ -85,4 +91,8 @@ public class ChristmasLights extends HorizontalFacingBlock {
|
||||
return !worldView.isAir(pos.up());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MapCodec<? extends HorizontalFacingBlock> getCodec() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package eu.midnightdust.motschen.decorative.block;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
@@ -12,7 +15,7 @@ public class ChristmasTree extends Block{
|
||||
private static final VoxelShape SHAPE;
|
||||
|
||||
public ChristmasTree() {
|
||||
super(FabricBlockSettings.copy(Blocks.BLACK_CONCRETE).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
super(AbstractBlock.Settings.copy(Blocks.BLACK_CONCRETE).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -20,8 +23,7 @@ public class ChristmasTree extends Block{
|
||||
return SHAPE;
|
||||
}
|
||||
static {
|
||||
VoxelShape shape = createCuboidShape(0, 0, 0, 16, 32, 16);
|
||||
SHAPE = shape;
|
||||
SHAPE = createCuboidShape(0, 0, 0, 16, 32, 16);
|
||||
}
|
||||
|
||||
public boolean canPlaceAt(BlockState state, WorldView worldView, BlockPos pos) {
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
package eu.midnightdust.motschen.decorative.block;
|
||||
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import eu.midnightdust.motschen.decorative.block.blockentity.DigitalClockBlockEntity;
|
||||
import eu.midnightdust.motschen.decorative.init.BlockEntities;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockEntityProvider;
|
||||
import net.minecraft.block.BlockRenderType;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.BlockWithEntity;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.HorizontalFacingBlock;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.block.entity.BlockEntityTicker;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
@@ -27,7 +35,7 @@ public class DigitalClock extends BlockWithEntity implements BlockEntityProvider
|
||||
private static final VoxelShape WEST_SHAPE;
|
||||
|
||||
public DigitalClock() {
|
||||
super(FabricBlockSettings.copy(Blocks.SMOOTH_QUARTZ).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
super(AbstractBlock.Settings.copy(Blocks.SMOOTH_QUARTZ).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH));
|
||||
}
|
||||
|
||||
@@ -38,8 +46,14 @@ public class DigitalClock extends BlockWithEntity implements BlockEntityProvider
|
||||
@Nullable
|
||||
@Override
|
||||
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type) {
|
||||
return checkType(type, BlockEntities.DigitalClockBlockEntity, DigitalClockBlockEntity::tick);
|
||||
return validateTicker(type, BlockEntities.DigitalClockBlockEntity, DigitalClockBlockEntity::tick);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MapCodec<? extends BlockWithEntity> getCodec() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderType getRenderType(BlockState state) {
|
||||
return BlockRenderType.MODEL;
|
||||
@@ -52,19 +66,18 @@ public class DigitalClock extends BlockWithEntity implements BlockEntityProvider
|
||||
|
||||
@Override
|
||||
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
|
||||
return super.getPlacementState(itemPlacementContext)
|
||||
.with(FACING, itemPlacementContext.getPlayerFacing().getOpposite());
|
||||
return super.getPlacementState(itemPlacementContext).with(FACING, itemPlacementContext.getPlayerLookDirection().getOpposite());
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) {
|
||||
switch (state.get(FACING)) {
|
||||
case NORTH: return NORTH_SHAPE;
|
||||
case EAST: return EAST_SHAPE;
|
||||
case SOUTH: return SOUTH_SHAPE;
|
||||
case WEST: return WEST_SHAPE;
|
||||
default: return super.getOutlineShape(state, view, pos, context);
|
||||
}
|
||||
return switch (state.get(FACING)) {
|
||||
case NORTH -> NORTH_SHAPE;
|
||||
case EAST -> EAST_SHAPE;
|
||||
case SOUTH -> SOUTH_SHAPE;
|
||||
case WEST -> WEST_SHAPE;
|
||||
default -> super.getOutlineShape(state, view, pos, context);
|
||||
};
|
||||
}
|
||||
static {
|
||||
VoxelShape shape = createCuboidShape(1, 0, 5, 15, 8, 13);
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
package eu.midnightdust.motschen.decorative.block;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.RedstoneLampBlock;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.block.enums.DoubleBlockHalf;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemPlacementContext;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
@@ -16,7 +19,6 @@ import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.state.property.EnumProperty;
|
||||
import net.minecraft.state.property.Properties;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
@@ -26,8 +28,6 @@ import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
import net.minecraft.world.WorldView;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class DoubleLamp extends Block {
|
||||
private static final VoxelShape SHAPE_TOP;
|
||||
private static final VoxelShape SHAPE_BOTTOM;
|
||||
@@ -36,12 +36,13 @@ public class DoubleLamp extends Block {
|
||||
public static final EnumProperty<DoubleBlockHalf> HALF = Properties.DOUBLE_BLOCK_HALF;
|
||||
|
||||
public DoubleLamp() {
|
||||
super(FabricBlockSettings.copy(Blocks.REDSTONE_LAMP).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
super(AbstractBlock.Settings.copy(Blocks.REDSTONE_LAMP).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
this.setDefaultState(this.stateManager.getDefaultState().with(LIT, false).with(HALF, DoubleBlockHalf.LOWER));
|
||||
}
|
||||
|
||||
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
|
||||
world.setBlockState(pos, state.with(LIT, Boolean.valueOf(!state.get(LIT))));
|
||||
@Override
|
||||
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) {
|
||||
world.setBlockState(pos, state.with(LIT, !state.get(LIT)));
|
||||
world.playSound(player, pos, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.2f, 0.5f);
|
||||
return ActionResult.SUCCESS;
|
||||
}
|
||||
@@ -84,6 +85,7 @@ public class DoubleLamp extends Block {
|
||||
arg.add(LIT);
|
||||
arg.add(HALF);
|
||||
}
|
||||
@Override
|
||||
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
|
||||
boolean bl = state.get(HALF) == DoubleBlockHalf.UPPER;
|
||||
return bl ? SHAPE_TOP : SHAPE_BOTTOM;
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
package eu.midnightdust.motschen.decorative.block;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.*;
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.HorizontalFacingBlock;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemPlacementContext;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -11,8 +16,8 @@ import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.ItemActionResult;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
@@ -29,32 +34,24 @@ public class FireHydrant extends HorizontalFacingBlock {
|
||||
private static final VoxelShape WEST_SHAPE;
|
||||
|
||||
public FireHydrant() {
|
||||
super(FabricBlockSettings.copy(Blocks.STONE).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
super(AbstractBlock.Settings.copy(Blocks.STONE).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH));
|
||||
}
|
||||
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
|
||||
ItemStack itemStack = player.getStackInHand(hand);
|
||||
if (!itemStack.isEmpty() && hand==Hand.MAIN_HAND) {
|
||||
if (itemStack.getItem() == Items.BUCKET) {
|
||||
@Override
|
||||
protected ItemActionResult onUseWithItem(ItemStack stack, BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
|
||||
if (!stack.isEmpty() && hand==Hand.MAIN_HAND && stack.getItem() == Items.BUCKET) {
|
||||
if (!world.isClient) {
|
||||
ItemUsage.exchangeStack(itemStack, player, new ItemStack(Items.BUCKET));
|
||||
ItemUsage.exchangeStack(stack, player, new ItemStack(Items.BUCKET));
|
||||
world.playSound(null, pos, SoundEvents.ITEM_BUCKET_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
}
|
||||
return ActionResult.SUCCESS;
|
||||
return ItemActionResult.SUCCESS;
|
||||
}
|
||||
else {
|
||||
return ActionResult.PASS;
|
||||
}
|
||||
}
|
||||
if (itemStack.isEmpty()) {
|
||||
return ActionResult.PASS;
|
||||
} return ActionResult.PASS;
|
||||
return ItemActionResult.FAIL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
|
||||
return super.getPlacementState(itemPlacementContext)
|
||||
.with(FACING, itemPlacementContext.getPlayerFacing().getOpposite());
|
||||
return super.getPlacementState(itemPlacementContext).with(FACING, itemPlacementContext.getPlayerLookDirection().getOpposite());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -63,13 +60,13 @@ public class FireHydrant extends HorizontalFacingBlock {
|
||||
}
|
||||
@Override
|
||||
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) {
|
||||
switch (state.get(FACING)) {
|
||||
case NORTH: return NORTH_SHAPE;
|
||||
case EAST: return EAST_SHAPE;
|
||||
case SOUTH: return SOUTH_SHAPE;
|
||||
case WEST: return WEST_SHAPE;
|
||||
default: return super.getOutlineShape(state, view, pos, context);
|
||||
}
|
||||
return switch (state.get(FACING)) {
|
||||
case NORTH -> NORTH_SHAPE;
|
||||
case EAST -> EAST_SHAPE;
|
||||
case SOUTH -> SOUTH_SHAPE;
|
||||
case WEST -> WEST_SHAPE;
|
||||
default -> super.getOutlineShape(state, view, pos, context);
|
||||
};
|
||||
}
|
||||
static {
|
||||
VoxelShape shape = createCuboidShape(2.5, 0, 4, 13.5, 15.5, 12);
|
||||
@@ -96,4 +93,8 @@ public class FireHydrant extends HorizontalFacingBlock {
|
||||
return !worldView.isAir(pos.down());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MapCodec<? extends HorizontalFacingBlock> getCodec() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
package eu.midnightdust.motschen.decorative.block;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.*;
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.HorizontalFacingBlock;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.item.ItemPlacementContext;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.state.StateManager;
|
||||
@@ -19,14 +24,13 @@ public class Guardrail extends HorizontalFacingBlock {
|
||||
private static final VoxelShape WEST_SHAPE;
|
||||
|
||||
public Guardrail() {
|
||||
super(FabricBlockSettings.copy(Blocks.STONE).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
super(AbstractBlock.Settings.copy(Blocks.STONE).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
|
||||
return super.getPlacementState(itemPlacementContext)
|
||||
.with(FACING, itemPlacementContext.getPlayerFacing().getOpposite());
|
||||
return super.getPlacementState(itemPlacementContext).with(FACING, itemPlacementContext.getPlayerLookDirection().getOpposite());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -35,13 +39,13 @@ public class Guardrail extends HorizontalFacingBlock {
|
||||
}
|
||||
@Override
|
||||
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) {
|
||||
switch (state.get(FACING)) {
|
||||
case NORTH: return NORTH_SHAPE;
|
||||
case EAST: return EAST_SHAPE;
|
||||
case SOUTH: return SOUTH_SHAPE;
|
||||
case WEST: return WEST_SHAPE;
|
||||
default: return super.getOutlineShape(state, view, pos, context);
|
||||
}
|
||||
return switch (state.get(FACING)) {
|
||||
case NORTH -> NORTH_SHAPE;
|
||||
case EAST -> EAST_SHAPE;
|
||||
case SOUTH -> SOUTH_SHAPE;
|
||||
case WEST -> WEST_SHAPE;
|
||||
default -> super.getOutlineShape(state, view, pos, context);
|
||||
};
|
||||
}
|
||||
static {
|
||||
VoxelShape shape = createCuboidShape(0, 0, 13.3, 16, 8, 15);
|
||||
@@ -68,4 +72,8 @@ public class Guardrail extends HorizontalFacingBlock {
|
||||
return !worldView.isAir(pos.down());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MapCodec<? extends HorizontalFacingBlock> getCodec() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package eu.midnightdust.motschen.decorative.block;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.enums.DoubleBlockHalf;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.RedstoneLampBlock;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemPlacementContext;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
@@ -23,7 +26,7 @@ public class Lamp extends Block {
|
||||
public static final BooleanProperty LIT = RedstoneLampBlock.LIT;
|
||||
|
||||
public Lamp() {
|
||||
super(FabricBlockSettings.copy(Blocks.REDSTONE_LAMP).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
super(AbstractBlock.Settings.copy(Blocks.REDSTONE_LAMP).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
this.setDefaultState(this.stateManager.getDefaultState().with(LIT, false));
|
||||
}
|
||||
@Override
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
package eu.midnightdust.motschen.decorative.block;
|
||||
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import eu.midnightdust.motschen.decorative.DecorativeMain;
|
||||
import eu.midnightdust.motschen.decorative.blockstates.Program;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.HorizontalFacingBlock;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemPlacementContext;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
@@ -12,7 +17,6 @@ import net.minecraft.sound.SoundEvents;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.EnumProperty;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
@@ -33,36 +37,20 @@ public class OldTelevision extends HorizontalFacingBlock {
|
||||
private static final EnumProperty<Program> PROGRAM = DecorativeMain.PROGRAM;
|
||||
|
||||
public OldTelevision() {
|
||||
super(FabricBlockSettings.copy(Blocks.BLACK_CONCRETE).nonOpaque().sounds(BlockSoundGroup.STONE).luminance(createLightLevelFromBlockState()));
|
||||
super(AbstractBlock.Settings.copy(Blocks.BLACK_CONCRETE).nonOpaque().sounds(BlockSoundGroup.STONE).luminance(createLightLevelFromBlockState()));
|
||||
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH).with(PROGRAM, Program.OFF));
|
||||
}
|
||||
|
||||
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
|
||||
switch (state.get(PROGRAM)) {
|
||||
case OFF: world.setBlockState(pos, state.with(PROGRAM, Program.NYANCAT));
|
||||
@Override
|
||||
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) {
|
||||
world.setBlockState(pos, state.with(PROGRAM, state.get(PROGRAM).next()));
|
||||
world.playSound(player, pos, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.2f, 1.5f);
|
||||
return ActionResult.SUCCESS;
|
||||
case NYANCAT: world.setBlockState(pos, state.with(PROGRAM, Program.CREEPER));
|
||||
world.playSound(player, pos, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.2f, 1.5f);
|
||||
return ActionResult.SUCCESS;
|
||||
case CREEPER: world.setBlockState(pos, state.with(PROGRAM, Program.CRABRAVE));
|
||||
world.playSound(player, pos, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.2f, 1.5f);
|
||||
return ActionResult.SUCCESS;
|
||||
case CRABRAVE: world.setBlockState(pos, state.with(PROGRAM, Program.TATER));
|
||||
world.playSound(player, pos, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.2f, 1.5f);
|
||||
return ActionResult.SUCCESS;
|
||||
case TATER: world.setBlockState(pos, state.with(PROGRAM, Program.OFF));
|
||||
world.playSound(player, pos, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.2f, 1.5f);
|
||||
return ActionResult.SUCCESS;
|
||||
}
|
||||
return ActionResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
|
||||
return super.getPlacementState(itemPlacementContext)
|
||||
.with(FACING, itemPlacementContext.getPlayerFacing().getOpposite())
|
||||
.with(PROGRAM, Program.OFF);
|
||||
return super.getPlacementState(itemPlacementContext).with(FACING, itemPlacementContext.getPlayerLookDirection().getOpposite()).with(PROGRAM, Program.OFF);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -72,13 +60,13 @@ public class OldTelevision extends HorizontalFacingBlock {
|
||||
}
|
||||
@Override
|
||||
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) {
|
||||
switch (state.get(FACING)) {
|
||||
case NORTH: return NORTH_SHAPE;
|
||||
case EAST: return EAST_SHAPE;
|
||||
case SOUTH: return SOUTH_SHAPE;
|
||||
case WEST: return WEST_SHAPE;
|
||||
default: return super.getOutlineShape(state, view, pos, context);
|
||||
}
|
||||
return switch (state.get(FACING)) {
|
||||
case NORTH -> NORTH_SHAPE;
|
||||
case EAST -> EAST_SHAPE;
|
||||
case SOUTH -> SOUTH_SHAPE;
|
||||
case WEST -> WEST_SHAPE;
|
||||
default -> super.getOutlineShape(state, view, pos, context);
|
||||
};
|
||||
}
|
||||
static {
|
||||
VoxelShape shape = createCuboidShape(0, 0, 1, 16, 14, 14);
|
||||
@@ -115,4 +103,8 @@ public class OldTelevision extends HorizontalFacingBlock {
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MapCodec<? extends HorizontalFacingBlock> getCodec() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,18 @@
|
||||
package eu.midnightdust.motschen.decorative.block;
|
||||
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import eu.midnightdust.motschen.decorative.block.blockentity.PoolSprinklerBlockEntity;
|
||||
import eu.midnightdust.motschen.decorative.init.BlockEntities;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockEntityProvider;
|
||||
import net.minecraft.block.BlockRenderType;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.BlockWithEntity;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.DoorBlock;
|
||||
import net.minecraft.block.HorizontalFacingBlock;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.block.entity.BlockEntityTicker;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
@@ -16,7 +25,6 @@ import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.state.property.DirectionProperty;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
@@ -39,11 +47,12 @@ public class PoolSprinkler extends BlockWithEntity implements BlockEntityProvide
|
||||
|
||||
|
||||
public PoolSprinkler() {
|
||||
super(FabricBlockSettings.copy(Blocks.STONE).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
super(AbstractBlock.Settings.copy(Blocks.STONE).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH).with(POWERED, Boolean.FALSE));
|
||||
}
|
||||
|
||||
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
|
||||
@Override
|
||||
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) {
|
||||
world.setBlockState(pos, state.with(POWERED, !state.get(POWERED)));
|
||||
world.playSound(player, pos, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.2f, 0.5f);
|
||||
return ActionResult.SUCCESS;
|
||||
@@ -52,7 +61,7 @@ public class PoolSprinkler extends BlockWithEntity implements BlockEntityProvide
|
||||
@Override
|
||||
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
|
||||
return Objects.requireNonNull(super.getPlacementState(itemPlacementContext))
|
||||
.with(FACING, itemPlacementContext.getPlayerFacing().getOpposite())
|
||||
.with(FACING, itemPlacementContext.getPlayerLookDirection().getOpposite())
|
||||
.with(POWERED, Boolean.FALSE);
|
||||
}
|
||||
|
||||
@@ -63,13 +72,13 @@ public class PoolSprinkler extends BlockWithEntity implements BlockEntityProvide
|
||||
}
|
||||
@Override
|
||||
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) {
|
||||
switch (state.get(FACING)) {
|
||||
case NORTH: return NORTH_SHAPE;
|
||||
case EAST: return EAST_SHAPE;
|
||||
case SOUTH: return SOUTH_SHAPE;
|
||||
case WEST: return WEST_SHAPE;
|
||||
default: return super.getOutlineShape(state, view, pos, context);
|
||||
}
|
||||
return switch (state.get(FACING)) {
|
||||
case NORTH -> NORTH_SHAPE;
|
||||
case EAST -> EAST_SHAPE;
|
||||
case SOUTH -> SOUTH_SHAPE;
|
||||
case WEST -> WEST_SHAPE;
|
||||
default -> super.getOutlineShape(state, view, pos, context);
|
||||
};
|
||||
}
|
||||
static {
|
||||
VoxelShape post = createCuboidShape(7, 0, 0, 9, 13, 2);
|
||||
@@ -103,8 +112,14 @@ public class PoolSprinkler extends BlockWithEntity implements BlockEntityProvide
|
||||
@Nullable
|
||||
@Override
|
||||
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type) {
|
||||
return checkType(type, BlockEntities.PoolSprinklerBlockEntity, PoolSprinklerBlockEntity::tick);
|
||||
return validateTicker(type, BlockEntities.PoolSprinklerBlockEntity, PoolSprinklerBlockEntity::tick);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MapCodec<? extends BlockWithEntity> getCodec() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderType getRenderType(BlockState state) {
|
||||
return BlockRenderType.MODEL;
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
package eu.midnightdust.motschen.decorative.block;
|
||||
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import eu.midnightdust.motschen.decorative.DecorativeMain;
|
||||
import eu.midnightdust.motschen.decorative.blockstates.PoolShape;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.DoorBlock;
|
||||
import net.minecraft.block.HorizontalFacingBlock;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.block.Waterloggable;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.fluid.Fluids;
|
||||
import net.minecraft.item.ItemPlacementContext;
|
||||
@@ -34,7 +41,7 @@ public class PoolWall extends HorizontalFacingBlock implements Waterloggable {
|
||||
|
||||
|
||||
public PoolWall() {
|
||||
super(FabricBlockSettings.copy(Blocks.STONE_STAIRS).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
super(AbstractBlock.Settings.copy(Blocks.STONE_STAIRS).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH).with(SHAPE, PoolShape.STRAIGHT).with(WATERLOGGED, false));
|
||||
}
|
||||
|
||||
@@ -46,7 +53,7 @@ public class PoolWall extends HorizontalFacingBlock implements Waterloggable {
|
||||
public BlockState getPlacementState(ItemPlacementContext ctx) {
|
||||
BlockPos blockPos = ctx.getBlockPos();
|
||||
FluidState fluidState = ctx.getWorld().getFluidState(blockPos);
|
||||
BlockState blockState = this.getDefaultState().with(FACING, ctx.getPlayerFacing().getOpposite()).with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER);
|
||||
BlockState blockState = this.getDefaultState().with(FACING, ctx.getPlayerLookDirection().getOpposite()).with(WATERLOGGED, fluidState.getFluid() == Fluids.WATER);
|
||||
return blockState.with(SHAPE, getPoolShape(blockState, ctx.getWorld(), blockPos));
|
||||
}
|
||||
|
||||
@@ -82,13 +89,29 @@ public class PoolWall extends HorizontalFacingBlock implements Waterloggable {
|
||||
}
|
||||
@Override
|
||||
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) {
|
||||
switch (state.get(FACING)) {
|
||||
case NORTH: switch (state.get(SHAPE)) { case STRAIGHT: return NORTH_SHAPE; case INNER_LEFT: return NORTH_WEST_CORNER_SHAPE; case INNER_RIGHT: return NORTH_EAST_CORNER_SHAPE;}
|
||||
case EAST: switch (state.get(SHAPE)) { case STRAIGHT: return EAST_SHAPE; case INNER_LEFT: return NORTH_EAST_CORNER_SHAPE; case INNER_RIGHT: return SOUTH_EAST_CORNER_SHAPE;}
|
||||
case SOUTH: switch (state.get(SHAPE)) { case STRAIGHT: return SOUTH_SHAPE; case INNER_LEFT: return SOUTH_EAST_CORNER_SHAPE; case INNER_RIGHT: return SOUTH_WEST_CORNER_SHAPE;}
|
||||
case WEST: switch (state.get(SHAPE)) { case STRAIGHT: return WEST_SHAPE; case INNER_LEFT: return SOUTH_WEST_CORNER_SHAPE; case INNER_RIGHT: return NORTH_WEST_CORNER_SHAPE;}
|
||||
default: return super.getOutlineShape(state, view, pos, context);
|
||||
}
|
||||
return switch (state.get(FACING)) {
|
||||
case NORTH -> switch (state.get(SHAPE)) {
|
||||
case STRAIGHT -> NORTH_SHAPE;
|
||||
case INNER_LEFT -> NORTH_WEST_CORNER_SHAPE;
|
||||
case INNER_RIGHT -> NORTH_EAST_CORNER_SHAPE;
|
||||
};
|
||||
case EAST -> switch (state.get(SHAPE)) {
|
||||
case STRAIGHT -> EAST_SHAPE;
|
||||
case INNER_LEFT -> NORTH_EAST_CORNER_SHAPE;
|
||||
case INNER_RIGHT -> SOUTH_EAST_CORNER_SHAPE;
|
||||
};
|
||||
case SOUTH -> switch (state.get(SHAPE)) {
|
||||
case STRAIGHT -> SOUTH_SHAPE;
|
||||
case INNER_LEFT -> SOUTH_EAST_CORNER_SHAPE;
|
||||
case INNER_RIGHT -> SOUTH_WEST_CORNER_SHAPE;
|
||||
};
|
||||
case WEST -> switch (state.get(SHAPE)) {
|
||||
case STRAIGHT -> WEST_SHAPE;
|
||||
case INNER_LEFT -> SOUTH_WEST_CORNER_SHAPE;
|
||||
case INNER_RIGHT -> NORTH_WEST_CORNER_SHAPE;
|
||||
};
|
||||
default -> super.getOutlineShape(state, view, pos, context);
|
||||
};
|
||||
}
|
||||
static {
|
||||
VoxelShape base = createCuboidShape(0, 0, 15, 16, 16, 16);
|
||||
@@ -117,4 +140,8 @@ public class PoolWall extends HorizontalFacingBlock implements Waterloggable {
|
||||
return buffer[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MapCodec<? extends HorizontalFacingBlock> getCodec() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package eu.midnightdust.motschen.decorative.block;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
@@ -13,14 +14,13 @@ import net.minecraft.util.math.Direction;
|
||||
public class RotatableBlock extends HorizontalFacingBlock {
|
||||
|
||||
public RotatableBlock() {
|
||||
super(FabricBlockSettings.copy(Blocks.STONE).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
super(AbstractBlock.Settings.copy(Blocks.STONE).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
|
||||
return super.getPlacementState(itemPlacementContext)
|
||||
.with(FACING, itemPlacementContext.getPlayerFacing().getOpposite());
|
||||
return super.getPlacementState(itemPlacementContext).with(FACING, itemPlacementContext.getPlayerLookDirection().getOpposite());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -28,4 +28,8 @@ public class RotatableBlock extends HorizontalFacingBlock {
|
||||
builder.add(FACING);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MapCodec<? extends HorizontalFacingBlock> getCodec() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,18 @@
|
||||
package eu.midnightdust.motschen.decorative.block;
|
||||
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import eu.midnightdust.motschen.decorative.block.blockentity.ShowerHeadBlockEntity;
|
||||
import eu.midnightdust.motschen.decorative.init.BlockEntities;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockEntityProvider;
|
||||
import net.minecraft.block.BlockRenderType;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.BlockWithEntity;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.DoorBlock;
|
||||
import net.minecraft.block.HorizontalFacingBlock;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.block.entity.BlockEntityTicker;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
@@ -16,7 +25,6 @@ import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.BooleanProperty;
|
||||
import net.minecraft.state.property.DirectionProperty;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
@@ -37,11 +45,12 @@ public class ShowerHead extends BlockWithEntity implements BlockEntityProvider {
|
||||
|
||||
|
||||
public ShowerHead() {
|
||||
super(FabricBlockSettings.copy(Blocks.STONE).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
super(AbstractBlock.Settings.copy(Blocks.STONE).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH).with(POWERED, Boolean.FALSE));
|
||||
}
|
||||
|
||||
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
|
||||
@Override
|
||||
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) {
|
||||
world.setBlockState(pos, state.with(POWERED, !state.get(POWERED)));
|
||||
world.playSound(player, pos, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.2f, 0.5f);
|
||||
return ActionResult.SUCCESS;
|
||||
@@ -50,7 +59,7 @@ public class ShowerHead extends BlockWithEntity implements BlockEntityProvider {
|
||||
@Override
|
||||
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
|
||||
return super.getPlacementState(itemPlacementContext)
|
||||
.with(FACING, itemPlacementContext.getPlayerFacing().getOpposite())
|
||||
.with(FACING, itemPlacementContext.getPlayerLookDirection().getOpposite())
|
||||
.with(POWERED, Boolean.FALSE);
|
||||
}
|
||||
|
||||
@@ -61,13 +70,13 @@ public class ShowerHead extends BlockWithEntity implements BlockEntityProvider {
|
||||
}
|
||||
@Override
|
||||
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) {
|
||||
switch (state.get(FACING)) {
|
||||
case NORTH: return NORTH_SHAPE;
|
||||
case EAST: return EAST_SHAPE;
|
||||
case SOUTH: return SOUTH_SHAPE;
|
||||
case WEST: return WEST_SHAPE;
|
||||
default: return super.getOutlineShape(state, view, pos, context);
|
||||
}
|
||||
return switch (state.get(FACING)) {
|
||||
case NORTH -> NORTH_SHAPE;
|
||||
case EAST -> EAST_SHAPE;
|
||||
case SOUTH -> SOUTH_SHAPE;
|
||||
case WEST -> WEST_SHAPE;
|
||||
default -> super.getOutlineShape(state, view, pos, context);
|
||||
};
|
||||
}
|
||||
static {
|
||||
VoxelShape pipe = createCuboidShape(7, 12, 8.75, 9, 14, 16);
|
||||
@@ -103,8 +112,14 @@ public class ShowerHead extends BlockWithEntity implements BlockEntityProvider {
|
||||
@Nullable
|
||||
@Override
|
||||
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type) {
|
||||
return checkType(type, BlockEntities.ShowerHeadBlockEntity, ShowerHeadBlockEntity::tick);
|
||||
return validateTicker(type, BlockEntities.ShowerHeadBlockEntity, ShowerHeadBlockEntity::tick);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MapCodec<? extends BlockWithEntity> getCodec() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderType getRenderType(BlockState state) {
|
||||
return BlockRenderType.MODEL;
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
package eu.midnightdust.motschen.decorative.block;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.*;
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.HorizontalFacingBlock;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.item.ItemPlacementContext;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.state.StateManager;
|
||||
@@ -19,14 +24,14 @@ public class Sign extends HorizontalFacingBlock {
|
||||
private static final VoxelShape WEST_SHAPE;
|
||||
|
||||
public Sign() {
|
||||
super(FabricBlockSettings.copy(Blocks.STONE).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
super(AbstractBlock.Settings.copy(Blocks.STONE).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH));
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
|
||||
return super.getPlacementState(itemPlacementContext)
|
||||
.with(FACING, itemPlacementContext.getPlayerFacing().getOpposite());
|
||||
.with(FACING, itemPlacementContext.getPlayerLookDirection().getOpposite());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -68,4 +73,8 @@ public class Sign extends HorizontalFacingBlock {
|
||||
return !worldView.isAir(pos.down());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MapCodec<? extends HorizontalFacingBlock> getCodec() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package eu.midnightdust.motschen.decorative.block;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
@@ -15,7 +15,7 @@ public class SignPost extends Block {
|
||||
private static final VoxelShape SHAPE;
|
||||
|
||||
public SignPost() {
|
||||
super(FabricBlockSettings.copy(Blocks.STONE).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
super(AbstractBlock.Settings.copy(Blocks.STONE).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package eu.midnightdust.motschen.decorative.block;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.BlockSetType;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.DoorBlock;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.block.enums.DoorHinge;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
@@ -29,10 +32,11 @@ public class SlidingDoor extends DoorBlock {
|
||||
private static final VoxelShape WEST_SHAPE_OPEN;
|
||||
|
||||
public SlidingDoor() {
|
||||
super(FabricBlockSettings.copy(Blocks.BLACK_CONCRETE).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
super(new BlockSetType("white_concrete"), AbstractBlock.Settings.copy(Blocks.WHITE_CONCRETE).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
}
|
||||
|
||||
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
|
||||
@Override
|
||||
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) {
|
||||
state = state.cycle(OPEN);
|
||||
world.setBlockState(pos, state, 10);
|
||||
world.playSound(player, pos, SoundEvents.BLOCK_IRON_DOOR_OPEN, SoundCategory.BLOCKS, 0.1f, 1.2f);
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
package eu.midnightdust.motschen.decorative.block;
|
||||
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import eu.midnightdust.motschen.decorative.DecorativeMain;
|
||||
import eu.midnightdust.motschen.decorative.blockstates.Part;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.HorizontalFacingBlock;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.effect.StatusEffectInstance;
|
||||
import net.minecraft.entity.effect.StatusEffects;
|
||||
@@ -38,7 +43,7 @@ public class Springboard extends HorizontalFacingBlock {
|
||||
private static final EnumProperty<Part> PART = DecorativeMain.PART;
|
||||
|
||||
public Springboard() {
|
||||
super(FabricBlockSettings.copy(Blocks.STONE).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
super(AbstractBlock.Settings.copy(Blocks.STONE).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH).with(PART, Part.BACK));
|
||||
}
|
||||
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
|
||||
@@ -58,7 +63,7 @@ public class Springboard extends HorizontalFacingBlock {
|
||||
@Override
|
||||
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
|
||||
return Objects.requireNonNull(super.getPlacementState(itemPlacementContext))
|
||||
.with(FACING, itemPlacementContext.getPlayerFacing())
|
||||
.with(FACING, itemPlacementContext.getPlayerLookDirection())
|
||||
.with(PART, Part.BACK);
|
||||
}
|
||||
|
||||
@@ -98,7 +103,7 @@ public class Springboard extends HorizontalFacingBlock {
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) {
|
||||
public BlockState onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) {
|
||||
switch (state.get(PART)) {
|
||||
case BACK: switch (state.get(FACING)) {
|
||||
case NORTH:
|
||||
@@ -145,6 +150,7 @@ public class Springboard extends HorizontalFacingBlock {
|
||||
}
|
||||
}
|
||||
}
|
||||
return Blocks.AIR.getDefaultState();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -244,4 +250,8 @@ public class Springboard extends HorizontalFacingBlock {
|
||||
return !worldView.isAir(pos.down()) && worldView.getBlockState(pos.offset(state.get(FACING))) == Blocks.AIR.getDefaultState();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MapCodec<? extends HorizontalFacingBlock> getCodec() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package eu.midnightdust.motschen.decorative.block;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.item.ItemPlacementContext;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
import net.minecraft.util.shape.VoxelShapes;
|
||||
import net.minecraft.world.BlockView;
|
||||
import net.minecraft.world.WorldView;
|
||||
|
||||
@@ -16,7 +16,7 @@ public class StonePath extends Block {
|
||||
private static final VoxelShape SHAPE;
|
||||
|
||||
public StonePath() {
|
||||
super(FabricBlockSettings.copy(Blocks.STONE).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
super(AbstractBlock.Settings.copy(Blocks.STONE).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
package eu.midnightdust.motschen.decorative.block;
|
||||
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import eu.midnightdust.motschen.decorative.DecorativeMain;
|
||||
import eu.midnightdust.motschen.decorative.blockstates.Program;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.HorizontalFacingBlock;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemPlacementContext;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
@@ -11,9 +16,7 @@ import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.state.property.EnumProperty;
|
||||
import net.minecraft.state.property.Properties;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
@@ -35,45 +38,21 @@ public class Television extends HorizontalFacingBlock {
|
||||
private static final EnumProperty<Program> PROGRAM = DecorativeMain.PROGRAM;
|
||||
|
||||
public Television() {
|
||||
super(FabricBlockSettings.copy(Blocks.BLACK_CONCRETE).nonOpaque().sounds(BlockSoundGroup.STONE).luminance(createLightLevelFromBlockState()));
|
||||
super(AbstractBlock.Settings.copy(Blocks.BLACK_CONCRETE).nonOpaque().sounds(BlockSoundGroup.STONE).luminance(createLightLevelFromBlockState()));
|
||||
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH).with(PROGRAM, Program.OFF));
|
||||
}
|
||||
|
||||
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
|
||||
switch (state.get(PROGRAM)) {
|
||||
case OFF -> {
|
||||
world.setBlockState(pos, state.with(PROGRAM, Program.NYANCAT));
|
||||
@Override
|
||||
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) {
|
||||
world.setBlockState(pos, state.with(PROGRAM, state.get(PROGRAM).next()));
|
||||
world.playSound(player, pos, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.2f, 1.5f);
|
||||
return ActionResult.SUCCESS;
|
||||
}
|
||||
case NYANCAT -> {
|
||||
world.setBlockState(pos, state.with(PROGRAM, Program.CREEPER));
|
||||
world.playSound(player, pos, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.2f, 1.5f);
|
||||
return ActionResult.SUCCESS;
|
||||
}
|
||||
case CREEPER -> {
|
||||
world.setBlockState(pos, state.with(PROGRAM, Program.CRABRAVE));
|
||||
world.playSound(player, pos, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.2f, 1.5f);
|
||||
return ActionResult.SUCCESS;
|
||||
}
|
||||
case CRABRAVE -> {
|
||||
world.setBlockState(pos, state.with(PROGRAM, Program.TATER));
|
||||
world.playSound(player, pos, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.2f, 1.5f);
|
||||
return ActionResult.SUCCESS;
|
||||
}
|
||||
case TATER -> {
|
||||
world.setBlockState(pos, state.with(PROGRAM, Program.OFF));
|
||||
world.playSound(player, pos, SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON, SoundCategory.BLOCKS, 0.2f, 1.5f);
|
||||
return ActionResult.SUCCESS;
|
||||
}
|
||||
}
|
||||
return ActionResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
|
||||
return Objects.requireNonNull(super.getPlacementState(itemPlacementContext))
|
||||
.with(FACING, itemPlacementContext.getPlayerFacing().getOpposite())
|
||||
.with(FACING, itemPlacementContext.getPlayerLookDirection().getOpposite())
|
||||
.with(PROGRAM, Program.OFF);
|
||||
}
|
||||
|
||||
@@ -128,4 +107,8 @@ public class Television extends HorizontalFacingBlock {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected MapCodec<? extends HorizontalFacingBlock> getCodec() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package eu.midnightdust.motschen.decorative.block;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.shape.VoxelShape;
|
||||
@@ -12,7 +15,7 @@ public class TrafficCone extends Block {
|
||||
private static final VoxelShape SHAPE;
|
||||
|
||||
public TrafficCone() {
|
||||
super(FabricBlockSettings.copy(Blocks.STONE).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
super(AbstractBlock.Settings.copy(Blocks.STONE).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
package eu.midnightdust.motschen.decorative.block;
|
||||
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import eu.midnightdust.motschen.decorative.block.blockentity.WallClockBlockEntity;
|
||||
import eu.midnightdust.motschen.decorative.init.BlockEntities;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockEntityProvider;
|
||||
import net.minecraft.block.BlockRenderType;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.BlockWithEntity;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.HorizontalFacingBlock;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.block.entity.BlockEntityTicker;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
@@ -29,7 +37,7 @@ public class WallClock extends BlockWithEntity implements BlockEntityProvider {
|
||||
private static final VoxelShape WEST_SHAPE;
|
||||
|
||||
public WallClock() {
|
||||
super(FabricBlockSettings.copy(Blocks.SMOOTH_QUARTZ).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
super(AbstractBlock.Settings.copy(Blocks.SMOOTH_QUARTZ).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH));
|
||||
}
|
||||
|
||||
@@ -40,8 +48,14 @@ public class WallClock extends BlockWithEntity implements BlockEntityProvider {
|
||||
@Nullable
|
||||
@Override
|
||||
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(World world, BlockState state, BlockEntityType<T> type) {
|
||||
return checkType(type, BlockEntities.WallClockBlockEntity, WallClockBlockEntity::tick);
|
||||
return validateTicker(type, BlockEntities.WallClockBlockEntity, WallClockBlockEntity::tick);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MapCodec<? extends BlockWithEntity> getCodec() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderType getRenderType(BlockState state) {
|
||||
return BlockRenderType.MODEL;
|
||||
@@ -55,7 +69,7 @@ public class WallClock extends BlockWithEntity implements BlockEntityProvider {
|
||||
@Override
|
||||
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
|
||||
return Objects.requireNonNull(super.getPlacementState(itemPlacementContext))
|
||||
.with(FACING, itemPlacementContext.getPlayerFacing().getOpposite());
|
||||
.with(FACING, itemPlacementContext.getPlayerLookDirection().getOpposite());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,15 +1,24 @@
|
||||
package eu.midnightdust.motschen.decorative.block;
|
||||
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||
import net.minecraft.block.*;
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.HorizontalFacingBlock;
|
||||
import net.minecraft.block.ShapeContext;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.item.ItemPlacementContext;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUsage;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.sound.BlockSoundGroup;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
import net.minecraft.state.StateManager;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.ItemActionResult;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
@@ -28,28 +37,25 @@ public class WaterPump extends HorizontalFacingBlock {
|
||||
private static final VoxelShape WEST_SHAPE;
|
||||
|
||||
public WaterPump() {
|
||||
super(FabricBlockSettings.copy(Blocks.STONE).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
super(AbstractBlock.Settings.copy(Blocks.STONE).nonOpaque().sounds(BlockSoundGroup.STONE));
|
||||
this.setDefaultState(this.stateManager.getDefaultState().with(FACING, Direction.NORTH));
|
||||
}
|
||||
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
|
||||
ItemStack itemStack = player.getStackInHand(hand);
|
||||
if (!itemStack.isEmpty() && hand==Hand.MAIN_HAND) {
|
||||
if (itemStack.getItem() == Items.BUCKET) {
|
||||
@Override
|
||||
protected ItemActionResult onUseWithItem(ItemStack stack, BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
|
||||
if (!stack.isEmpty() && hand==Hand.MAIN_HAND && stack.getItem() == Items.BUCKET) {
|
||||
if (!world.isClient) {
|
||||
ItemUsage.exchangeStack(itemStack, player, new ItemStack(Items.BUCKET));
|
||||
ItemUsage.exchangeStack(stack, player, new ItemStack(Items.BUCKET));
|
||||
world.playSound(null, pos, SoundEvents.ITEM_BUCKET_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
}
|
||||
return ActionResult.SUCCESS;
|
||||
return ItemActionResult.SUCCESS;
|
||||
}
|
||||
return ActionResult.PASS;
|
||||
}
|
||||
return ActionResult.PASS;
|
||||
return ItemActionResult.FAIL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getPlacementState(ItemPlacementContext itemPlacementContext) {
|
||||
return Objects.requireNonNull(super.getPlacementState(itemPlacementContext))
|
||||
.with(FACING, itemPlacementContext.getPlayerFacing().getOpposite());
|
||||
.with(FACING, itemPlacementContext.getPlayerLookDirection().getOpposite());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -91,4 +97,8 @@ public class WaterPump extends HorizontalFacingBlock {
|
||||
return !worldView.isAir(pos.down());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MapCodec<? extends HorizontalFacingBlock> getCodec() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,7 @@ import eu.midnightdust.motschen.decorative.DecorativeMain;
|
||||
import eu.midnightdust.motschen.decorative.init.BlockEntities;
|
||||
import eu.midnightdust.motschen.decorative.sound.DecorativeSoundEvents;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.BrewingStandBlock;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.block.entity.BrewingStandBlockEntity;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -4,7 +4,6 @@ import eu.midnightdust.motschen.decorative.init.BlockEntities;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.HorizontalFacingBlock;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.block.entity.JukeboxBlockEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -7,7 +7,6 @@ import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
import net.minecraft.sound.SoundEvents;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.time.LocalTime;
|
||||
|
||||
@@ -11,8 +11,10 @@ import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRendererFactory;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import net.minecraft.util.math.ColorHelper;
|
||||
import net.minecraft.util.math.RotationAxis;
|
||||
|
||||
import static eu.midnightdust.motschen.decorative.DecorativeMain.id;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class CeilingFanRenderer implements BlockEntityRenderer<CeilingFanBlockEntity> {
|
||||
@@ -31,10 +33,10 @@ public class CeilingFanRenderer implements BlockEntityRenderer<CeilingFanBlockEn
|
||||
@Override
|
||||
public void render(CeilingFanBlockEntity blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
|
||||
matrices.push();
|
||||
VertexConsumer vertexConsumer = vertexConsumers.getBuffer(RenderLayer.getEntityCutoutNoCull(new Identifier("decorative:textures/block/ceilingfan.png")));
|
||||
VertexConsumer vertexConsumer = vertexConsumers.getBuffer(RenderLayer.getEntityCutoutNoCull(id("textures/block/ceilingfan.png")));
|
||||
matrices.translate(0.5,0.31,0.5);
|
||||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(blockEntity.getRot()));
|
||||
blades.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV, 1.0F, 1.0F, 1.0F, 1.0F);
|
||||
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(blockEntity.getRot()));
|
||||
blades.render(matrices, vertexConsumer, light, OverlayTexture.DEFAULT_UV, ColorHelper.Argb.fromFloats(1.0F, 1.0F, 1.0F, 1.0F));
|
||||
matrices.pop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,22 +4,23 @@ import eu.midnightdust.motschen.decorative.block.blockentity.ChoppingLogBlockEnt
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.*;
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import net.minecraft.client.render.WorldRenderer;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRendererFactory;
|
||||
import net.minecraft.client.render.model.json.ModelTransformation;
|
||||
import net.minecraft.client.render.model.json.ModelTransformationMode;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import net.minecraft.util.math.RotationAxis;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class ChoppingLogBlockEntityRenderer implements BlockEntityRenderer<ChoppingLogBlockEntity> {
|
||||
private static final MinecraftClient client = MinecraftClient.getInstance();
|
||||
|
||||
public ChoppingLogBlockEntityRenderer(BlockEntityRendererFactory.Context ctx) {
|
||||
}
|
||||
public ChoppingLogBlockEntityRenderer(BlockEntityRendererFactory.Context ctx) {}
|
||||
|
||||
@Override
|
||||
public boolean rendersOutsideBoundingBox(ChoppingLogBlockEntity blockEntity) {
|
||||
@@ -32,9 +33,9 @@ public class ChoppingLogBlockEntityRenderer implements BlockEntityRenderer<Chopp
|
||||
int lightAbove = WorldRenderer.getLightmapCoordinates(Objects.requireNonNull(blockEntity.getWorld()), blockEntity.getPos().up());
|
||||
matrices.translate(blockEntity.getAxeX(), 1.5D, blockEntity.getAxeZ());
|
||||
matrices.scale(2.5f,2.5f,2.5f);
|
||||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(blockEntity.getFacing()));
|
||||
matrices.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(160));
|
||||
MinecraftClient.getInstance().getItemRenderer().renderItem(new ItemStack(Items.IRON_AXE), ModelTransformation.Mode.GROUND, lightAbove, overlay, matrices, vertexConsumers, 0);
|
||||
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(blockEntity.getFacing()));
|
||||
matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(160));
|
||||
client.getItemRenderer().renderItem(new ItemStack(Items.IRON_AXE), ModelTransformationMode.GROUND, lightAbove, overlay, matrices, vertexConsumers, blockEntity.getWorld(), 0);
|
||||
matrices.pop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
package eu.midnightdust.motschen.decorative.block.render;
|
||||
|
||||
import eu.midnightdust.motschen.decorative.DecorativeMain;
|
||||
import eu.midnightdust.motschen.decorative.block.blockentity.DigitalClockBlockEntity;
|
||||
import eu.midnightdust.motschen.decorative.config.DecorativeConfig;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.render.*;
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRendererFactory;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import net.minecraft.util.math.RotationAxis;
|
||||
|
||||
import java.time.LocalTime;
|
||||
|
||||
@@ -68,10 +67,10 @@ public class DigitalClockRenderer implements BlockEntityRenderer<DigitalClockBlo
|
||||
matrices.translate(blockEntity.getX(),0.35,blockEntity.getZ());
|
||||
|
||||
matrices.scale(0.025f, 0.025f, 0.025f);
|
||||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(blockEntity.getFacing()));
|
||||
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(blockEntity.getFacing()));
|
||||
matrices.translate(0,0,-0.1);
|
||||
matrices.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(180));
|
||||
textRenderer.draw(getTime(), 0, 0, 16382457, false, matrices.peek().getPositionMatrix(), vertexConsumers, false, 0, light);
|
||||
matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(180));
|
||||
textRenderer.draw(getTime(), 0, 0, 16382457, false, matrices.peek().getPositionMatrix(), vertexConsumers, TextRenderer.TextLayerType.POLYGON_OFFSET, 0, light);
|
||||
matrices.pop();
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,8 @@ import net.minecraft.client.render.block.entity.BlockEntityRenderer;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRendererFactory;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.Vec3f;
|
||||
import net.minecraft.util.math.ColorHelper;
|
||||
import net.minecraft.util.math.RotationAxis;
|
||||
|
||||
import java.time.LocalTime;
|
||||
|
||||
@@ -32,27 +33,27 @@ public class WallClockRenderer implements BlockEntityRenderer<WallClockBlockEnti
|
||||
|
||||
@Override
|
||||
public void render(WallClockBlockEntity blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) {
|
||||
VertexConsumer vertex = vertexConsumers.getBuffer(RenderLayer.getEntityCutoutNoCull(new Identifier("textures/block/red_concrete.png")));
|
||||
VertexConsumer vertex = vertexConsumers.getBuffer(RenderLayer.getEntityCutoutNoCull(Identifier.ofVanilla("textures/block/red_concrete.png")));
|
||||
|
||||
matrices.push();
|
||||
matrices.translate(blockEntity.x,0.5,blockEntity.z);
|
||||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(blockEntity.facing));
|
||||
matrices.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(LocalTime.now().getSecond() * 6));
|
||||
handsModel.seconds.render(matrices, vertex, light, OverlayTexture.DEFAULT_UV, 1.0F, 1.0F, 1.0F, 1.0F);
|
||||
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(blockEntity.facing));
|
||||
matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(LocalTime.now().getSecond() * 6));
|
||||
handsModel.seconds.render(matrices, vertex, light, OverlayTexture.DEFAULT_UV, ColorHelper.Argb.fromFloats(1.0F, 1.0F, 1.0F, 1.0F));
|
||||
matrices.pop();
|
||||
|
||||
matrices.push();
|
||||
matrices.translate(blockEntity.x,0.5,blockEntity.z);
|
||||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(blockEntity.facing));
|
||||
matrices.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(LocalTime.now().getMinute() * 6));
|
||||
handsModel.minutes.render(matrices, vertex, light, OverlayTexture.DEFAULT_UV, 0.0F, 0.0F, 0.0F, 1.0F);
|
||||
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(blockEntity.facing));
|
||||
matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(LocalTime.now().getMinute() * 6));
|
||||
handsModel.minutes.render(matrices, vertex, light, OverlayTexture.DEFAULT_UV, ColorHelper.Argb.fromFloats(0.0F, 0.0F, 0.0F, 1.0F));
|
||||
matrices.pop();
|
||||
|
||||
matrices.push();
|
||||
matrices.translate(blockEntity.x,0.5,blockEntity.z);
|
||||
matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(blockEntity.facing));
|
||||
matrices.multiply(Vec3f.POSITIVE_Z.getDegreesQuaternion(getHour12hFormat() * 30));
|
||||
handsModel.hours.render(matrices, vertex, light, OverlayTexture.DEFAULT_UV, 0.0F, 0.0F, 0.0F, 1.0F);
|
||||
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(blockEntity.facing));
|
||||
matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(getHour12hFormat() * 30));
|
||||
handsModel.hours.render(matrices, vertex, light, OverlayTexture.DEFAULT_UV, ColorHelper.Argb.fromFloats(0.0F, 0.0F, 0.0F, 1.0F));
|
||||
matrices.pop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,22 @@
|
||||
package eu.midnightdust.motschen.decorative.block.render.model;
|
||||
|
||||
import net.minecraft.client.model.*;
|
||||
import net.minecraft.client.model.Model;
|
||||
import net.minecraft.client.model.ModelData;
|
||||
import net.minecraft.client.model.ModelPart;
|
||||
import net.minecraft.client.model.ModelPartBuilder;
|
||||
import net.minecraft.client.model.ModelPartData;
|
||||
import net.minecraft.client.model.ModelTransform;
|
||||
import net.minecraft.client.model.TexturedModelData;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.render.entity.model.EntityModelLayer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import static eu.midnightdust.motschen.decorative.DecorativeMain.id;
|
||||
|
||||
public class CeilingFanBladesModel extends Model {
|
||||
private final ModelPart blades;
|
||||
public static final EntityModelLayer CEILING_FAN_MODEL_LAYER = new EntityModelLayer(new Identifier("decorative", "ceiling_fan"), "main");
|
||||
public static final EntityModelLayer CEILING_FAN_MODEL_LAYER = new EntityModelLayer(id("ceiling_fan"), "main");
|
||||
|
||||
public CeilingFanBladesModel(ModelPart root) {
|
||||
super(RenderLayer::getEntitySolid);
|
||||
@@ -36,7 +43,7 @@ public class CeilingFanBladesModel extends Model {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, float red, float green, float blue, float alpha) {
|
||||
blades.render(matrices, vertices, light, overlay, red, green, blue, alpha);
|
||||
public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, int color) {
|
||||
blades.render(matrices, vertices, light, overlay, color);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,25 @@
|
||||
package eu.midnightdust.motschen.decorative.block.render.model;
|
||||
|
||||
import net.minecraft.client.model.*;
|
||||
import net.minecraft.client.model.Model;
|
||||
import net.minecraft.client.model.ModelData;
|
||||
import net.minecraft.client.model.ModelPart;
|
||||
import net.minecraft.client.model.ModelPartBuilder;
|
||||
import net.minecraft.client.model.ModelPartData;
|
||||
import net.minecraft.client.model.ModelTransform;
|
||||
import net.minecraft.client.model.TexturedModelData;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.render.entity.model.EntityModelLayer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import static eu.midnightdust.motschen.decorative.DecorativeMain.id;
|
||||
|
||||
public class WallClockHandsModel extends Model {
|
||||
private final ModelPart hands;
|
||||
public final ModelPart seconds;
|
||||
public final ModelPart minutes;
|
||||
public final ModelPart hours;
|
||||
public static final EntityModelLayer CLOCK_HANDS_MODEL_LAYER = new EntityModelLayer(new Identifier("decorative", "clock_hands"), "main");
|
||||
public static final EntityModelLayer CLOCK_HANDS_MODEL_LAYER = new EntityModelLayer(id("clock_hands"), "main");
|
||||
|
||||
public WallClockHandsModel(ModelPart root) {
|
||||
super(RenderLayer::getEntitySolid);
|
||||
@@ -41,7 +48,7 @@ public class WallClockHandsModel extends Model {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, float red, float green, float blue, float alpha) {
|
||||
hands.render(matrices, vertices, light, overlay, red, green, blue, alpha);
|
||||
public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, int color) {
|
||||
hands.render(matrices, vertices, light, overlay, color);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,11 +9,16 @@ public enum CeilingFanStage implements StringIdentifiable {
|
||||
LEVEL_3("level3");
|
||||
|
||||
private final String name;
|
||||
private static final CeilingFanStage[] vals = values();
|
||||
|
||||
CeilingFanStage(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public CeilingFanStage next() {
|
||||
return vals[(this.ordinal() + 1) % vals.length];
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@@ -10,11 +10,16 @@ public enum Program implements StringIdentifiable {
|
||||
TATER("tater");
|
||||
|
||||
private final String name;
|
||||
private static final Program[] vals = values();
|
||||
|
||||
Program(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Program next() {
|
||||
return vals[(this.ordinal() + 1) % vals.length];
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.TimeZone;
|
||||
|
||||
public class DecorativeConfig extends MidnightConfig {
|
||||
@Entry public static TimeFormat timeFormat = TimeZone.getDefault().useDaylightTime() ? TimeFormat.h12 : TimeFormat.h24;
|
||||
@Entry public static boolean polymerIntegration = false;
|
||||
|
||||
public enum TimeFormat {
|
||||
h12, h24
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
package eu.midnightdust.motschen.decorative.config;
|
||||
|
||||
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
|
||||
import com.terraformersmc.modmenu.api.ModMenuApi;
|
||||
import eu.midnightdust.lib.config.MidnightConfig;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class ModMenuIntegration implements ModMenuApi {
|
||||
|
||||
@Override
|
||||
public ConfigScreenFactory<?> getModConfigScreenFactory() {
|
||||
return parent -> MidnightConfig.getScreen(parent,"decorative");
|
||||
}
|
||||
}
|
||||
@@ -1,137 +1,35 @@
|
||||
package eu.midnightdust.motschen.decorative.entity;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.damage.DamageSource;
|
||||
import net.minecraft.entity.passive.PigEntity;
|
||||
import net.minecraft.entity.mob.MobEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.sound.SoundEvent;
|
||||
import net.minecraft.tag.TagKey;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BathTireEntity extends PigEntity {
|
||||
public BathTireEntity(EntityType<? extends PigEntity> entityType, World world) {
|
||||
public class BathTireEntity extends MobEntity {
|
||||
public BathTireEntity(EntityType<? extends BathTireEntity> entityType, World world) {
|
||||
super(entityType, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getAmbientSound() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getHurtSound(DamageSource source) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getDeathSound() {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void playStepSound(BlockPos pos, BlockState state) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEat() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void swimUpward(TagKey<Fluid> fluid) {
|
||||
if (this.getNavigation().canSwim()) {
|
||||
super.swimUpward(fluid);
|
||||
} else {
|
||||
this.setVelocity(this.getVelocity().add(0.0D, 0.7D, 0.0D));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getHeightOffset() {
|
||||
return 0.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canWalkOnFluid(FluidState fluid) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSaddledSpeed() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initGoals() { }
|
||||
|
||||
@Override
|
||||
public boolean canBeRiddenInWater() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int computeFallDamage(float fallDistance, float damageMultiplier) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean cannotDespawn() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean movesIndependently() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canMoveVoluntarily() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeControlledByRider() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult interactAt(PlayerEntity player, Vec3d hitPos, Hand hand) {
|
||||
if (!player.getEntityWorld().isClient && player.getStackInHand(hand)== ItemStack.EMPTY && hand==Hand.MAIN_HAND && player.isSneaking())
|
||||
{
|
||||
if (!player.getEntityWorld().isClient && player.getStackInHand(hand)== ItemStack.EMPTY && hand==Hand.MAIN_HAND ) {
|
||||
if (player.isSneaking()) {
|
||||
this.remove(RemovalReason.DISCARDED);
|
||||
System.out.println(Identifier.tryParse(this.getType().getUntranslatedName()));
|
||||
player.setStackInHand(hand, new ItemStack(Registry.ITEM.get(Identifier.tryParse("decorative:"+this.getType().getUntranslatedName()))));
|
||||
player.setStackInHand(hand, new ItemStack(Registries.ITEM.get(Identifier.tryParse("decorative:" + this.getType().getUntranslatedName()))));
|
||||
return ActionResult.SUCCESS;
|
||||
}
|
||||
else if (!player.getEntityWorld().isClient && player.getStackInHand(hand)== ItemStack.EMPTY && hand==Hand.MAIN_HAND && !player.isSneaking())
|
||||
{
|
||||
else if (!player.isSneaking()) {
|
||||
player.startRiding(this, true);
|
||||
return ActionResult.SUCCESS;
|
||||
}
|
||||
return ActionResult.FAIL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePassengerPosition(Entity passenger) {
|
||||
if(this.getPrimaryPassenger() instanceof PlayerEntity)
|
||||
{
|
||||
passenger.updatePosition(this.getX(),this.getY(),this.getZ());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getXpToDrop(PlayerEntity player) {
|
||||
return 0;
|
||||
return super.interactAt(player, hitPos, hand);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,104 +1,20 @@
|
||||
package eu.midnightdust.motschen.decorative.entity;
|
||||
|
||||
import eu.midnightdust.motschen.decorative.init.Pool;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.damage.DamageSource;
|
||||
import net.minecraft.entity.passive.PigEntity;
|
||||
import net.minecraft.entity.mob.MobEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.sound.SoundEvent;
|
||||
import net.minecraft.tag.TagKey;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BeachBallEntity extends PigEntity {
|
||||
public BeachBallEntity(EntityType<? extends PigEntity> entityType, World world) {
|
||||
public class BeachBallEntity extends MobEntity {
|
||||
public BeachBallEntity(EntityType<? extends BeachBallEntity> entityType, World world) {
|
||||
super(entityType, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getAmbientSound() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getHurtSound(DamageSource source) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getDeathSound() {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void playStepSound(BlockPos pos, BlockState state) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEat() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void swimUpward(TagKey<Fluid> fluid) {
|
||||
this.setVelocity(this.getVelocity().add(0.0D, 1.0D, 0.0D));
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getHeightOffset() {
|
||||
return 0.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canWalkOnFluid(FluidState fluid) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSaddledSpeed() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initGoals() { }
|
||||
|
||||
@Override
|
||||
public boolean canBeRiddenInWater() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int computeFallDamage(float fallDistance, float damageMultiplier) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean cannotDespawn() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean movesIndependently() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canMoveVoluntarily() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeControlledByRider() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult interactAt(PlayerEntity player, Vec3d hitPos, Hand hand) {
|
||||
if(!player.getEntityWorld().isClient && player.getStackInHand(hand)== ItemStack.EMPTY && hand==Hand.MAIN_HAND && player.isSneaking())
|
||||
@@ -109,14 +25,4 @@ public class BeachBallEntity extends PigEntity {
|
||||
}
|
||||
return ActionResult.FAIL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePassengerPosition(Entity passenger) {
|
||||
if(this.getPrimaryPassenger() instanceof PlayerEntity)
|
||||
{
|
||||
passenger.updatePosition(this.getX(),this.getY(),this.getZ());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,17 +1,23 @@
|
||||
package eu.midnightdust.motschen.decorative.entity.client.model;
|
||||
|
||||
import eu.midnightdust.motschen.decorative.entity.BathTireEntity;
|
||||
import net.minecraft.client.model.*;
|
||||
import net.minecraft.client.model.ModelData;
|
||||
import net.minecraft.client.model.ModelPart;
|
||||
import net.minecraft.client.model.ModelPartBuilder;
|
||||
import net.minecraft.client.model.ModelPartData;
|
||||
import net.minecraft.client.model.ModelTransform;
|
||||
import net.minecraft.client.model.TexturedModelData;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.render.entity.model.EntityModel;
|
||||
import net.minecraft.client.render.entity.model.EntityModelLayer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import static eu.midnightdust.motschen.decorative.DecorativeMain.id;
|
||||
|
||||
public class BathTireModel extends EntityModel<BathTireEntity> {
|
||||
private final ModelPart body;
|
||||
public static final EntityModelLayer BATH_TIRE_MODEL_LAYER = new EntityModelLayer(new Identifier("decorative", "bath_tire"), "main");
|
||||
public static final EntityModelLayer BATH_TIRE_MODEL_LAYER = new EntityModelLayer(id("bath_tire"), "main");
|
||||
|
||||
public BathTireModel(ModelPart root) {
|
||||
super(RenderLayer::getEntitySolid);
|
||||
@@ -38,7 +44,7 @@ public class BathTireModel extends EntityModel<BathTireEntity> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrixStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha){
|
||||
public void render(MatrixStack matrixStack, VertexConsumer buffer, int packedLight, int packedOverlay, int color){
|
||||
body.render(matrixStack, buffer, packedLight, packedOverlay);
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,23 @@
|
||||
package eu.midnightdust.motschen.decorative.entity.client.model;
|
||||
|
||||
import eu.midnightdust.motschen.decorative.entity.BeachBallEntity;
|
||||
import net.minecraft.client.model.*;
|
||||
import net.minecraft.client.model.ModelData;
|
||||
import net.minecraft.client.model.ModelPart;
|
||||
import net.minecraft.client.model.ModelPartBuilder;
|
||||
import net.minecraft.client.model.ModelPartData;
|
||||
import net.minecraft.client.model.ModelTransform;
|
||||
import net.minecraft.client.model.TexturedModelData;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.render.entity.model.EntityModel;
|
||||
import net.minecraft.client.render.entity.model.EntityModelLayer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import static eu.midnightdust.motschen.decorative.DecorativeMain.id;
|
||||
|
||||
public class BeachBallModel extends EntityModel<BeachBallEntity> {
|
||||
private final ModelPart body;
|
||||
public static final EntityModelLayer BEACH_BALL_MODEL_LAYER = new EntityModelLayer(new Identifier("decorative", "beach_ball"), "main");
|
||||
public static final EntityModelLayer BEACH_BALL_MODEL_LAYER = new EntityModelLayer(id("beach_ball"), "main");
|
||||
|
||||
public BeachBallModel(ModelPart root) {
|
||||
super(RenderLayer::getEntitySolid);
|
||||
@@ -42,7 +48,7 @@ public class BeachBallModel extends EntityModel<BeachBallEntity> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrixStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha){
|
||||
public void render(MatrixStack matrixStack, VertexConsumer buffer, int packedLight, int packedOverlay, int color){
|
||||
body.render(matrixStack, buffer, packedLight, packedOverlay);
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,23 @@
|
||||
package eu.midnightdust.motschen.decorative.entity.client.model;
|
||||
|
||||
import eu.midnightdust.motschen.decorative.entity.BathTireEntity;
|
||||
import net.minecraft.client.model.*;
|
||||
import net.minecraft.client.model.ModelData;
|
||||
import net.minecraft.client.model.ModelPart;
|
||||
import net.minecraft.client.model.ModelPartBuilder;
|
||||
import net.minecraft.client.model.ModelPartData;
|
||||
import net.minecraft.client.model.ModelTransform;
|
||||
import net.minecraft.client.model.TexturedModelData;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.render.entity.model.EntityModel;
|
||||
import net.minecraft.client.render.entity.model.EntityModelLayer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import static eu.midnightdust.motschen.decorative.DecorativeMain.id;
|
||||
|
||||
public class DuckBathTireModel extends EntityModel<BathTireEntity> {
|
||||
private final ModelPart body;
|
||||
public static final EntityModelLayer DUCK_BATH_TIRE_MODEL_LAYER = new EntityModelLayer(new Identifier("decorative", "duck_bath_tire"), "main");
|
||||
public static final EntityModelLayer DUCK_BATH_TIRE_MODEL_LAYER = new EntityModelLayer(id("duck_bath_tire"), "main");
|
||||
|
||||
public DuckBathTireModel(ModelPart root) {
|
||||
super(RenderLayer::getEntitySolid);
|
||||
@@ -47,7 +53,7 @@ public class DuckBathTireModel extends EntityModel<BathTireEntity> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrixStack, VertexConsumer buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) {
|
||||
public void render(MatrixStack matrixStack, VertexConsumer buffer, int packedLight, int packedOverlay, int color) {
|
||||
body.render(matrixStack, buffer, packedLight, packedOverlay);
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,15 @@
|
||||
package eu.midnightdust.motschen.decorative.entity.client.renderer;
|
||||
|
||||
import eu.midnightdust.motschen.decorative.DecorativeMain;
|
||||
import eu.midnightdust.motschen.decorative.entity.BeachBallEntity;
|
||||
import eu.midnightdust.motschen.decorative.entity.client.model.BeachBallModel;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.render.entity.*;
|
||||
import net.minecraft.client.render.entity.feature.ArmorFeatureRenderer;
|
||||
import net.minecraft.client.render.entity.feature.SlimeOverlayFeatureRenderer;
|
||||
import net.minecraft.client.render.entity.model.*;
|
||||
import net.minecraft.client.render.entity.EntityRendererFactory;
|
||||
import net.minecraft.client.render.entity.MobEntityRenderer;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import static eu.midnightdust.motschen.decorative.DecorativeMain.id;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class BeachBallRenderer extends MobEntityRenderer<BeachBallEntity, BeachBallModel> {
|
||||
|
||||
@@ -20,6 +19,6 @@ public class BeachBallRenderer extends MobEntityRenderer<BeachBallEntity, BeachB
|
||||
|
||||
@Override
|
||||
public Identifier getTexture(BeachBallEntity entity) {
|
||||
return new Identifier(DecorativeMain.MOD_ID, "textures/entity/beach_ball.png");
|
||||
return id("textures/entity/beach_ball.png");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
package eu.midnightdust.motschen.decorative.entity.client.renderer;
|
||||
|
||||
import eu.midnightdust.motschen.decorative.DecorativeMain;
|
||||
import eu.midnightdust.motschen.decorative.entity.BathTireEntity;
|
||||
import eu.midnightdust.motschen.decorative.entity.BeachBallEntity;
|
||||
import eu.midnightdust.motschen.decorative.entity.client.model.BeachBallModel;
|
||||
import eu.midnightdust.motschen.decorative.entity.client.model.DuckBathTireModel;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
||||
import net.minecraft.client.render.entity.EntityRendererFactory;
|
||||
import net.minecraft.client.render.entity.MobEntityRenderer;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import static eu.midnightdust.motschen.decorative.DecorativeMain.id;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class DuckBathTireRenderer extends MobEntityRenderer<BathTireEntity, DuckBathTireModel> {
|
||||
public DuckBathTireRenderer(EntityRendererFactory.Context context) {
|
||||
@@ -20,6 +18,6 @@ public class DuckBathTireRenderer extends MobEntityRenderer<BathTireEntity, Duck
|
||||
|
||||
@Override
|
||||
public Identifier getTexture(BathTireEntity entity) {
|
||||
return new Identifier(DecorativeMain.MOD_ID, "textures/entity/duck_bath_tire.png");
|
||||
return id("textures/entity/duck_bath_tire.png");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,91 +1,65 @@
|
||||
package eu.midnightdust.motschen.decorative.init;
|
||||
|
||||
import eu.midnightdust.motschen.decorative.DecorativeMain;
|
||||
import eu.midnightdust.motschen.decorative.entity.BathTireEntity;
|
||||
import eu.midnightdust.motschen.decorative.item.BathTireItem;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder;
|
||||
import net.minecraft.entity.EntityDimensions;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.SpawnGroup;
|
||||
import net.minecraft.entity.attribute.EntityAttributes;
|
||||
import net.minecraft.entity.mob.MobEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
import static eu.midnightdust.motschen.decorative.DecorativeMain.PoolGroup;
|
||||
import static eu.midnightdust.motschen.decorative.DecorativeMain.id;
|
||||
import static eu.midnightdust.motschen.decorative.util.RegistryUtil.registerItem;
|
||||
|
||||
public class BathTires {
|
||||
public static final EntityType<BathTireEntity> WHITE_BATH_TIRE =
|
||||
Registry.register(Registry.ENTITY_TYPE,new Identifier(DecorativeMain.MOD_ID,"white_bath_tire"), FabricEntityTypeBuilder.create(SpawnGroup.AMBIENT,BathTireEntity::new).dimensions(EntityDimensions.fixed(1.5f,1)).trackable(100,4).build());
|
||||
public static final EntityType<BathTireEntity> ORANGE_BATH_TIRE =
|
||||
Registry.register(Registry.ENTITY_TYPE,new Identifier(DecorativeMain.MOD_ID,"orange_bath_tire"), FabricEntityTypeBuilder.create(SpawnGroup.AMBIENT,BathTireEntity::new).dimensions(EntityDimensions.fixed(1.5f,1)).trackable(100,4).build());
|
||||
public static final EntityType<BathTireEntity> MAGENTA_BATH_TIRE=
|
||||
Registry.register(Registry.ENTITY_TYPE,new Identifier(DecorativeMain.MOD_ID,"magenta_bath_tire"), FabricEntityTypeBuilder.create(SpawnGroup.AMBIENT,BathTireEntity::new).dimensions(EntityDimensions.fixed(1.5f,1)).trackable(100,4).build());
|
||||
public static final EntityType<BathTireEntity> LIGHT_BLUE_BATH_TIRE =
|
||||
Registry.register(Registry.ENTITY_TYPE,new Identifier(DecorativeMain.MOD_ID,"light_blue_bath_tire"), FabricEntityTypeBuilder.create(SpawnGroup.AMBIENT,BathTireEntity::new).dimensions(EntityDimensions.fixed(1.5f,1)).trackable(100,4).build());
|
||||
public static final EntityType<BathTireEntity> YELLOW_BATH_TIRE =
|
||||
Registry.register(Registry.ENTITY_TYPE,new Identifier(DecorativeMain.MOD_ID,"yellow_bath_tire"), FabricEntityTypeBuilder.create(SpawnGroup.AMBIENT,BathTireEntity::new).dimensions(EntityDimensions.fixed(1.5f,1)).trackable(100,4).build());
|
||||
public static final EntityType<BathTireEntity> LIME_BATH_TIRE =
|
||||
Registry.register(Registry.ENTITY_TYPE,new Identifier(DecorativeMain.MOD_ID,"lime_bath_tire"), FabricEntityTypeBuilder.create(SpawnGroup.AMBIENT,BathTireEntity::new).dimensions(EntityDimensions.fixed(1.5f,1)).trackable(100,4).build());
|
||||
public static final EntityType<BathTireEntity> PINK_BATH_TIRE =
|
||||
Registry.register(Registry.ENTITY_TYPE,new Identifier(DecorativeMain.MOD_ID,"pink_bath_tire"), FabricEntityTypeBuilder.create(SpawnGroup.AMBIENT,BathTireEntity::new).dimensions(EntityDimensions.fixed(1.5f,1)).trackable(100,4).build());
|
||||
public static final EntityType<BathTireEntity> GRAY_BATH_TIRE =
|
||||
Registry.register(Registry.ENTITY_TYPE,new Identifier(DecorativeMain.MOD_ID,"gray_bath_tire"), FabricEntityTypeBuilder.create(SpawnGroup.AMBIENT,BathTireEntity::new).dimensions(EntityDimensions.fixed(1.5f,1)).trackable(100,4).build());
|
||||
public static final EntityType<BathTireEntity> LIGHT_GRAY_BATH_TIRE =
|
||||
Registry.register(Registry.ENTITY_TYPE,new Identifier(DecorativeMain.MOD_ID,"light_gray_bath_tire"), FabricEntityTypeBuilder.create(SpawnGroup.AMBIENT,BathTireEntity::new).dimensions(EntityDimensions.fixed(1.5f,1)).trackable(100,4).build());
|
||||
public static final EntityType<BathTireEntity> CYAN_BATH_TIRE =
|
||||
Registry.register(Registry.ENTITY_TYPE,new Identifier(DecorativeMain.MOD_ID,"cyan_bath_tire"), FabricEntityTypeBuilder.create(SpawnGroup.AMBIENT,BathTireEntity::new).dimensions(EntityDimensions.fixed(1.5f,1)).trackable(100,4).build());
|
||||
public static final EntityType<BathTireEntity> PURPLE_BATH_TIRE =
|
||||
Registry.register(Registry.ENTITY_TYPE,new Identifier(DecorativeMain.MOD_ID,"purple_bath_tire"), FabricEntityTypeBuilder.create(SpawnGroup.AMBIENT,BathTireEntity::new).dimensions(EntityDimensions.fixed(1.5f,1)).trackable(100,4).build());
|
||||
public static final EntityType<BathTireEntity> BLUE_BATH_TIRE =
|
||||
Registry.register(Registry.ENTITY_TYPE,new Identifier(DecorativeMain.MOD_ID,"blue_bath_tire"), FabricEntityTypeBuilder.create(SpawnGroup.AMBIENT,BathTireEntity::new).dimensions(EntityDimensions.fixed(1.5f,1)).trackable(100,4).build());
|
||||
public static final EntityType<BathTireEntity> BROWN_BATH_TIRE =
|
||||
Registry.register(Registry.ENTITY_TYPE,new Identifier(DecorativeMain.MOD_ID,"brown_bath_tire"), FabricEntityTypeBuilder.create(SpawnGroup.AMBIENT,BathTireEntity::new).dimensions(EntityDimensions.fixed(1.5f,1)).trackable(100,4).build());
|
||||
public static final EntityType<BathTireEntity> GREEN_BATH_TIRE =
|
||||
Registry.register(Registry.ENTITY_TYPE,new Identifier(DecorativeMain.MOD_ID,"green_bath_tire"), FabricEntityTypeBuilder.create(SpawnGroup.AMBIENT,BathTireEntity::new).dimensions(EntityDimensions.fixed(1.5f,1)).trackable(100,4).build());
|
||||
public static final EntityType<BathTireEntity> RED_BATH_TIRE =
|
||||
Registry.register(Registry.ENTITY_TYPE,new Identifier(DecorativeMain.MOD_ID,"red_bath_tire"), FabricEntityTypeBuilder.create(SpawnGroup.AMBIENT,BathTireEntity::new).dimensions(EntityDimensions.fixed(1.5f,1)).trackable(100,4).build());
|
||||
public static final EntityType<BathTireEntity> BLACK_BATH_TIRE =
|
||||
Registry.register(Registry.ENTITY_TYPE,new Identifier(DecorativeMain.MOD_ID,"black_bath_tire"), FabricEntityTypeBuilder.create(SpawnGroup.AMBIENT,BathTireEntity::new).dimensions(EntityDimensions.fixed(1.5f,1)).trackable(100,4).build());
|
||||
public static EntityType<BathTireEntity> WHITE_BATH_TIRE;
|
||||
public static EntityType<BathTireEntity> ORANGE_BATH_TIRE;
|
||||
public static EntityType<BathTireEntity> MAGENTA_BATH_TIRE;
|
||||
public static EntityType<BathTireEntity> LIGHT_BLUE_BATH_TIRE;
|
||||
public static EntityType<BathTireEntity> YELLOW_BATH_TIRE;
|
||||
public static EntityType<BathTireEntity> LIME_BATH_TIRE;
|
||||
public static EntityType<BathTireEntity> PINK_BATH_TIRE;
|
||||
public static EntityType<BathTireEntity> GRAY_BATH_TIRE;
|
||||
public static EntityType<BathTireEntity> LIGHT_GRAY_BATH_TIRE;
|
||||
public static EntityType<BathTireEntity> CYAN_BATH_TIRE;
|
||||
public static EntityType<BathTireEntity> PURPLE_BATH_TIRE;
|
||||
public static EntityType<BathTireEntity> BLUE_BATH_TIRE;
|
||||
public static EntityType<BathTireEntity> BROWN_BATH_TIRE;
|
||||
public static EntityType<BathTireEntity> GREEN_BATH_TIRE;
|
||||
public static EntityType<BathTireEntity> RED_BATH_TIRE;
|
||||
public static EntityType<BathTireEntity> BLACK_BATH_TIRE;
|
||||
|
||||
public static final EntityType<BathTireEntity> DUCK_BATH_TIRE =
|
||||
Registry.register(Registry.ENTITY_TYPE,new Identifier(DecorativeMain.MOD_ID,"duck_bath_tire"), FabricEntityTypeBuilder.create(SpawnGroup.AMBIENT,BathTireEntity::new).dimensions(EntityDimensions.fixed(1.5f,1)).trackable(100,4).build());
|
||||
public static EntityType<BathTireEntity> DUCK_BATH_TIRE;
|
||||
|
||||
public static void init() {
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"white_bath_tire"), new BathTireItem(WHITE_BATH_TIRE, new Item.Settings().group(DecorativeMain.PoolGroup)));
|
||||
FabricDefaultAttributeRegistry.register(WHITE_BATH_TIRE, MobEntity.createMobAttributes().add(EntityAttributes.GENERIC_MAX_HEALTH, 2.0D));
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"orange_bath_tire"), new BathTireItem(ORANGE_BATH_TIRE, new Item.Settings().group(DecorativeMain.PoolGroup)));
|
||||
FabricDefaultAttributeRegistry.register(ORANGE_BATH_TIRE, MobEntity.createMobAttributes().add(EntityAttributes.GENERIC_MAX_HEALTH, 2.0D));
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"magenta_bath_tire"), new BathTireItem(MAGENTA_BATH_TIRE, new Item.Settings().group(DecorativeMain.PoolGroup)));
|
||||
FabricDefaultAttributeRegistry.register(MAGENTA_BATH_TIRE, MobEntity.createMobAttributes().add(EntityAttributes.GENERIC_MAX_HEALTH, 2.0D));
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"light_blue_bath_tire"), new BathTireItem(LIGHT_BLUE_BATH_TIRE, new Item.Settings().group(DecorativeMain.PoolGroup)));
|
||||
FabricDefaultAttributeRegistry.register(LIGHT_BLUE_BATH_TIRE, MobEntity.createMobAttributes().add(EntityAttributes.GENERIC_MAX_HEALTH, 2.0D));
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"yellow_bath_tire"), new BathTireItem(YELLOW_BATH_TIRE, new Item.Settings().group(DecorativeMain.PoolGroup)));
|
||||
FabricDefaultAttributeRegistry.register(YELLOW_BATH_TIRE, MobEntity.createMobAttributes().add(EntityAttributes.GENERIC_MAX_HEALTH, 2.0D));
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"lime_bath_tire"), new BathTireItem(LIME_BATH_TIRE, new Item.Settings().group(DecorativeMain.PoolGroup)));
|
||||
FabricDefaultAttributeRegistry.register(LIME_BATH_TIRE, MobEntity.createMobAttributes().add(EntityAttributes.GENERIC_MAX_HEALTH, 2.0D));
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"pink_bath_tire"), new BathTireItem(PINK_BATH_TIRE, new Item.Settings().group(DecorativeMain.PoolGroup)));
|
||||
FabricDefaultAttributeRegistry.register(PINK_BATH_TIRE, MobEntity.createMobAttributes().add(EntityAttributes.GENERIC_MAX_HEALTH, 2.0D));
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"gray_bath_tire"), new BathTireItem(GRAY_BATH_TIRE, new Item.Settings().group(DecorativeMain.PoolGroup)));
|
||||
FabricDefaultAttributeRegistry.register(GRAY_BATH_TIRE, MobEntity.createMobAttributes().add(EntityAttributes.GENERIC_MAX_HEALTH, 2.0D));
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"light_gray_bath_tire"), new BathTireItem(LIGHT_GRAY_BATH_TIRE, new Item.Settings().group(DecorativeMain.PoolGroup)));
|
||||
FabricDefaultAttributeRegistry.register(LIGHT_GRAY_BATH_TIRE, MobEntity.createMobAttributes().add(EntityAttributes.GENERIC_MAX_HEALTH, 2.0D));
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"cyan_bath_tire"), new BathTireItem(CYAN_BATH_TIRE, new Item.Settings().group(DecorativeMain.PoolGroup)));
|
||||
FabricDefaultAttributeRegistry.register(CYAN_BATH_TIRE, MobEntity.createMobAttributes().add(EntityAttributes.GENERIC_MAX_HEALTH, 2.0D));
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"purple_bath_tire"), new BathTireItem(PURPLE_BATH_TIRE, new Item.Settings().group(DecorativeMain.PoolGroup)));
|
||||
FabricDefaultAttributeRegistry.register(PURPLE_BATH_TIRE, MobEntity.createMobAttributes().add(EntityAttributes.GENERIC_MAX_HEALTH, 2.0D));
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"blue_bath_tire"), new BathTireItem(BLUE_BATH_TIRE, new Item.Settings().group(DecorativeMain.PoolGroup)));
|
||||
FabricDefaultAttributeRegistry.register(BLUE_BATH_TIRE, MobEntity.createMobAttributes().add(EntityAttributes.GENERIC_MAX_HEALTH, 2.0D));
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"brown_bath_tire"), new BathTireItem(BROWN_BATH_TIRE, new Item.Settings().group(DecorativeMain.PoolGroup)));
|
||||
FabricDefaultAttributeRegistry.register(BROWN_BATH_TIRE, MobEntity.createMobAttributes().add(EntityAttributes.GENERIC_MAX_HEALTH, 2.0D));
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"green_bath_tire"), new BathTireItem(GREEN_BATH_TIRE, new Item.Settings().group(DecorativeMain.PoolGroup)));
|
||||
FabricDefaultAttributeRegistry.register(GREEN_BATH_TIRE, MobEntity.createMobAttributes().add(EntityAttributes.GENERIC_MAX_HEALTH, 2.0D));
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"red_bath_tire"), new BathTireItem(RED_BATH_TIRE, new Item.Settings().group(DecorativeMain.PoolGroup)));
|
||||
FabricDefaultAttributeRegistry.register(RED_BATH_TIRE, MobEntity.createMobAttributes().add(EntityAttributes.GENERIC_MAX_HEALTH, 2.0D));
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"black_bath_tire"), new BathTireItem(BLACK_BATH_TIRE, new Item.Settings().group(DecorativeMain.PoolGroup)));
|
||||
FabricDefaultAttributeRegistry.register(BLACK_BATH_TIRE, MobEntity.createMobAttributes().add(EntityAttributes.GENERIC_MAX_HEALTH, 2.0D));
|
||||
WHITE_BATH_TIRE = registerBathTire(id("white_bath_tire"));
|
||||
ORANGE_BATH_TIRE = registerBathTire(id("orange_bath_tire"));
|
||||
MAGENTA_BATH_TIRE= registerBathTire(id("magenta_bath_tire"));
|
||||
LIGHT_BLUE_BATH_TIRE = registerBathTire(id("light_blue_bath_tire"));
|
||||
YELLOW_BATH_TIRE = registerBathTire(id("yellow_bath_tire"));
|
||||
LIME_BATH_TIRE = registerBathTire(id("lime_bath_tire"));
|
||||
PINK_BATH_TIRE = registerBathTire(id("pink_bath_tire"));
|
||||
GRAY_BATH_TIRE = registerBathTire(id("gray_bath_tire"));
|
||||
LIGHT_GRAY_BATH_TIRE = registerBathTire(id("light_gray_bath_tire"));
|
||||
CYAN_BATH_TIRE = registerBathTire(id("cyan_bath_tire"));
|
||||
PURPLE_BATH_TIRE = registerBathTire(id("purple_bath_tire"));
|
||||
BLUE_BATH_TIRE = registerBathTire(id("blue_bath_tire"));
|
||||
BROWN_BATH_TIRE = registerBathTire(id("brown_bath_tire"));
|
||||
GREEN_BATH_TIRE = registerBathTire(id("green_bath_tire"));
|
||||
RED_BATH_TIRE = registerBathTire(id("red_bath_tire"));
|
||||
BLACK_BATH_TIRE = registerBathTire(id("black_bath_tire"));
|
||||
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"duck_bath_tire"), new BathTireItem(DUCK_BATH_TIRE, new Item.Settings().group(DecorativeMain.PoolGroup)));
|
||||
FabricDefaultAttributeRegistry.register(DUCK_BATH_TIRE, MobEntity.createMobAttributes().add(EntityAttributes.GENERIC_MAX_HEALTH, 2.0D));
|
||||
DUCK_BATH_TIRE = registerBathTire(id("duck_bath_tire"));
|
||||
}
|
||||
private static EntityType<BathTireEntity> registerBathTire(Identifier id) {
|
||||
EntityType<BathTireEntity> entity = Registry.register(Registries.ENTITY_TYPE, id, EntityType.Builder.create(BathTireEntity::new, SpawnGroup.AMBIENT).dimensions(1.5f,1).maxTrackingRange(100).trackingTickInterval(4).build());
|
||||
FabricDefaultAttributeRegistry.register(entity, MobEntity.createMobAttributes().add(EntityAttributes.GENERIC_MAX_HEALTH, 2.0D));
|
||||
registerItem(id, new BathTireItem(entity, new Item.Settings()), PoolGroup);
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,16 @@ package eu.midnightdust.motschen.decorative.init;
|
||||
|
||||
import eu.midnightdust.motschen.decorative.DecorativeMain;
|
||||
import eu.midnightdust.motschen.decorative.block.blockentity.*;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.block.entity.FabricBlockEntityTypeBuilder;
|
||||
import net.minecraft.block.Blocks;
|
||||
import eu.midnightdust.motschen.decorative.config.DecorativeConfig;
|
||||
import eu.pb4.polymer.core.api.block.PolymerBlockUtils;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.block.entity.BlockEntityType;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
import static eu.midnightdust.motschen.decorative.DecorativeMain.id;
|
||||
|
||||
public class BlockEntities {
|
||||
|
||||
@@ -18,11 +23,16 @@ public class BlockEntities {
|
||||
public static BlockEntityType<DigitalClockBlockEntity> DigitalClockBlockEntity;
|
||||
|
||||
public static void init() {
|
||||
PoolSprinklerBlockEntity = Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(DecorativeMain.MOD_ID,"pool_sprinkler_blockentity"), FabricBlockEntityTypeBuilder.create(PoolSprinklerBlockEntity::new, Pool.PoolSprinkler).build(null));
|
||||
ShowerHeadBlockEntity = Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(DecorativeMain.MOD_ID,"shower_head_blockentity"), FabricBlockEntityTypeBuilder.create(ShowerHeadBlockEntity::new, DecorativeMain.ShowerHead).build(null));
|
||||
CeilingFanBlockEntity = Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(DecorativeMain.MOD_ID,"ceiling_fan_blockentity"), FabricBlockEntityTypeBuilder.create(CeilingFanBlockEntity::new, DecorativeMain.CeilingFan).build(null));
|
||||
ChoppingLogBlockEntity = Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(DecorativeMain.MOD_ID,"chopping_log_blockentity"), FabricBlockEntityTypeBuilder.create(ChoppingLogBlockEntity::new, LogsWithAxes.OakChoppingLog, LogsWithAxes.BirchChoppingLog, LogsWithAxes.AcaciaChoppingLog, LogsWithAxes.DarkOakChoppingLog, LogsWithAxes.JungleChoppingLog, LogsWithAxes.SpruceChoppingLog).build(null));
|
||||
WallClockBlockEntity = Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(DecorativeMain.MOD_ID,"wall_clock_blockentity"), FabricBlockEntityTypeBuilder.create(WallClockBlockEntity::new, DecorativeMain.WallClock).build(null));
|
||||
DigitalClockBlockEntity = Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(DecorativeMain.MOD_ID,"digital_clock_blockentity"), FabricBlockEntityTypeBuilder.create(DigitalClockBlockEntity::new, Clocks.RedDigitalClock, Clocks.BlackDigitalClock, Clocks.BlueDigitalClock, Clocks.BrownDigitalClock, Clocks.CyanDigitalClock, Clocks.GrayDigitalClock, Clocks.GreenDigitalClock, Clocks.LightBlueDigitalClock, Clocks.LightGrayDigitalClock, Clocks.LimeDigitalClock, Clocks.MagentaDigitalClock, Clocks.OrangeDigitalClock, Clocks.PinkDigitalClock, Clocks.PurpleDigitalClock, Clocks.WhiteDigitalClock, Clocks.YellowDigitalClock).build(null));
|
||||
PoolSprinklerBlockEntity = registerBlockEntity(id("pool_sprinkler_blockentity"), PoolSprinklerBlockEntity::new, Pool.PoolSprinkler);
|
||||
ShowerHeadBlockEntity = registerBlockEntity(id("shower_head_blockentity"), ShowerHeadBlockEntity::new, DecorativeMain.ShowerHead);
|
||||
CeilingFanBlockEntity = registerBlockEntity(id("ceiling_fan_blockentity"), CeilingFanBlockEntity::new, DecorativeMain.CeilingFan);
|
||||
ChoppingLogBlockEntity = registerBlockEntity( id("chopping_log_blockentity"), ChoppingLogBlockEntity::new, LogsWithAxes.OakChoppingLog, LogsWithAxes.BirchChoppingLog, LogsWithAxes.AcaciaChoppingLog, LogsWithAxes.DarkOakChoppingLog, LogsWithAxes.JungleChoppingLog, LogsWithAxes.SpruceChoppingLog);
|
||||
WallClockBlockEntity = registerBlockEntity(id("wall_clock_blockentity"), WallClockBlockEntity::new, DecorativeMain.WallClock);
|
||||
DigitalClockBlockEntity = registerBlockEntity(id("digital_clock_blockentity"), DigitalClockBlockEntity::new, Clocks.RedDigitalClock, Clocks.BlackDigitalClock, Clocks.BlueDigitalClock, Clocks.BrownDigitalClock, Clocks.CyanDigitalClock, Clocks.GrayDigitalClock, Clocks.GreenDigitalClock, Clocks.LightBlueDigitalClock, Clocks.LightGrayDigitalClock, Clocks.LimeDigitalClock, Clocks.MagentaDigitalClock, Clocks.OrangeDigitalClock, Clocks.PinkDigitalClock, Clocks.PurpleDigitalClock, Clocks.WhiteDigitalClock, Clocks.YellowDigitalClock);
|
||||
}
|
||||
private static <T extends BlockEntity> BlockEntityType<T> registerBlockEntity(Identifier id, BlockEntityType.BlockEntityFactory<T> factory, Block... blocks) {
|
||||
var blockEntity = Registry.register(Registries.BLOCK_ENTITY_TYPE, id, BlockEntityType.Builder.create(factory, blocks).build(null));
|
||||
if (DecorativeConfig.polymerIntegration) PolymerBlockUtils.registerBlockEntity(blockEntity);
|
||||
return blockEntity;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package eu.midnightdust.motschen.decorative.init;
|
||||
|
||||
import eu.midnightdust.motschen.decorative.DecorativeMain;
|
||||
import eu.midnightdust.motschen.decorative.block.DigitalClock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
import static eu.midnightdust.motschen.decorative.DecorativeMain.id;
|
||||
import static eu.midnightdust.motschen.decorative.util.RegistryUtil.registerFurniture;
|
||||
|
||||
public class Clocks {
|
||||
public static Block WhiteDigitalClock = new DigitalClock();
|
||||
@@ -27,37 +25,21 @@ public class Clocks {
|
||||
public static Block BlackDigitalClock = new DigitalClock();
|
||||
|
||||
public static void init() {
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"white_digital_clock"), WhiteDigitalClock);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"white_digital_clock"), new BlockItem(WhiteDigitalClock, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"orange_digital_clock"), OrangeDigitalClock);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"orange_digital_clock"), new BlockItem(OrangeDigitalClock, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"magenta_digital_clock"), MagentaDigitalClock);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"magenta_digital_clock"), new BlockItem(MagentaDigitalClock, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"light_blue_digital_clock"), LightBlueDigitalClock);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"light_blue_digital_clock"), new BlockItem(LightBlueDigitalClock, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"yellow_digital_clock"), YellowDigitalClock);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"yellow_digital_clock"), new BlockItem(YellowDigitalClock, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"lime_digital_clock"), LimeDigitalClock);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"lime_digital_clock"), new BlockItem(LimeDigitalClock, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"pink_digital_clock"), PinkDigitalClock);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"pink_digital_clock"), new BlockItem(PinkDigitalClock, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"gray_digital_clock"), GrayDigitalClock);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"gray_digital_clock"), new BlockItem(GrayDigitalClock, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"light_gray_digital_clock"), LightGrayDigitalClock);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"light_gray_digital_clock"), new BlockItem(LightGrayDigitalClock, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"cyan_digital_clock"), CyanDigitalClock);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"cyan_digital_clock"), new BlockItem(CyanDigitalClock, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"purple_digital_clock"), PurpleDigitalClock);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"purple_digital_clock"), new BlockItem(PurpleDigitalClock, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"blue_digital_clock"), BlueDigitalClock);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"blue_digital_clock"), new BlockItem(BlueDigitalClock, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"brown_digital_clock"), BrownDigitalClock);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"brown_digital_clock"), new BlockItem(BrownDigitalClock, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"green_digital_clock"), GreenDigitalClock);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"green_digital_clock"), new BlockItem(GreenDigitalClock, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"red_digital_clock"), RedDigitalClock);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"red_digital_clock"), new BlockItem(RedDigitalClock, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"black_digital_clock"), BlackDigitalClock);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"black_digital_clock"), new BlockItem(BlackDigitalClock, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
registerFurniture(id("white_digital_clock"), WhiteDigitalClock);
|
||||
registerFurniture(id("orange_digital_clock"), OrangeDigitalClock);
|
||||
registerFurniture(id("magenta_digital_clock"), MagentaDigitalClock);
|
||||
registerFurniture(id("light_blue_digital_clock"), LightBlueDigitalClock);
|
||||
registerFurniture(id("yellow_digital_clock"), YellowDigitalClock);
|
||||
registerFurniture(id("lime_digital_clock"), LimeDigitalClock);
|
||||
registerFurniture(id("pink_digital_clock"), PinkDigitalClock);
|
||||
registerFurniture(id("gray_digital_clock"), GrayDigitalClock);
|
||||
registerFurniture(id("light_gray_digital_clock"), LightGrayDigitalClock);
|
||||
registerFurniture(id("cyan_digital_clock"), CyanDigitalClock);
|
||||
registerFurniture(id("purple_digital_clock"), PurpleDigitalClock);
|
||||
registerFurniture(id("blue_digital_clock"), BlueDigitalClock);
|
||||
registerFurniture(id("brown_digital_clock"), BrownDigitalClock);
|
||||
registerFurniture(id("green_digital_clock"), GreenDigitalClock);
|
||||
registerFurniture(id("red_digital_clock"), RedDigitalClock);
|
||||
registerFurniture(id("black_digital_clock"), BlackDigitalClock);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package eu.midnightdust.motschen.decorative.init;
|
||||
|
||||
import eu.midnightdust.motschen.decorative.DecorativeMain;
|
||||
import eu.midnightdust.motschen.decorative.block.DoubleLamp;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
import static eu.midnightdust.motschen.decorative.DecorativeMain.id;
|
||||
import static eu.midnightdust.motschen.decorative.util.RegistryUtil.registerFurniture;
|
||||
|
||||
public class DoubleLamps {
|
||||
public static Block WhiteDoubleLamp = new DoubleLamp();
|
||||
@@ -27,37 +25,21 @@ public class DoubleLamps {
|
||||
public static Block BlackDoubleLamp = new DoubleLamp();
|
||||
|
||||
public static void init() {
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"white_double_lamp"), WhiteDoubleLamp);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"white_double_lamp"), new BlockItem(WhiteDoubleLamp, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"orange_double_lamp"), OrangeDoubleLamp);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"orange_double_lamp"), new BlockItem(OrangeDoubleLamp, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"magenta_double_lamp"), MagentaDoubleLamp);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"magenta_double_lamp"), new BlockItem(MagentaDoubleLamp, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"light_blue_double_lamp"), LightBlueDoubleLamp);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"light_blue_double_lamp"), new BlockItem(LightBlueDoubleLamp, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"yellow_double_lamp"), YellowDoubleLamp);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"yellow_double_lamp"), new BlockItem(YellowDoubleLamp, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"lime_double_lamp"), LimeDoubleLamp);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"lime_double_lamp"), new BlockItem(LimeDoubleLamp, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"pink_double_lamp"), PinkDoubleLamp);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"pink_double_lamp"), new BlockItem(PinkDoubleLamp, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"gray_double_lamp"), GrayDoubleLamp);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"gray_double_lamp"), new BlockItem(GrayDoubleLamp, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"light_gray_double_lamp"), LightGrayDoubleLamp);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"light_gray_double_lamp"), new BlockItem(LightGrayDoubleLamp, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"cyan_double_lamp"), CyanDoubleLamp);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"cyan_double_lamp"), new BlockItem(CyanDoubleLamp, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"purple_double_lamp"), PurpleDoubleLamp);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"purple_double_lamp"), new BlockItem(PurpleDoubleLamp, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"blue_double_lamp"), BlueDoubleLamp);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"blue_double_lamp"), new BlockItem(BlueDoubleLamp, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"brown_double_lamp"), BrownDoubleLamp);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"brown_double_lamp"), new BlockItem(BrownDoubleLamp, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"green_double_lamp"), GreenDoubleLamp);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"green_double_lamp"), new BlockItem(GreenDoubleLamp, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"red_double_lamp"), RedDoubleLamp);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"red_double_lamp"), new BlockItem(RedDoubleLamp, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"black_double_lamp"), BlackDoubleLamp);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"black_double_lamp"), new BlockItem(BlackDoubleLamp, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
registerFurniture(id("white_double_lamp"), WhiteDoubleLamp);
|
||||
registerFurniture(id("orange_double_lamp"), OrangeDoubleLamp);
|
||||
registerFurniture(id("magenta_double_lamp"), MagentaDoubleLamp);
|
||||
registerFurniture(id("light_blue_double_lamp"), LightBlueDoubleLamp);
|
||||
registerFurniture(id("yellow_double_lamp"), YellowDoubleLamp);
|
||||
registerFurniture(id("lime_double_lamp"), LimeDoubleLamp);
|
||||
registerFurniture(id("pink_double_lamp"), PinkDoubleLamp);
|
||||
registerFurniture(id("gray_double_lamp"), GrayDoubleLamp);
|
||||
registerFurniture(id("light_gray_double_lamp"), LightGrayDoubleLamp);
|
||||
registerFurniture(id("cyan_double_lamp"), CyanDoubleLamp);
|
||||
registerFurniture(id("purple_double_lamp"), PurpleDoubleLamp);
|
||||
registerFurniture(id("blue_double_lamp"), BlueDoubleLamp);
|
||||
registerFurniture(id("brown_double_lamp"), BrownDoubleLamp);
|
||||
registerFurniture(id("green_double_lamp"), GreenDoubleLamp);
|
||||
registerFurniture(id("red_double_lamp"), RedDoubleLamp);
|
||||
registerFurniture(id("black_double_lamp"), BlackDoubleLamp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package eu.midnightdust.motschen.decorative.init;
|
||||
|
||||
import eu.midnightdust.motschen.decorative.DecorativeMain;
|
||||
import eu.midnightdust.motschen.decorative.block.Lamp;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
import static eu.midnightdust.motschen.decorative.DecorativeMain.id;
|
||||
import static eu.midnightdust.motschen.decorative.util.RegistryUtil.registerFurniture;
|
||||
|
||||
public class Lamps {
|
||||
public static Block WhiteLamp = new Lamp();
|
||||
@@ -27,37 +25,21 @@ public class Lamps {
|
||||
public static Block BlackLamp = new Lamp();
|
||||
|
||||
public static void init() {
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"white_lamp"), WhiteLamp);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"white_lamp"), new BlockItem(WhiteLamp, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"orange_lamp"), OrangeLamp);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"orange_lamp"), new BlockItem(OrangeLamp, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"magenta_lamp"), MagentaLamp);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"magenta_lamp"), new BlockItem(MagentaLamp, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"light_blue_lamp"), LightBlueLamp);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"light_blue_lamp"), new BlockItem(LightBlueLamp, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"yellow_lamp"), YellowLamp);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"yellow_lamp"), new BlockItem(YellowLamp, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"lime_lamp"), LimeLamp);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"lime_lamp"), new BlockItem(LimeLamp, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"pink_lamp"), PinkLamp);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"pink_lamp"), new BlockItem(PinkLamp, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"gray_lamp"), GrayLamp);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"gray_lamp"), new BlockItem(GrayLamp, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"light_gray_lamp"), LightGrayLamp);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"light_gray_lamp"), new BlockItem(LightGrayLamp, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"cyan_lamp"), CyanLamp);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"cyan_lamp"), new BlockItem(CyanLamp, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"purple_lamp"), PurpleLamp);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"purple_lamp"), new BlockItem(PurpleLamp, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"blue_lamp"), BlueLamp);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"blue_lamp"), new BlockItem(BlueLamp, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"brown_lamp"), BrownLamp);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"brown_lamp"), new BlockItem(BrownLamp, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"green_lamp"), GreenLamp);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"green_lamp"), new BlockItem(GreenLamp, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"red_lamp"), RedLamp);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"red_lamp"), new BlockItem(RedLamp, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"black_lamp"), BlackLamp);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"black_lamp"), new BlockItem(BlackLamp, new Item.Settings().group(DecorativeMain.IndoorGroup)));
|
||||
registerFurniture(id("white_lamp"), WhiteLamp);
|
||||
registerFurniture(id("orange_lamp"), OrangeLamp);
|
||||
registerFurniture(id("magenta_lamp"), MagentaLamp);
|
||||
registerFurniture(id("light_blue_lamp"), LightBlueLamp);
|
||||
registerFurniture(id("yellow_lamp"), YellowLamp);
|
||||
registerFurniture(id("lime_lamp"), LimeLamp);
|
||||
registerFurniture(id("pink_lamp"), PinkLamp);
|
||||
registerFurniture(id("gray_lamp"), GrayLamp);
|
||||
registerFurniture(id("light_gray_lamp"), LightGrayLamp);
|
||||
registerFurniture(id("cyan_lamp"), CyanLamp);
|
||||
registerFurniture(id("purple_lamp"), PurpleLamp);
|
||||
registerFurniture(id("blue_lamp"), BlueLamp);
|
||||
registerFurniture(id("brown_lamp"), BrownLamp);
|
||||
registerFurniture(id("green_lamp"), GreenLamp);
|
||||
registerFurniture(id("red_lamp"), RedLamp);
|
||||
registerFurniture(id("black_lamp"), BlackLamp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package eu.midnightdust.motschen.decorative.init;
|
||||
|
||||
import eu.midnightdust.motschen.decorative.DecorativeMain;
|
||||
import eu.midnightdust.motschen.decorative.block.*;
|
||||
import eu.midnightdust.motschen.decorative.block.ChoppingLog;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
import static eu.midnightdust.motschen.decorative.DecorativeMain.id;
|
||||
import static eu.midnightdust.motschen.decorative.util.RegistryUtil.registerGarden;
|
||||
|
||||
public class LogsWithAxes {
|
||||
public static Block OakChoppingLog = new ChoppingLog();
|
||||
@@ -17,17 +15,11 @@ public class LogsWithAxes {
|
||||
public static Block DarkOakChoppingLog = new ChoppingLog();
|
||||
|
||||
public static void init() {
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"oak_log_with_axe"), OakChoppingLog);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"oak_log_with_axe"), new BlockItem(OakChoppingLog, new Item.Settings().group(DecorativeMain.GardenGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"spruce_log_with_axe"), SpruceChoppingLog);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"spruce_log_with_axe"), new BlockItem(SpruceChoppingLog, new Item.Settings().group(DecorativeMain.GardenGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"birch_log_with_axe"), BirchChoppingLog);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"birch_log_with_axe"), new BlockItem(BirchChoppingLog, new Item.Settings().group(DecorativeMain.GardenGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"acacia_log_with_axe"), AcaciaChoppingLog);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"acacia_log_with_axe"), new BlockItem(AcaciaChoppingLog, new Item.Settings().group(DecorativeMain.GardenGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"jungle_log_with_axe"), JungleChoppingLog);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"jungle_log_with_axe"), new BlockItem(JungleChoppingLog, new Item.Settings().group(DecorativeMain.GardenGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"dark_oak_log_with_axe"), DarkOakChoppingLog);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"dark_oak_log_with_axe"), new BlockItem(DarkOakChoppingLog, new Item.Settings().group(DecorativeMain.GardenGroup)));
|
||||
registerGarden(id("oak_log_with_axe"), OakChoppingLog);
|
||||
registerGarden(id("spruce_log_with_axe"), SpruceChoppingLog);
|
||||
registerGarden(id("birch_log_with_axe"), BirchChoppingLog);
|
||||
registerGarden(id("acacia_log_with_axe"), AcaciaChoppingLog);
|
||||
registerGarden(id("jungle_log_with_axe"), JungleChoppingLog);
|
||||
registerGarden(id("dark_oak_log_with_axe"), DarkOakChoppingLog);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,42 +1,44 @@
|
||||
package eu.midnightdust.motschen.decorative.init;
|
||||
|
||||
import eu.midnightdust.motschen.decorative.DecorativeMain;
|
||||
import eu.midnightdust.motschen.decorative.block.PoolSprinkler;
|
||||
import eu.midnightdust.motschen.decorative.block.PoolWall;
|
||||
import eu.midnightdust.motschen.decorative.block.Springboard;
|
||||
import eu.midnightdust.motschen.decorative.entity.BeachBallEntity;
|
||||
import eu.midnightdust.motschen.decorative.item.BathTireItem;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.EntityDimensions;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.SpawnGroup;
|
||||
import net.minecraft.entity.attribute.EntityAttributes;
|
||||
import net.minecraft.entity.mob.MobEntity;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
import static eu.midnightdust.motschen.decorative.DecorativeMain.PoolGroup;
|
||||
import static eu.midnightdust.motschen.decorative.DecorativeMain.id;
|
||||
import static eu.midnightdust.motschen.decorative.util.RegistryUtil.registerItem;
|
||||
import static eu.midnightdust.motschen.decorative.util.RegistryUtil.registerPool;
|
||||
|
||||
public class Pool {
|
||||
|
||||
public static final EntityType<BeachBallEntity> BEACH_BALL =
|
||||
Registry.register(Registry.ENTITY_TYPE,new Identifier(DecorativeMain.MOD_ID,"beach_ball"), FabricEntityTypeBuilder.create(SpawnGroup.AMBIENT, BeachBallEntity::new).dimensions(EntityDimensions.fixed(0.9f,0.9f)).trackable(100,4).build());
|
||||
public static Item BEACH_BALL_ITEM = new BathTireItem(BEACH_BALL, new Item.Settings().group(DecorativeMain.PoolGroup));
|
||||
public static final EntityType<BeachBallEntity> BEACH_BALL = registerBeachBall(id("beach_ball"));
|
||||
public static final Item BEACH_BALL_ITEM = new BathTireItem(BEACH_BALL, new Item.Settings());
|
||||
public static Block PoolWall = new PoolWall();
|
||||
public static Block Springboard = new Springboard();
|
||||
public static Block PoolSprinkler = new PoolSprinkler();
|
||||
|
||||
public static void init() {
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"pool_wall"), PoolWall);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"pool_wall"), new BlockItem(PoolWall, new Item.Settings().group(DecorativeMain.PoolGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"springboard"), Springboard);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"springboard"), new BlockItem(Springboard, new Item.Settings().group(DecorativeMain.PoolGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"pool_sprinkler"), PoolSprinkler);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"pool_sprinkler"), new BlockItem(PoolSprinkler, new Item.Settings().group(DecorativeMain.PoolGroup)));
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"beach_ball"), BEACH_BALL_ITEM);
|
||||
FabricDefaultAttributeRegistry.register(BEACH_BALL, MobEntity.createMobAttributes().add(EntityAttributes.GENERIC_MAX_HEALTH, 100000.0D).add(EntityAttributes.GENERIC_KNOCKBACK_RESISTANCE, -10D));
|
||||
registerPool(id("pool_wall"), PoolWall);
|
||||
registerPool(id("springboard"), Springboard);
|
||||
registerPool(id("pool_sprinkler"), PoolSprinkler);
|
||||
registerItem(id("beach_ball"), BEACH_BALL_ITEM, PoolGroup);
|
||||
BathTires.init();
|
||||
}
|
||||
private static EntityType<BeachBallEntity> registerBeachBall(Identifier id) {
|
||||
EntityType<BeachBallEntity> entity = Registry.register(Registries.ENTITY_TYPE, id, EntityType.Builder.create(BeachBallEntity::new, SpawnGroup.AMBIENT).dimensions(0.9f,0.9f).maxTrackingRange(100).trackingTickInterval(4).build());
|
||||
FabricDefaultAttributeRegistry.register(entity, MobEntity.createMobAttributes().add(EntityAttributes.GENERIC_MAX_HEALTH, 100000.0D).add(EntityAttributes.GENERIC_KNOCKBACK_RESISTANCE, -10D));
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package eu.midnightdust.motschen.decorative.init;
|
||||
|
||||
import eu.midnightdust.motschen.decorative.DecorativeMain;
|
||||
import eu.midnightdust.motschen.decorative.block.Sign;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
import static eu.midnightdust.motschen.decorative.DecorativeMain.id;
|
||||
import static eu.midnightdust.motschen.decorative.util.RegistryUtil.registerTraffic;
|
||||
|
||||
public class Signs {
|
||||
public static Block EmptySign = new Sign();
|
||||
@@ -25,34 +23,20 @@ public class Signs {
|
||||
public static Block OnehundredtenSign = new Sign();
|
||||
|
||||
public static void init() {
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"empty_sign"), EmptySign);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"empty_sign"), new BlockItem(EmptySign, new Item.Settings().group(DecorativeMain.TrafficGroup)));
|
||||
registerTraffic(id("empty_sign"), EmptySign);
|
||||
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"stop_sign"), StopSign);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"stop_sign"), new BlockItem(StopSign, new Item.Settings().group(DecorativeMain.TrafficGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"five_sign"), FiveSign);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"five_sign"), new BlockItem(FiveSign, new Item.Settings().group(DecorativeMain.TrafficGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"ten_sign"), TenSign);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"ten_sign"), new BlockItem(TenSign, new Item.Settings().group(DecorativeMain.TrafficGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"twenty_sign"), TwentySign);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"twenty_sign"), new BlockItem(TwentySign, new Item.Settings().group(DecorativeMain.TrafficGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"thirty_sign"), ThirtySign);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"thirty_sign"), new BlockItem(ThirtySign, new Item.Settings().group(DecorativeMain.TrafficGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"forty_sign"), FortySign);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"forty_sign"), new BlockItem(FortySign, new Item.Settings().group(DecorativeMain.TrafficGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"fifty_sign"), FiftySign);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"fifty_sign"), new BlockItem(FiftySign, new Item.Settings().group(DecorativeMain.TrafficGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"sixty_sign"), SixtySign);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"sixty_sign"), new BlockItem(SixtySign, new Item.Settings().group(DecorativeMain.TrafficGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"seventy_sign"), SeventySign);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"seventy_sign"), new BlockItem(SeventySign, new Item.Settings().group(DecorativeMain.TrafficGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"eighty_sign"), EightySign);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"eighty_sign"), new BlockItem(EightySign, new Item.Settings().group(DecorativeMain.TrafficGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"ninety_sign"), NinetySign);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"ninety_sign"), new BlockItem(NinetySign, new Item.Settings().group(DecorativeMain.TrafficGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"onehundred_sign"), OnehundredSign);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"onehundred_sign"), new BlockItem(OnehundredSign, new Item.Settings().group(DecorativeMain.TrafficGroup)));
|
||||
Registry.register(Registry.BLOCK, new Identifier(DecorativeMain.MOD_ID,"onehundredten_sign"), OnehundredtenSign);
|
||||
Registry.register(Registry.ITEM, new Identifier(DecorativeMain.MOD_ID,"onehundredten_sign"), new BlockItem(OnehundredtenSign, new Item.Settings().group(DecorativeMain.TrafficGroup)));
|
||||
registerTraffic(id("stop_sign"), StopSign);
|
||||
registerTraffic(id("five_sign"), FiveSign);
|
||||
registerTraffic(id("ten_sign"), TenSign);
|
||||
registerTraffic(id("twenty_sign"), TwentySign);
|
||||
registerTraffic(id("thirty_sign"), ThirtySign);
|
||||
registerTraffic(id("forty_sign"), FortySign);
|
||||
registerTraffic(id("fifty_sign"), FiftySign);
|
||||
registerTraffic(id("sixty_sign"), SixtySign);
|
||||
registerTraffic(id("seventy_sign"), SeventySign);
|
||||
registerTraffic(id("eighty_sign"), EightySign);
|
||||
registerTraffic(id("ninety_sign"), NinetySign);
|
||||
registerTraffic(id("onehundred_sign"), OnehundredSign);
|
||||
registerTraffic(id("onehundredten_sign"), OnehundredtenSign);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
package eu.midnightdust.motschen.decorative.item;
|
||||
|
||||
import eu.pb4.factorytools.api.item.AutoModeledPolymerItem;
|
||||
import net.minecraft.block.FluidBlock;
|
||||
import net.minecraft.component.DataComponentTypes;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.SpawnReason;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.SpawnEggItem;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.stat.Stats;
|
||||
@@ -18,7 +20,7 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.RaycastContext;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BathTireItem extends Item {
|
||||
public class BathTireItem extends Item implements AutoModeledPolymerItem {
|
||||
private final EntityType<?> type;
|
||||
|
||||
public BathTireItem(EntityType<?> type, Item.Settings settings) {
|
||||
@@ -28,18 +30,17 @@ public class BathTireItem extends Item {
|
||||
|
||||
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
|
||||
ItemStack itemStack = user.getStackInHand(hand);
|
||||
HitResult hitResult = raycast(world, user, RaycastContext.FluidHandling.SOURCE_ONLY);
|
||||
BlockHitResult hitResult = raycast(world, user, RaycastContext.FluidHandling.SOURCE_ONLY);
|
||||
if (hitResult.getType() != HitResult.Type.BLOCK) {
|
||||
return TypedActionResult.pass(itemStack);
|
||||
} else if (world.isClient) {
|
||||
return TypedActionResult.success(itemStack);
|
||||
} else {
|
||||
BlockHitResult blockHitResult = (BlockHitResult)hitResult;
|
||||
BlockPos blockPos = blockHitResult.getBlockPos();
|
||||
BlockPos blockPos = hitResult.getBlockPos();
|
||||
if (!(world.getBlockState(blockPos).getBlock() instanceof FluidBlock)) {
|
||||
return TypedActionResult.pass(itemStack);
|
||||
} else if (world.canPlayerModifyAt(user, blockPos) && user.canPlaceOn(blockPos, blockHitResult.getSide(), itemStack)) {
|
||||
EntityType<?> entityType = this.getEntityType(itemStack.getNbt());
|
||||
} else if (world.canPlayerModifyAt(user, blockPos) && user.canPlaceOn(blockPos, hitResult.getSide(), itemStack)) {
|
||||
EntityType<?> entityType = this.getEntityType(itemStack.getComponents().get(DataComponentTypes.ENTITY_DATA).copyNbt());
|
||||
if (entityType.spawnFromItemStack((ServerWorld) world, itemStack, user, blockPos.up(1), SpawnReason.SPAWN_EGG, false, false) == null) {
|
||||
return TypedActionResult.pass(itemStack);
|
||||
} else {
|
||||
@@ -66,4 +67,9 @@ public class BathTireItem extends Item {
|
||||
|
||||
return this.type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getPolymerItem() {
|
||||
return Items.DRIED_KELP;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
package eu.midnightdust.motschen.decorative.sound;
|
||||
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.sound.SoundEvent;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
import static eu.midnightdust.motschen.decorative.DecorativeMain.id;
|
||||
|
||||
public class DecorativeSoundEvents {
|
||||
public static final SoundEvent CEILINGFAN_AMBIENT = register("decorative:ceiling_fan.ambient");
|
||||
public static final SoundEvent CEILINGFAN_AMBIENT = register(id("ceiling_fan.ambient"));
|
||||
|
||||
private static SoundEvent register(String id) {
|
||||
return Registry.register(Registry.SOUND_EVENT, id, new SoundEvent(new Identifier(id)));
|
||||
private static SoundEvent register(Identifier id) {
|
||||
return Registry.register(Registries.SOUND_EVENT, id, SoundEvent.of(id));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package eu.midnightdust.motschen.decorative.util;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
public record ItemEntry(Text groupName, ItemStack stack) {}
|
||||
@@ -0,0 +1,65 @@
|
||||
package eu.midnightdust.motschen.decorative.util;
|
||||
|
||||
import eu.midnightdust.motschen.decorative.DecorativeMain;
|
||||
import eu.midnightdust.motschen.decorative.config.DecorativeConfig;
|
||||
import eu.pb4.factorytools.api.item.FactoryBlockItem;
|
||||
import eu.pb4.polymer.core.api.block.PolymerBlock;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.registry.Registerable;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.registry.RegistryKey;
|
||||
import net.minecraft.registry.RegistryKeys;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.world.gen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.gen.feature.PlacedFeature;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static eu.midnightdust.motschen.decorative.DecorativeMain.MOD_ID;
|
||||
|
||||
public class RegistryUtil {
|
||||
public static List<ItemEntry> groupItems = new ArrayList<>();
|
||||
|
||||
public static void registerFurniture(Identifier id, Block block) {
|
||||
registerBlockWithItem(id, block, DecorativeMain.IndoorGroup);
|
||||
}
|
||||
public static void registerGarden(Identifier id, Block block) {
|
||||
registerBlockWithItem(id, block, DecorativeMain.GardenGroup);
|
||||
}
|
||||
public static void registerTraffic(Identifier id, Block block) {
|
||||
registerBlockWithItem(id, block, DecorativeMain.TrafficGroup);
|
||||
}
|
||||
public static void registerPool(Identifier id, Block block) {
|
||||
registerBlockWithItem(id, block, DecorativeMain.PoolGroup);
|
||||
}
|
||||
|
||||
public static void registerBlockWithItem(Identifier id, Block block, ItemGroup group) {
|
||||
Registry.register(Registries.BLOCK, id, block);
|
||||
registerItem(id, blockItem(block), group);
|
||||
}
|
||||
|
||||
public static Item blockItem(Block block) {
|
||||
if (DecorativeConfig.polymerIntegration) return new FactoryBlockItem((Block & PolymerBlock) block, new Item.Settings());
|
||||
return new BlockItem(block, new Item.Settings());
|
||||
}
|
||||
|
||||
public static void registerItem(Identifier id, Item item, ItemGroup group) {
|
||||
Registry.register(Registries.ITEM, id, item);
|
||||
ItemStack stack = new ItemStack(item);
|
||||
groupItems.add(new ItemEntry(group.getDisplayName(), stack));
|
||||
}
|
||||
|
||||
public static void register(Registerable<ConfiguredFeature<?, ?>> context, String name, ConfiguredFeature<?, ?> feature) {
|
||||
context.register(RegistryKey.of(RegistryKeys.CONFIGURED_FEATURE, Identifier.of(MOD_ID, name)), feature);
|
||||
}
|
||||
|
||||
public static void register(Registerable<PlacedFeature> context, String name, PlacedFeature feature) {
|
||||
context.register(RegistryKey.of(RegistryKeys.PLACED_FEATURE, Identifier.of(MOD_ID, name)), feature);
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,7 @@ package eu.midnightdust.motschen.decorative.world;
|
||||
|
||||
import eu.midnightdust.motschen.decorative.DecorativeMain;
|
||||
import net.fabricmc.fabric.api.biome.v1.BiomeModifications;
|
||||
import net.minecraft.tag.BiomeTags;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.BuiltinRegistries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.RegistryEntry;
|
||||
import net.minecraft.world.gen.GenerationStep;
|
||||
import net.minecraft.world.gen.YOffset;
|
||||
import net.minecraft.world.gen.feature.*;
|
||||
@@ -17,20 +13,20 @@ import net.minecraft.world.gen.placementmodifier.SquarePlacementModifier;
|
||||
import java.util.List;
|
||||
|
||||
public class OreFeatures {
|
||||
private static final ConfiguredFeature<?, ?> ROCKY_ASPHALT_FEATURE = new ConfiguredFeature<>(Feature.ORE, new OreFeatureConfig(
|
||||
OreConfiguredFeatures.STONE_ORE_REPLACEABLES, DecorativeMain.RockyAsphalt.getDefaultState(),10));
|
||||
public static PlacedFeature ROCKY_ASPHALT_PLACED_FEATURE = new PlacedFeature(
|
||||
RegistryEntry.of(ROCKY_ASPHALT_FEATURE),
|
||||
List.of(
|
||||
CountPlacementModifier.of(40),
|
||||
SquarePlacementModifier.of(),
|
||||
HeightRangePlacementModifier.uniform(YOffset.BOTTOM, YOffset.TOP)
|
||||
));
|
||||
// private static final ConfiguredFeature<?, ?> ROCKY_ASPHALT_FEATURE = new ConfiguredFeature<>(Feature.ORE, new OreFeatureConfig(
|
||||
// OreConfiguredFeatures.STONE_ORE_REPLACEABLES, DecorativeMain.RockyAsphalt.getDefaultState(),10));
|
||||
// public static PlacedFeature ROCKY_ASPHALT_PLACED_FEATURE = new PlacedFeature(
|
||||
// RegistryEntry.of(ROCKY_ASPHALT_FEATURE),
|
||||
// List.of(
|
||||
// CountPlacementModifier.of(40),
|
||||
// SquarePlacementModifier.of(),
|
||||
// HeightRangePlacementModifier.uniform(YOffset.BOTTOM, YOffset.TOP)
|
||||
// ));
|
||||
|
||||
public static void init() {
|
||||
Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, new Identifier(DecorativeMain.MOD_ID, "rocky_asphalt"), ROCKY_ASPHALT_FEATURE);
|
||||
Registry.register(BuiltinRegistries.PLACED_FEATURE, new Identifier(DecorativeMain.MOD_ID, "placed_rocky_asphalt"), ROCKY_ASPHALT_PLACED_FEATURE);
|
||||
BiomeModifications.addFeature(biome -> (!biome.hasTag(BiomeTags.IS_NETHER) && !biome.hasTag(BiomeTags.END_CITY_HAS_STRUCTURE)),
|
||||
GenerationStep.Feature.UNDERGROUND_ORES, BuiltinRegistries.PLACED_FEATURE.getKey(OreFeatures.ROCKY_ASPHALT_PLACED_FEATURE).get());
|
||||
// Registry.register(BuiltinRegistries.CONFIGURED_FEATURE, new Identifier(DecorativeMain.MOD_ID, "rocky_asphalt"), ROCKY_ASPHALT_FEATURE);
|
||||
// Registry.register(BuiltinRegistries.PLACED_FEATURE, new Identifier(DecorativeMain.MOD_ID, "placed_rocky_asphalt"), ROCKY_ASPHALT_PLACED_FEATURE);
|
||||
// BiomeModifications.addFeature(biome -> (!biome.hasTag(BiomeTags.IS_NETHER) && !biome.hasTag(BiomeTags.END_CITY_HAS_STRUCTURE)),
|
||||
// GenerationStep.Feature.UNDERGROUND_ORES, BuiltinRegistries.PLACED_FEATURE.getKey(OreFeatures.ROCKY_ASPHALT_PLACED_FEATURE).get());
|
||||
}
|
||||
}
|
||||
|
||||
1
src/main/resources/assets/decorative/optifine/emissive.properties
Executable file
@@ -0,0 +1 @@
|
||||
suffix.emissive=_e
|
||||
|
Before Width: | Height: | Size: 139 B |
|
Before Width: | Height: | Size: 154 B |
BIN
src/main/resources/assets/decorative/textures/block/green_lamp_e.png
Executable file
|
After Width: | Height: | Size: 297 B |
BIN
src/main/resources/assets/decorative/textures/block/red_lamp_e.png
Executable file
|
After Width: | Height: | Size: 297 B |
|
Before Width: | Height: | Size: 360 B After Width: | Height: | Size: 5.1 KiB |
BIN
src/main/resources/assets/decorative/textures/tv/crabrave_e.png
Executable file
|
After Width: | Height: | Size: 1.3 MiB |
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"animation": {
|
||||
"frametime": 3
|
||||
"frametime": 2
|
||||
}
|
||||
}
|
||||
BIN
src/main/resources/assets/decorative/textures/tv/creeper_e.png
Executable file
|
After Width: | Height: | Size: 45 KiB |
5
src/main/resources/assets/decorative/textures/tv/creeper_e.png.mcmeta
Executable file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"animation": {
|
||||
"frametime": 1
|
||||
}
|
||||
}
|
||||
BIN
src/main/resources/assets/decorative/textures/tv/nyancat_e.png
Executable file
|
After Width: | Height: | Size: 290 KiB |
5
src/main/resources/assets/decorative/textures/tv/nyancat_e.png.mcmeta
Executable file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"animation": {
|
||||
"frametime": 1
|
||||
}
|
||||
}
|
||||
BIN
src/main/resources/assets/decorative/textures/tv/tater_e.png
Executable file
|
After Width: | Height: | Size: 628 KiB |
5
src/main/resources/assets/decorative/textures/tv/tater_e.png.mcmeta
Executable file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"animation": {
|
||||
"frametime": 1
|
||||
}
|
||||
}
|
||||