diff --git a/src/main/java/com/minecolonies/api/blocks/AbstractBlockBarrel.java b/src/main/java/com/minecolonies/api/blocks/AbstractBlockBarrel.java index 299ac56348f..f303421169a 100755 --- a/src/main/java/com/minecolonies/api/blocks/AbstractBlockBarrel.java +++ b/src/main/java/com/minecolonies/api/blocks/AbstractBlockBarrel.java @@ -9,7 +9,7 @@ import net.minecraft.world.level.block.state.properties.EnumProperty; import org.jetbrains.annotations.NotNull; -public abstract class AbstractBlockBarrel> extends AbstractBlockMinecoloniesHorizontal implements ITickableBlockMinecolonies +public abstract class AbstractBlockBarrel> extends HorizontalDirectionalBlock implements ITickableBlockMinecolonies { public static final EnumProperty VARIANT = EnumProperty.create("variant", BarrelType.class); diff --git a/src/main/java/com/minecolonies/api/blocks/AbstractBlockHut.java b/src/main/java/com/minecolonies/api/blocks/AbstractBlockHut.java index 25195b29b98..2d074f80186 100755 --- a/src/main/java/com/minecolonies/api/blocks/AbstractBlockHut.java +++ b/src/main/java/com/minecolonies/api/blocks/AbstractBlockHut.java @@ -16,19 +16,17 @@ import com.minecolonies.api.colony.buildings.views.IBuildingView; import com.minecolonies.api.colony.permissions.Action; import com.minecolonies.api.entity.ai.workers.util.IBuilderUndestroyable; -import com.minecolonies.api.items.ItemBlockHut; import com.minecolonies.api.tileentities.AbstractTileEntityColonyBuilding; import com.minecolonies.api.tileentities.MinecoloniesTileEntities; import com.minecolonies.core.tileentities.TileEntityColonyBuilding; import com.minecolonies.api.util.*; -import com.minecolonies.api.util.constant.Constants; import com.minecolonies.api.util.constant.TranslationConstants; import net.minecraft.ChatFormatting; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.player.LocalPlayer; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.core.Registry; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; @@ -36,11 +34,9 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; @@ -79,7 +75,7 @@ * All AbstractBlockHut[something] should extend this class. */ @SuppressWarnings("PMD.ExcessiveImports") -public abstract class AbstractBlockHut> extends AbstractBlockMinecolonies implements IBuilderUndestroyable, +public abstract class AbstractBlockHut> extends Block implements IBuilderUndestroyable, IAnchorBlock, ITickableBlockMinecolonies, INamedBlueprintAnchorBlock, @@ -115,11 +111,6 @@ public abstract class AbstractBlockHut> extends Ab */ private static final VoxelShape SHAPE = Shapes.box(0.1, 0.1, 0.1, 0.9, 0.9, 0.9); - /** - * The hut's lower-case building-registry-compatible name. - */ - private final String name; - /** * The timepoint of the last chat warning message */ @@ -134,7 +125,6 @@ public AbstractBlockHut() { super(Properties.of().mapColor(MapColor.WOOD).sound(SoundType.WOOD).strength(HARDNESS, RESISTANCE).noOcclusion()); this.registerDefaultState(this.defaultBlockState().setValue(FACING, Direction.NORTH)); - this.name = getHutName(); } @Override @@ -161,16 +151,8 @@ public AbstractBlockHut(final Properties properties) { super(properties.noOcclusion()); this.registerDefaultState(this.defaultBlockState().setValue(FACING, Direction.NORTH)); - this.name = getHutName(); } - /** - * Method to return the name of the block. - * - * @return Name of the block. - */ - public abstract String getHutName(); - @Nullable @Override public BlockEntity newBlockEntity(@NotNull final BlockPos blockPos, @NotNull final BlockState blockState) @@ -341,22 +323,6 @@ public void onBlockPlacedByBuildTool( setPlacedBy(worldIn, pos, state, placer, stack); } - /** - * Get the registry name frm the blck hut. - * @return the key. - */ - public ResourceLocation getRegistryName() - { - return new ResourceLocation(Constants.MOD_ID, getHutName()); - } - - @Override - public B registerBlock(final Registry registry) - { - Registry.register(registry, getRegistryName(), this); - return (B) this; - } - @Override public boolean isVisible(@Nullable final CompoundTag beData) { @@ -378,7 +344,7 @@ public List getRequirements(final ClientLevel level, final Blo if (InventoryUtils.findFirstSlotInItemHandlerWith(new InvWrapper(player.getInventory()), this) == -1) { - requirements.add(Component.translatableEscape("com.minecolonies.coremod.hut.cost", Component.translatableEscape("block." + Constants.MOD_ID + "." + getHutName())).setStyle((Style.EMPTY).withColor(ChatFormatting.RED))); + requirements.add(Component.translatableEscape("com.minecolonies.coremod.hut.cost", Component.translatableEscape(getDescriptionId())).setStyle((Style.EMPTY).withColor(ChatFormatting.RED))); return requirements; } @@ -437,7 +403,7 @@ public int getLevel(final CompoundTag beData) } catch (final NumberFormatException exception) { - Log.getLogger().error("Couldn't get level from hut: " + getHutName() + ". Potential corrubt blockEntity data."); + Log.getLogger().error("Couldn't get level from hut: " + BuiltInRegistries.BLOCK.getKey(this) + ". Potential corrubt blockEntity data."); return 0; } } @@ -488,7 +454,7 @@ public boolean setup( @Nullable final IBuilding building = IColonyManager.getInstance().getBuilding(world, pos); if (building == null) { - if (anchor.getBlock() != ModBlocks.blockHutTownHall) + if (anchor.getBlock() != ModBlocks.blockHutTownHall.get()) { SoundUtils.playErrorSound(player, player.blockPosition()); Log.getLogger().error("BuildTool: building is null!", new Exception()); @@ -545,7 +511,7 @@ private boolean canPaste(final Block anchor, final Player player, final BlockPos if (colony == null) { - if(anchor == ModBlocks.blockHutTownHall) + if(anchor == ModBlocks.blockHutTownHall.get()) { return true; } @@ -582,10 +548,4 @@ public String getBlueprintName() { return getBuildingEntry().getRegistryName().getPath(); } - - @Override - public void registerBlockItem(final Registry registry, final Item.Properties properties) - { - Registry.register(registry, getRegistryName(), new ItemBlockHut(this, properties)); - } } diff --git a/src/main/java/com/minecolonies/api/blocks/AbstractBlockMinecolonies.java b/src/main/java/com/minecolonies/api/blocks/AbstractBlockMinecolonies.java deleted file mode 100755 index b23d32db3b3..00000000000 --- a/src/main/java/com/minecolonies/api/blocks/AbstractBlockMinecolonies.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.minecolonies.api.blocks; - -import com.minecolonies.api.blocks.interfaces.IBlockMinecolonies; -import net.minecraft.core.Registry; -import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.Item; -import net.minecraft.world.level.block.Block; - -public abstract class AbstractBlockMinecolonies> extends Block implements IBlockMinecolonies -{ - public AbstractBlockMinecolonies(final Properties properties) - { - super(properties); - } - - @Override - public void registerBlockItem(final Registry registry, final Item.Properties properties) - { - Registry.register(registry, getRegistryName(), new BlockItem(this, properties)); - } - - @Override - public B registerBlock(final Registry registry) - { - Registry.register(registry, getRegistryName(), this); - return (B) this; - } -} diff --git a/src/main/java/com/minecolonies/api/blocks/AbstractBlockMinecoloniesContainer.java b/src/main/java/com/minecolonies/api/blocks/AbstractBlockMinecoloniesContainer.java deleted file mode 100755 index 5b45f646dfa..00000000000 --- a/src/main/java/com/minecolonies/api/blocks/AbstractBlockMinecoloniesContainer.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.minecolonies.api.blocks; - -public abstract class AbstractBlockMinecoloniesContainer> extends AbstractBlockMinecolonies -{ - public AbstractBlockMinecoloniesContainer(final Properties properties) - { - super(properties); - } -} diff --git a/src/main/java/com/minecolonies/api/blocks/AbstractBlockMinecoloniesDirectional.java b/src/main/java/com/minecolonies/api/blocks/AbstractBlockMinecoloniesDirectional.java deleted file mode 100755 index deb7f5f1932..00000000000 --- a/src/main/java/com/minecolonies/api/blocks/AbstractBlockMinecoloniesDirectional.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.minecolonies.api.blocks; - -import com.minecolonies.api.blocks.interfaces.IBlockMinecolonies; -import net.minecraft.core.Registry; -import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.Item; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.DirectionalBlock; - -public abstract class AbstractBlockMinecoloniesDirectional> extends DirectionalBlock implements IBlockMinecolonies -{ - public AbstractBlockMinecoloniesDirectional(final Properties properties) - { - super(properties); - } - - @Override - public void registerBlockItem(final Registry registry, final Item.Properties properties) - { - Registry.register(registry, getRegistryName(), new BlockItem(this, properties)); - } - - @Override - public B registerBlock(final Registry registry) - { - Registry.register(registry, getRegistryName(), this); - return (B) this; - } -} diff --git a/src/main/java/com/minecolonies/api/blocks/AbstractBlockMinecoloniesFalling.java b/src/main/java/com/minecolonies/api/blocks/AbstractBlockMinecoloniesFalling.java deleted file mode 100755 index 5d1c039d5a6..00000000000 --- a/src/main/java/com/minecolonies/api/blocks/AbstractBlockMinecoloniesFalling.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.minecolonies.api.blocks; - -import com.minecolonies.api.blocks.interfaces.IBlockMinecolonies; -import net.minecraft.core.Registry; -import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.Item; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.FallingBlock; - -public abstract class AbstractBlockMinecoloniesFalling> extends FallingBlock implements IBlockMinecolonies -{ - public AbstractBlockMinecoloniesFalling(final Properties properties) - { - super(properties); - } - - @Override - public void registerBlockItem(final Registry registry, final Item.Properties properties) - { - Registry.register(registry, getRegistryName(), new BlockItem(this, properties)); - } - - @Override - public B registerBlock(final Registry registry) - { - Registry.register(registry, getRegistryName(), this); - return (B) this; - } -} diff --git a/src/main/java/com/minecolonies/api/blocks/AbstractBlockMinecoloniesGrave.java b/src/main/java/com/minecolonies/api/blocks/AbstractBlockMinecoloniesGrave.java index 18de522fa07..91105a5e648 100644 --- a/src/main/java/com/minecolonies/api/blocks/AbstractBlockMinecoloniesGrave.java +++ b/src/main/java/com/minecolonies/api/blocks/AbstractBlockMinecoloniesGrave.java @@ -1,12 +1,13 @@ package com.minecolonies.api.blocks; import com.minecolonies.api.blocks.types.GraveType; +import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.EntityBlock; import net.minecraft.world.level.block.HorizontalDirectionalBlock; import net.minecraft.world.level.block.state.properties.DirectionProperty; import net.minecraft.world.level.block.state.properties.EnumProperty; -public abstract class AbstractBlockMinecoloniesGrave> extends AbstractBlockMinecolonies implements EntityBlock +public abstract class AbstractBlockMinecoloniesGrave> extends Block implements EntityBlock { public static final EnumProperty VARIANT = EnumProperty.create("variant", GraveType.class); diff --git a/src/main/java/com/minecolonies/api/blocks/AbstractBlockMinecoloniesHorizontal.java b/src/main/java/com/minecolonies/api/blocks/AbstractBlockMinecoloniesHorizontal.java deleted file mode 100755 index c04fcbe3ff1..00000000000 --- a/src/main/java/com/minecolonies/api/blocks/AbstractBlockMinecoloniesHorizontal.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.minecolonies.api.blocks; - -import com.minecolonies.api.blocks.interfaces.IBlockMinecolonies; -import net.minecraft.core.Registry; -import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.Item; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.HorizontalDirectionalBlock; - -public abstract class AbstractBlockMinecoloniesHorizontal> extends HorizontalDirectionalBlock implements IBlockMinecolonies -{ - public AbstractBlockMinecoloniesHorizontal(final Properties properties) - { - super(properties); - } - - @Override - public void registerBlockItem(final Registry registry, final Item.Properties properties) - { - Registry.register(registry, getRegistryName(), new BlockItem(this, properties)); - } - - @Override - public B registerBlock(final Registry registry) - { - Registry.register(registry, getRegistryName(), this); - return (B) this; - } -} diff --git a/src/main/java/com/minecolonies/api/blocks/AbstractBlockMinecoloniesNamedGrave.java b/src/main/java/com/minecolonies/api/blocks/AbstractBlockMinecoloniesNamedGrave.java index f92dacbe36a..4895376d2f3 100644 --- a/src/main/java/com/minecolonies/api/blocks/AbstractBlockMinecoloniesNamedGrave.java +++ b/src/main/java/com/minecolonies/api/blocks/AbstractBlockMinecoloniesNamedGrave.java @@ -1,5 +1,6 @@ package com.minecolonies.api.blocks; +import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.EntityBlock; import net.minecraft.world.level.block.HorizontalDirectionalBlock; import net.minecraft.world.level.block.state.properties.DirectionProperty; @@ -7,7 +8,7 @@ /** * Abstract class for minecolonies named graves. */ -public abstract class AbstractBlockMinecoloniesNamedGrave> extends AbstractBlockMinecolonies implements EntityBlock +public abstract class AbstractBlockMinecoloniesNamedGrave> extends Block implements EntityBlock { /** * The direction the block is facing. diff --git a/src/main/java/com/minecolonies/api/blocks/AbstractBlockMinecoloniesRack.java b/src/main/java/com/minecolonies/api/blocks/AbstractBlockMinecoloniesRack.java index db1f4acb967..03e9188e54a 100755 --- a/src/main/java/com/minecolonies/api/blocks/AbstractBlockMinecoloniesRack.java +++ b/src/main/java/com/minecolonies/api/blocks/AbstractBlockMinecoloniesRack.java @@ -8,7 +8,7 @@ import net.minecraft.world.level.block.state.properties.DirectionProperty; import net.minecraft.world.level.block.state.properties.EnumProperty; -public abstract class AbstractBlockMinecoloniesRack> extends AbstractBlockMinecolonies implements EntityBlock +public abstract class AbstractBlockMinecoloniesRack> extends Block implements EntityBlock { public static final EnumProperty VARIANT = EnumProperty.create("variant", RackType.class); diff --git a/src/main/java/com/minecolonies/api/blocks/ModBlocks.java b/src/main/java/com/minecolonies/api/blocks/ModBlocks.java index 387e486adc9..4d1a7f34004 100755 --- a/src/main/java/com/minecolonies/api/blocks/ModBlocks.java +++ b/src/main/java/com/minecolonies/api/blocks/ModBlocks.java @@ -1,12 +1,28 @@ package com.minecolonies.api.blocks; -import com.minecolonies.api.blocks.decorative.AbstractBlockGate; -import com.minecolonies.api.blocks.decorative.AbstractBlockMinecoloniesConstructionTape; -import com.minecolonies.api.blocks.decorative.AbstractColonyFlagBanner; -import com.minecolonies.api.blocks.huts.AbstractBlockMinecoloniesDefault; -import com.minecolonies.core.blocks.MinecoloniesCropBlock; -import com.minecolonies.core.blocks.MinecoloniesFarmland; +import com.minecolonies.api.colony.buildings.ModBuildings; +import com.minecolonies.api.items.ModItems; +import com.minecolonies.api.items.ModTags; +import com.minecolonies.api.util.constant.Constants; +import com.minecolonies.core.blocks.*; +import com.minecolonies.core.blocks.decorative.*; +import com.minecolonies.core.blocks.huts.*; +import com.minecolonies.core.blocks.schematic.BlockWaypoint; +import com.minecolonies.core.items.ItemCrop; +import com.minecolonies.core.items.ItemGate; +import net.minecraft.tags.TagKey; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.Item; +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.block.Block; +import net.neoforged.neoforge.registries.DeferredBlock; +import net.neoforged.neoforge.registries.DeferredRegister; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; +import java.util.function.BiFunction; +import java.util.function.Supplier; /** * Class to create the modBlocks. References to the blocks can be made here @@ -16,94 +32,101 @@ @SuppressWarnings({"squid:ClassVariableVisibilityCheck", "squid:S2444", "squid:S1444", "squid:S1820",}) public final class ModBlocks { + public static final DeferredRegister.Blocks REGISTRY = DeferredRegister.createBlocks(Constants.MOD_ID); + /* * Creating objects for all blocks in the mod. * References can be made to here. */ - public static AbstractBlockHut> blockHutTownHall; - public static AbstractBlockHut> blockHutHome; - public static AbstractBlockHut> blockHutMiner; - public static AbstractBlockHut> blockHutLumberjack; - public static AbstractBlockHut> blockHutBaker; - public static AbstractBlockHut> blockHutBuilder; - public static AbstractBlockHut> blockHutDeliveryman; - public static AbstractBlockHut> blockHutBlacksmith; - public static AbstractBlockHut> blockHutStonemason; - public static AbstractBlockHut> blockHutFarmer; - public static AbstractBlockHut> blockHutFisherman; - public static AbstractBlockHut> blockHutGuardTower; - public static AbstractBlockHut> blockHutWareHouse; - public static AbstractBlockHut> blockHutShepherd; - public static AbstractBlockHut> blockHutCowboy; - public static AbstractBlockHut> blockHutSwineHerder; - public static AbstractBlockHut> blockHutChickenHerder; - public static AbstractBlockHut> blockHutBarracks; - public static AbstractBlockHut> blockHutBarracksTower; - public static AbstractBlockHut> blockHutCook; - public static AbstractBlockHut> blockHutSmeltery; - public static AbstractBlockHut> blockHutComposter; - public static AbstractBlockHut> blockHutLibrary; - public static AbstractBlockHut> blockHutArchery; - public static AbstractBlockHut> blockHutCombatAcademy; - public static AbstractBlockHut> blockHutSawmill; - public static AbstractBlockHut> blockHutStoneSmeltery; - public static AbstractBlockHut> blockHutCrusher; - public static AbstractBlockHut> blockHutSifter; - public static AbstractBlockHut> blockPostBox; - public static AbstractBlockHut> blockHutFlorist; - public static AbstractBlockHut> blockHutEnchanter; - public static AbstractBlockHut> blockHutUniversity; - public static AbstractBlockHut> blockHutHospital; - public static AbstractBlockHut> blockStash; - public static AbstractBlockHut> blockHutSchool; - public static AbstractBlockHut> blockHutGlassblower; - public static AbstractBlockHut> blockHutDyer; - public static AbstractBlockHut> blockHutFletcher; - public static AbstractBlockHut> blockHutMechanic; - public static AbstractBlockHut> blockHutPlantation; - public static AbstractBlockHut> blockHutTavern; - public static AbstractBlockHut> blockHutRabbitHutch; - public static AbstractBlockHut> blockHutConcreteMixer; - public static AbstractBlockHut> blockHutBeekeeper; - public static AbstractBlockHut> blockHutMysticalSite; - public static AbstractBlockHut> blockHutGraveyard; - public static AbstractBlockHut> blockHutNetherWorker; - public static AbstractBlockHut> blockSimpleQuarry; - public static AbstractBlockHut> blockMediumQuarry; - //public static AbstractBlockHut> blockLargeQuarry; - public static AbstractBlockHut> blockHutAlchemist; - public static AbstractBlockHut> blockHutKitchen; + public static final DeferredBlock blockHutTownHall = simpleBlockItem("blockhuttownhall", BlockHutTownHall::new); + public static final DeferredBlock blockHutHome = simpleBlockItem("blockhutcitizen", BlockHutCitizen::new); + public static final DeferredBlock blockHutMiner = simpleBlockItem("blockhutminer", BlockHutMiner::new); + public static final DeferredBlock blockHutLumberjack = simpleBlockItem("blockhutlumberjack", BlockHutLumberjack::new); + public static final DeferredBlock blockHutBaker = simpleBlockItem("blockhutbaker", BlockHutBaker::new); + public static final DeferredBlock blockHutBuilder = simpleBlockItem("blockhutbuilder", BlockHutBuilder::new); + public static final DeferredBlock blockHutDeliveryman = simpleBlockItem("blockhutdeliveryman", BlockHutDeliveryman::new); + public static final DeferredBlock blockHutBlacksmith = simpleBlockItem("blockhutblacksmith", BlockHutBlacksmith::new); + public static final DeferredBlock blockHutStonemason = simpleBlockItem("blockhutstonemason", BlockHutStonemason::new); + public static final DeferredBlock blockHutFarmer = simpleBlockItem("blockhutfarmer", BlockHutFarmer::new); + public static final DeferredBlock blockHutFisherman = simpleBlockItem("blockhutfisherman", BlockHutFisherman::new); + public static final DeferredBlock blockHutGuardTower = simpleBlockItem("blockhutguardtower", BlockHutGuardTower::new); + public static final DeferredBlock blockHutWareHouse = simpleBlockItem("blockhutwarehouse", BlockHutWareHouse::new); + public static final DeferredBlock blockHutShepherd = simpleBlockItem("blockhutshepherd", BlockHutShepherd::new); + public static final DeferredBlock blockHutCowboy = simpleBlockItem("blockhutcowboy", BlockHutCowboy::new); + public static final DeferredBlock blockHutSwineHerder = simpleBlockItem("blockhutswineherder", BlockHutSwineHerder::new); + public static final DeferredBlock blockHutChickenHerder = simpleBlockItem("blockhutchickenherder", BlockHutChickenHerder::new); + public static final DeferredBlock blockHutBarracks = simpleBlockItem("blockhutbarracks", BlockHutBarracks::new); + public static final DeferredBlock blockHutBarracksTower = simpleBlockItem("blockhutbarrackstower", BlockHutBarracksTower::new); + public static final DeferredBlock blockHutCook = simpleBlockItem("blockhutcook", BlockHutCook::new); + public static final DeferredBlock blockHutSmeltery = simpleBlockItem("blockhutsmeltery", BlockHutSmeltery::new); + public static final DeferredBlock blockHutComposter = simpleBlockItem("blockhutcomposter", BlockHutComposter::new); + public static final DeferredBlock blockHutLibrary = simpleBlockItem("blockhutlibrary", BlockHutLibrary::new); + public static final DeferredBlock blockHutArchery = simpleBlockItem("blockhutarchery", BlockHutArchery::new); + public static final DeferredBlock blockHutCombatAcademy = simpleBlockItem("blockhutcombatacademy", BlockHutCombatAcademy::new); + public static final DeferredBlock blockHutSawmill = simpleBlockItem("blockhutsawmill", BlockHutSawmill::new); + public static final DeferredBlock blockHutStoneSmeltery = simpleBlockItem("blockhutstonesmeltery", BlockHutStoneSmeltery::new); + public static final DeferredBlock blockHutCrusher = simpleBlockItem("blockhutcrusher", BlockHutCrusher::new); + public static final DeferredBlock blockHutSifter = simpleBlockItem("blockhutsifter", BlockHutSifter::new); + public static final DeferredBlock blockPostBox = simpleBlockItem("blockpostbox", BlockPostBox::new); + public static final DeferredBlock blockHutFlorist = simpleBlockItem("blockhutflorist", BlockHutFlorist::new); + public static final DeferredBlock blockHutEnchanter = simpleBlockItem("blockhutenchanter", BlockHutEnchanter::new); + public static final DeferredBlock blockHutUniversity = simpleBlockItem("blockhutuniversity", BlockHutUniversity::new); + public static final DeferredBlock blockHutHospital = simpleBlockItem("blockhuthospital", BlockHutHospital::new); + public static final DeferredBlock blockStash = simpleBlockItem("blockstash", BlockStash::new); + public static final DeferredBlock blockHutSchool = simpleBlockItem("blockhutschool", BlockHutSchool::new); + public static final DeferredBlock blockHutGlassblower = simpleBlockItem("blockhutglassblower", BlockHutGlassblower::new); + public static final DeferredBlock blockHutDyer = simpleBlockItem("blockhutdyer", BlockHutDyer::new); + public static final DeferredBlock blockHutFletcher = simpleBlockItem("blockhutfletcher", BlockHutFletcher::new); + public static final DeferredBlock blockHutMechanic = simpleBlockItem("blockhutmechanic", BlockHutMechanic::new); + public static final DeferredBlock blockHutPlantation = simpleBlockItem("blockhutplantation", BlockHutPlantation::new); + public static final DeferredBlock blockHutTavern = simpleBlockItem("blockhuttavern", BlockHutTavern::new); + public static final DeferredBlock blockHutRabbitHutch = simpleBlockItem("blockhutrabbithutch", BlockHutRabbitHutch::new); + public static final DeferredBlock blockHutConcreteMixer = simpleBlockItem("blockhutconcretemixer", BlockHutConcreteMixer::new); + public static final DeferredBlock blockHutBeekeeper = simpleBlockItem("blockhutbeekeeper", BlockHutBeekeeper::new); + public static final DeferredBlock blockHutMysticalSite = simpleBlockItem("blockhutmysticalsite", BlockHutMysticalSite::new); + public static final DeferredBlock blockHutGraveyard = simpleBlockItem("blockhutgraveyard", BlockHutGraveyard::new); + public static final DeferredBlock blockHutNetherWorker = simpleBlockItem("blockhutnetherworker", BlockHutNetherWorker::new); + public static final DeferredBlock blockSimpleQuarry = simpleBlockItem(ModBuildings.SIMPLE_QUARRY_ID, SimpleQuarry::new); + public static final DeferredBlock blockMediumQuarry = simpleBlockItem(ModBuildings.MEDIUM_QUARRY_ID, MediumQuarry::new); + //public static final DeferredBlock blockLargeQuarry = simpleBlockItem("largequarry", LargeQuarry::new); + public static final DeferredBlock blockHutAlchemist = simpleBlockItem("blockhutalchemist", BlockHutAlchemist::new); + public static final DeferredBlock blockHutKitchen = simpleBlockItem("blockhutkitchen", BlockHutKitchen::new); /** * Utility blocks. */ - public static AbstractBlockMinecoloniesConstructionTape> blockConstructionTape; - public static AbstractBlockMinecoloniesRack> blockRack; - public static AbstractBlockMinecoloniesGrave> blockGrave; - public static AbstractBlockMinecoloniesNamedGrave> blockNamedGrave; - public static AbstractBlockMinecolonies> blockWayPoint; - public static AbstractBlockBarrel> blockBarrel; - public static AbstractBlockMinecoloniesDirectional> blockDecorationPlaceholder; - public static AbstractBlockMinecoloniesDefault> blockScarecrow; - public static AbstractBlockMinecoloniesHorizontal> blockPlantationField; - public static AbstractBlockMinecolonies> blockCompostedDirt; - public static AbstractColonyFlagBanner> blockColonyBanner; - public static AbstractColonyFlagBanner> blockColonyWallBanner; - public static AbstractBlockGate blockIronGate; - public static AbstractBlockGate blockWoodenGate; - public static MinecoloniesFarmland farmland; - public static MinecoloniesFarmland floodedFarmland; - - public static MinecoloniesCropBlock blockBellPepper; - public static MinecoloniesCropBlock blockCabbage; - public static MinecoloniesCropBlock blockChickpea; - public static MinecoloniesCropBlock blockDurum; - public static MinecoloniesCropBlock blockEggplant; - public static MinecoloniesCropBlock blockGarlic; - public static MinecoloniesCropBlock blockOnion; - public static MinecoloniesCropBlock blockSoyBean; - public static MinecoloniesCropBlock blockTomato; - public static MinecoloniesCropBlock blockRice; + public static final DeferredBlock blockConstructionTape = simpleBlockItem("blockconstructiontape", BlockConstructionTape::new); + public static final DeferredBlock blockRack = simpleBlockItem("blockminecoloniesrack", BlockMinecoloniesRack::new); + public static final DeferredBlock blockGrave = simpleBlockItem("blockminecoloniesgrave", BlockMinecoloniesGrave::new); + public static final DeferredBlock blockNamedGrave = simpleBlockItem("blockminecoloniesnamedgrave", BlockMinecoloniesNamedGrave::new); + public static final DeferredBlock blockWayPoint = simpleBlockItem("blockwaypoint", BlockWaypoint::new); + public static final DeferredBlock blockBarrel = simpleBlockItem("barrel_block", BlockBarrel::new); + public static final DeferredBlock blockDecorationPlaceholder = simpleBlockItem("decorationcontroller", BlockDecorationController::new); + public static final DeferredBlock blockScarecrow = simpleBlockItem("blockhutfield", BlockScarecrow::new); + public static final DeferredBlock blockPlantationField = simpleBlockItem("blockhutplantationfield", BlockPlantationField::new); + public static final DeferredBlock blockCompostedDirt = simpleBlockItem("composted_dirt", BlockCompostedDirt::new); + public static final DeferredBlock farmland = simpleBlockItem("farmland", () -> new MinecoloniesFarmland(false, 15.0)); + public static final DeferredBlock floodedFarmland = simpleBlockItem("floodedfarmland", () -> new MinecoloniesFarmland(true, 13.0)); + + public static final DeferredBlock blockIronGate = customBlockItem("gate_iron", () -> new BlockGate(5f, 6, 8), ItemGate::new); + public static final DeferredBlock blockWoodenGate = customBlockItem("gate_wood", () -> new BlockGate(4f, 6, 5), ItemGate::new); + + /** + * Items in ModItems + */ + public static final DeferredBlock blockColonyBanner = simple("colony_banner", BlockColonyFlagBanner::new); + public static final DeferredBlock blockColonyWallBanner = simple("colony_wall_banner", BlockColonyFlagWallBanner::new); + + public static final DeferredBlock blockBellPepper = cropBlock("bell_pepper", ModBlocks.farmland, ModTags.temperateBiomes); + public static final DeferredBlock blockCabbage = cropBlock("cabbage", ModBlocks.farmland, ModTags.coldBiomes); + public static final DeferredBlock blockChickpea = cropBlock("chickpea", ModBlocks.farmland, ModTags.dryBiomes); + public static final DeferredBlock blockDurum = cropBlock("durum", ModBlocks.farmland, null); + public static final DeferredBlock blockEggplant = cropBlock("eggplant", ModBlocks.farmland, null); + public static final DeferredBlock blockGarlic = cropBlock("garlic", ModBlocks.farmland, null); + public static final DeferredBlock blockOnion = cropBlock("onion", ModBlocks.farmland, null); + public static final DeferredBlock blockSoyBean = cropBlock("soybean", ModBlocks.farmland, ModTags.humidBiomes); + public static final DeferredBlock blockTomato = cropBlock("tomato", ModBlocks.farmland, ModTags.temperateBiomes); + public static final DeferredBlock blockRice = cropBlock("rice", ModBlocks.floodedFarmland, ModTags.humidBiomes); /** * Private constructor to hide the implicit public one. @@ -114,9 +137,9 @@ private ModBlocks() } @NotNull - public static AbstractBlockHut[] getHuts() + public static List>> getHuts() { - return new AbstractBlockHut[] { + return List.of( blockHutTownHall, blockHutHome, blockHutTavern, @@ -168,15 +191,15 @@ public static AbstractBlockHut[] getHuts() blockHutAlchemist, blockHutKitchen, blockSimpleQuarry, - blockMediumQuarry, + blockMediumQuarry //blockLargeQuarry - }; + ); } @NotNull - public static MinecoloniesCropBlock[] getCrops() + public static List> getCrops() { - return new MinecoloniesCropBlock[] { + return List.of( blockBellPepper, blockCabbage, blockChickpea, @@ -186,7 +209,48 @@ public static MinecoloniesCropBlock[] getCrops() blockOnion, blockSoyBean, blockTomato, - blockRice, - }; + blockRice + ); + } + + /** + * Simply registers block, nothing else. + */ + private static DeferredBlock simple(final String name, final Supplier block) + { + return REGISTRY.register(name, block); + } + + /** + * Registers block with default {@link BlockItem} + */ + private static DeferredBlock simpleBlockItem(final String name, final Supplier block) + { + final DeferredBlock registered = simple(name, block); + ModItems.REGISTRY.registerSimpleBlockItem(registered); + return registered; + } + + /** + * Registers block with custom {@link BlockItem} ctor + * + * @implNote inlined version of {@link #simpleBlockItem(String, Supplier)} with custom factory + */ + private static DeferredBlock customBlockItem(final String name, + final Supplier block, + final BiFunction blockItemFactory) + { + final DeferredBlock registered = simple(name, block); + ModItems.REGISTRY.register(registered.unwrapKey().orElseThrow().location().getPath(), + key -> blockItemFactory.apply(registered.get(), new Item.Properties())); + return registered; + } + + /** + * Registers our custom crop block + */ + private static DeferredBlock cropBlock(final String name, final DeferredBlock preferredFarmland, @Nullable final TagKey preferredBiome) + { + return customBlockItem(name, () -> new MinecoloniesCropBlock(preferredFarmland, preferredBiome), (b, prop) -> new ItemCrop(b, prop, preferredBiome)); } } diff --git a/src/main/java/com/minecolonies/api/blocks/decorative/AbstractBlockGate.java b/src/main/java/com/minecolonies/api/blocks/decorative/AbstractBlockGate.java index 380b3bcc9cc..927cf155978 100644 --- a/src/main/java/com/minecolonies/api/blocks/decorative/AbstractBlockGate.java +++ b/src/main/java/com/minecolonies/api/blocks/decorative/AbstractBlockGate.java @@ -1,18 +1,13 @@ package com.minecolonies.api.blocks.decorative; import com.minecolonies.api.util.WorldUtil; -import com.minecolonies.api.util.constant.Constants; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.core.Registry; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.InteractionHand; import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; @@ -44,12 +39,6 @@ public abstract class AbstractBlockGate extends DoorBlock */ public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; - /** - * Variant reg names - */ - public static final String IRON_GATE = "gate_iron"; - public static final String WOODEN_GATE = "gate_wood"; - /** * Max X gate size */ @@ -68,16 +57,10 @@ public abstract class AbstractBlockGate extends DoorBlock protected static final VoxelShape E_W_SHAPE = Shapes.box(0.3D, 0.0D, 0.0D, 0.7D, 1.0D, 1.0D); protected static final VoxelShape N_S_SHAPE = Shapes.box(0.0D, 0.0D, 0.3D, 1.0D, 1.0D, 0.7D); - /** - * Registry name of the block. - */ - private final String name; - - public AbstractBlockGate(final String name, final float hardness, final int maxWidth, final int maxHeight) + public AbstractBlockGate(final float hardness, final int maxWidth, final int maxHeight) { super(BlockSetType.SPRUCE, Properties.of().mapColor(MapColor.WOOD).sound(SoundType.WOOD).strength(hardness, hardness * 5).noOcclusion()); registerDefaultState(defaultBlockState()); - this.name = name; this.maxWidth = maxWidth; this.maxHeight = maxHeight; this.hardness = hardness; @@ -487,28 +470,4 @@ public BlockState getStateForPlacement(BlockPlaceContext context) return null; } } - - - /** - * Registery block at gameregistry. - * - * @param registry the registry to use. - * @return the block itself. - */ - public AbstractBlockGate registerBlock(final Registry registry) - { - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, this.name), this); - return this; - } - - /** - * Registery block at gameregistry. - * - * @param registry the registry to use. - * @param properties the item properties. - */ - public void registerBlockItem(final Registry registry, final Item.Properties properties) - { - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, this.name), new BlockItem(this, properties)); - } } diff --git a/src/main/java/com/minecolonies/api/blocks/decorative/AbstractBlockMinecoloniesConstructionTape.java b/src/main/java/com/minecolonies/api/blocks/decorative/AbstractBlockMinecoloniesConstructionTape.java index cd887d50a66..c50a26bd6e7 100755 --- a/src/main/java/com/minecolonies/api/blocks/decorative/AbstractBlockMinecoloniesConstructionTape.java +++ b/src/main/java/com/minecolonies/api/blocks/decorative/AbstractBlockMinecoloniesConstructionTape.java @@ -1,10 +1,10 @@ package com.minecolonies.api.blocks.decorative; -import com.minecolonies.api.blocks.AbstractBlockMinecoloniesFalling; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.FallingBlock; import net.minecraft.world.level.block.HorizontalDirectionalBlock; import net.minecraft.world.level.block.PipeBlock; import net.minecraft.world.level.block.SimpleWaterloggedBlock; @@ -19,7 +19,7 @@ import net.minecraft.world.phys.shapes.VoxelShape; import org.jetbrains.annotations.NotNull; -public abstract class AbstractBlockMinecoloniesConstructionTape> extends AbstractBlockMinecoloniesFalling implements SimpleWaterloggedBlock +public abstract class AbstractBlockMinecoloniesConstructionTape> extends FallingBlock implements SimpleWaterloggedBlock { public static final BooleanProperty NORTH = PipeBlock.NORTH; public static final BooleanProperty EAST = PipeBlock.EAST; diff --git a/src/main/java/com/minecolonies/api/blocks/decorative/AbstractColonyFlagBanner.java b/src/main/java/com/minecolonies/api/blocks/decorative/AbstractColonyFlagBanner.java index 3b5394c2a13..91c2bd31b4e 100644 --- a/src/main/java/com/minecolonies/api/blocks/decorative/AbstractColonyFlagBanner.java +++ b/src/main/java/com/minecolonies/api/blocks/decorative/AbstractColonyFlagBanner.java @@ -1,19 +1,15 @@ package com.minecolonies.api.blocks.decorative; -import com.minecolonies.api.blocks.interfaces.IBlockMinecolonies; import com.minecolonies.api.colony.IColony; import com.minecolonies.api.colony.IColonyManager; import com.minecolonies.core.tileentities.TileEntityColonyFlag; import net.minecraft.core.BlockPos; -import net.minecraft.core.Registry; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.DyeColor; -import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.AbstractBannerBlock; -import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import org.jetbrains.annotations.NotNull; @@ -23,11 +19,8 @@ /** * Represents the common functions of both the wall and floor colony flag banner blocks */ -public abstract class AbstractColonyFlagBanner> extends AbstractBannerBlock implements IBlockMinecolonies> +public abstract class AbstractColonyFlagBanner> extends AbstractBannerBlock { - public static final String REGISTRY_NAME = "colony_banner"; - public static final String REGISTRY_NAME_WALL = "colony_wall_banner"; - public AbstractColonyFlagBanner(final DyeColor dyeColor, final Properties properties) { super(dyeColor, properties); @@ -58,17 +51,4 @@ public void setPlacedBy(final Level worldIn, final @NotNull BlockPos pos, @NotNu } } - - @Override - public AbstractColonyFlagBanner registerBlock(final Registry registry) - { - Registry.register(registry, getRegistryName(), this); - return this; - } - - @Override - public void registerBlockItem(final Registry registry, final Item.Properties properties) - { - // Occurs in ModItems. - } } diff --git a/src/main/java/com/minecolonies/api/blocks/huts/AbstractBlockMinecoloniesDefault.java b/src/main/java/com/minecolonies/api/blocks/huts/AbstractBlockMinecoloniesDefault.java deleted file mode 100755 index c10bf67a0fb..00000000000 --- a/src/main/java/com/minecolonies/api/blocks/huts/AbstractBlockMinecoloniesDefault.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.minecolonies.api.blocks.huts; - -import com.minecolonies.api.blocks.AbstractBlockMinecoloniesContainer; -import net.minecraft.core.Registry; -import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.Item; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.HorizontalDirectionalBlock; -import net.minecraft.world.level.block.state.properties.DirectionProperty; - -public abstract class AbstractBlockMinecoloniesDefault> extends AbstractBlockMinecoloniesContainer -{ - /** - * The position it faces. - */ - public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; - /** - * Hardness of the block. - */ - public static final float HARDNESS = 10F; - /** - * Resistance of the block. - */ - public static final float RESISTANCE = 10F; - /** - * Start of the collision box at y. - */ - public static final double BOTTOM_COLLISION = 0.0; - /** - * Start of the collision box at x and z. - */ - public static final double START_COLLISION = 0.1; - /** - * End of the collision box. - */ - public static final double END_COLLISION = 0.9; - /** - * Height of the collision box. - */ - public static final double HEIGHT_COLLISION = 2.2; - /** - * Registry name for this block. - */ - public static final String REGISTRY_NAME = "blockhutfield"; - - public AbstractBlockMinecoloniesDefault(final Properties properties) - { - super(properties); - } - - @Override - public B registerBlock(final Registry registry) - { - Registry.register(registry, getRegistryName(), this); - return (B) this; - } - - @Override - public void registerBlockItem(final Registry registry, final Item.Properties properties) - { - Registry.register(registry, getRegistryName(), new BlockItem(this, properties)); - } -} diff --git a/src/main/java/com/minecolonies/api/blocks/interfaces/IBlockMinecolonies.java b/src/main/java/com/minecolonies/api/blocks/interfaces/IBlockMinecolonies.java deleted file mode 100755 index f050b608158..00000000000 --- a/src/main/java/com/minecolonies/api/blocks/interfaces/IBlockMinecolonies.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.minecolonies.api.blocks.interfaces; - -import net.minecraft.core.Registry; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.item.Item; -import net.minecraft.world.level.block.Block; - -public interface IBlockMinecolonies> -{ - /** - * Registery block at gameregistry. - * - * @param registry the registry to use. - * @return the block itself. - */ - B registerBlock(final Registry registry); - - /** - * Registery block at gameregistry. - * - * @param registry the registry to use. - * @param properties the item properties. - */ - void registerBlockItem(final Registry registry, final Item.Properties properties); - - /** - * Get the registry name of the block. - * @return the registry name. - */ - ResourceLocation getRegistryName(); -} diff --git a/src/main/java/com/minecolonies/api/colony/buildings/registry/BuildingEntry.java b/src/main/java/com/minecolonies/api/colony/buildings/registry/BuildingEntry.java index 28861ce949b..18a2c403ce9 100755 --- a/src/main/java/com/minecolonies/api/colony/buildings/registry/BuildingEntry.java +++ b/src/main/java/com/minecolonies/api/colony/buildings/registry/BuildingEntry.java @@ -51,9 +51,9 @@ public static final class Builder * @param buildingBlock The block. * @return The builder. */ - public Builder setBuildingBlock(final AbstractBlockHut buildingBlock) + public Builder setBuildingBlock(final Supplier> buildingBlock) { - this.buildingBlock = buildingBlock; + this.buildingBlock = buildingBlock.get(); return this; } diff --git a/src/main/java/com/minecolonies/api/crafting/CompostRecipe.java b/src/main/java/com/minecolonies/api/crafting/CompostRecipe.java index f3da91a0866..e8c9bcde486 100644 --- a/src/main/java/com/minecolonies/api/crafting/CompostRecipe.java +++ b/src/main/java/com/minecolonies/api/crafting/CompostRecipe.java @@ -47,7 +47,7 @@ public CompostRecipe(@NotNull final Ingredient ingredient, final int strength) { this.input = ingredient; this.strength = strength; - this.output = new ItemStack(ModItems.compost, COMPOST_RESULT); + this.output = ModItems.compost.toStack(COMPOST_RESULT); } @NotNull diff --git a/src/main/java/com/minecolonies/api/crafting/GenericRecipe.java b/src/main/java/com/minecolonies/api/crafting/GenericRecipe.java index 6c169c0bacf..2c3c97e0825 100644 --- a/src/main/java/com/minecolonies/api/crafting/GenericRecipe.java +++ b/src/main/java/com/minecolonies/api/crafting/GenericRecipe.java @@ -322,7 +322,7 @@ private static List> compactInputs(final List> i final IngredientStacks newIngredient = new IngredientStacks(ingredient); // also ignore the build tool as an ingredient, since colony crafters don't require it. // (see RecipeStorage.calculateCleanedInput() for why) - if (!newIngredient.getStacks().isEmpty() && newIngredient.getStacks().get(0).getItem() == buildTool.get()) continue; + if (!newIngredient.getStacks().isEmpty() && newIngredient.getStacks().get(0).is(buildTool)) continue; final IngredientStacks existing = ingredients.get(newIngredient); if (existing == null) diff --git a/src/main/java/com/minecolonies/api/crafting/ItemStorage.java b/src/main/java/com/minecolonies/api/crafting/ItemStorage.java index c56ebbdffcf..eaa1a1f2e9a 100755 --- a/src/main/java/com/minecolonies/api/crafting/ItemStorage.java +++ b/src/main/java/com/minecolonies/api/crafting/ItemStorage.java @@ -3,6 +3,7 @@ import com.google.gson.JsonObject; import com.minecolonies.api.util.ItemStackUtils; import com.minecolonies.api.util.Utils; +import net.minecraft.core.Holder; import net.minecraft.core.HolderLookup; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; @@ -293,6 +294,16 @@ public Item getItem() return stack.getItem(); } + /** + * Compares whether this storage holds given item + * + * @return true if item matches + */ + public boolean is(final Holder item) + { + return stack.is(item); + } + /** * Getter for the damage value. * diff --git a/src/main/java/com/minecolonies/api/crafting/RecipeStorage.java b/src/main/java/com/minecolonies/api/crafting/RecipeStorage.java index 108bd829cbc..51601ed4e10 100755 --- a/src/main/java/com/minecolonies/api/crafting/RecipeStorage.java +++ b/src/main/java/com/minecolonies/api/crafting/RecipeStorage.java @@ -185,7 +185,7 @@ private void processInputsAndTools(@Nullable final List secOutputs) { for (final ItemStack secOutput : secOutputs) { - if (!secOutput.isEmpty() && secOutput.getItem() != ModItems.buildTool.get()) + if (!secOutput.isEmpty() && secOutput.is(ModItems.buildTool)) { this.secondaryOutputs.add(secOutput); } @@ -196,7 +196,7 @@ private void processInputsAndTools(@Nullable final List secOutputs) for (final ItemStorage input : input) { ItemStorage inputItem = input; - if (inputItem.isEmpty() || inputItem.getItem() == ModItems.buildTool.get()) + if (inputItem.isEmpty() || inputItem.is(ModItems.buildTool)) { continue; } diff --git a/src/main/java/com/minecolonies/api/creativetab/ModCreativeTabs.java b/src/main/java/com/minecolonies/api/creativetab/ModCreativeTabs.java index 94b3e3c26fc..33d7e5a351f 100755 --- a/src/main/java/com/minecolonies/api/creativetab/ModCreativeTabs.java +++ b/src/main/java/com/minecolonies/api/creativetab/ModCreativeTabs.java @@ -4,13 +4,14 @@ import com.minecolonies.api.blocks.ModBlocks; import com.minecolonies.api.items.ModItems; import com.minecolonies.api.util.constant.Constants; +import com.minecolonies.core.blocks.MinecoloniesCropBlock; import net.minecraft.core.registries.Registries; import net.minecraft.network.chat.Component; import net.minecraft.world.item.CreativeModeTab; import net.minecraft.world.item.ItemStack; +import net.neoforged.neoforge.registries.DeferredBlock; import net.neoforged.neoforge.registries.DeferredHolder; import net.neoforged.neoforge.registries.DeferredRegister; -import net.minecraft.world.level.block.Block; /** * Class used to handle the creativeTab of minecolonies. @@ -22,7 +23,7 @@ public final class ModCreativeTabs public static final DeferredHolder HUTS = TAB_REG.register("mchuts", () -> new CreativeModeTab.Builder(CreativeModeTab.Row.TOP, 1) .icon(() -> new ItemStack(ModBlocks.blockHutTownHall)) .title(Component.translatable("com.minecolonies.creativetab.huts")).displayItems((config, output) -> { - for (final AbstractBlockHut hut : ModBlocks.getHuts()) + for (final DeferredBlock> hut : ModBlocks.getHuts()) { output.accept(hut); } @@ -69,8 +70,8 @@ public final class ModCreativeTabs output.accept(ModItems.santaHat); - output.accept(ModItems.irongate); - output.accept(ModItems.woodgate); + output.accept(ModBlocks.blockIronGate); + output.accept(ModBlocks.blockWoodenGate); output.accept(ModItems.flagBanner); @@ -107,7 +108,7 @@ public final class ModCreativeTabs output.accept(ModBlocks.farmland); output.accept(ModBlocks.floodedFarmland); - for (final Block crop : ModBlocks.getCrops()) + for (final DeferredBlock crop : ModBlocks.getCrops()) { output.accept(crop); } diff --git a/src/main/java/com/minecolonies/api/entity/mobs/RaiderMobUtils.java b/src/main/java/com/minecolonies/api/entity/mobs/RaiderMobUtils.java index 10994d14fa7..f4c982e7a5f 100755 --- a/src/main/java/com/minecolonies/api/entity/mobs/RaiderMobUtils.java +++ b/src/main/java/com/minecolonies/api/entity/mobs/RaiderMobUtils.java @@ -159,7 +159,7 @@ public static void setEquipment(final AbstractEntityRaiderMob mob) } else if (mob instanceof IPharaoEntity) { - mob.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(ModItems.pharaoscepter)); + mob.setItemSlot(EquipmentSlot.MAINHAND, ModItems.pharaoscepter.toStack()); } else if (mob instanceof IArcherMobEntity) { @@ -167,11 +167,11 @@ else if (mob instanceof IArcherMobEntity) } else if (mob instanceof ISpearmanMobEntity) { - mob.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(ModItems.spear)); + mob.setItemSlot(EquipmentSlot.MAINHAND, ModItems.spear.toStack()); } else if (mob instanceof IChiefBarbarianEntity) { - mob.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(ModItems.chiefSword)); + mob.setItemSlot(EquipmentSlot.MAINHAND, ModItems.chiefSword.toStack()); mob.setItemSlot(EquipmentSlot.HEAD, new ItemStack(Items.CHAINMAIL_HELMET)); mob.setItemSlot(EquipmentSlot.CHEST, new ItemStack(Items.CHAINMAIL_CHESTPLATE)); mob.setItemSlot(EquipmentSlot.LEGS, new ItemStack(Items.CHAINMAIL_LEGGINGS)); @@ -179,22 +179,22 @@ else if (mob instanceof IChiefBarbarianEntity) } else if (mob instanceof IPirateEntity) { - mob.setItemSlot(EquipmentSlot.MAINHAND, new ItemStack(ModItems.scimitar)); + mob.setItemSlot(EquipmentSlot.MAINHAND, ModItems.scimitar.toStack()); if (mob instanceof ICaptainPirateEntity) { if (new Random().nextBoolean()) { - mob.setItemSlot(EquipmentSlot.HEAD, new ItemStack(ModItems.pirateHelmet_1)); - mob.setItemSlot(EquipmentSlot.CHEST, new ItemStack(ModItems.pirateChest_1)); - mob.setItemSlot(EquipmentSlot.LEGS, new ItemStack(ModItems.pirateLegs_1)); - mob.setItemSlot(EquipmentSlot.FEET, new ItemStack(ModItems.pirateBoots_1)); + mob.setItemSlot(EquipmentSlot.HEAD, ModItems.pirateHelmet_1.toStack()); + mob.setItemSlot(EquipmentSlot.CHEST, ModItems.pirateChest_1.toStack()); + mob.setItemSlot(EquipmentSlot.LEGS, ModItems.pirateLegs_1.toStack()); + mob.setItemSlot(EquipmentSlot.FEET, ModItems.pirateBoots_1.toStack()); } else { - mob.setItemSlot(EquipmentSlot.HEAD, new ItemStack(ModItems.pirateHelmet_2)); - mob.setItemSlot(EquipmentSlot.CHEST, new ItemStack(ModItems.pirateChest_2)); - mob.setItemSlot(EquipmentSlot.LEGS, new ItemStack(ModItems.pirateLegs_2)); - mob.setItemSlot(EquipmentSlot.FEET, new ItemStack(ModItems.pirateBoots_2)); + mob.setItemSlot(EquipmentSlot.HEAD, ModItems.pirateHelmet_2.toStack()); + mob.setItemSlot(EquipmentSlot.CHEST, ModItems.pirateChest_2.toStack()); + mob.setItemSlot(EquipmentSlot.LEGS, ModItems.pirateLegs_2.toStack()); + mob.setItemSlot(EquipmentSlot.FEET, ModItems.pirateBoots_2.toStack()); } } } diff --git a/src/main/java/com/minecolonies/api/items/ItemBlockHut.java b/src/main/java/com/minecolonies/api/items/ItemBlockHut.java deleted file mode 100644 index cf5e0e14334..00000000000 --- a/src/main/java/com/minecolonies/api/items/ItemBlockHut.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.minecolonies.api.items; - -import com.minecolonies.api.blocks.AbstractBlockHut; -import net.minecraft.world.item.BlockItem; - -/** - * A custom item class for hut blocks. - */ -public class ItemBlockHut extends BlockItem -{ - /** - * This items block. - */ - private AbstractBlockHut block; - - /** - * Creates a new ItemBlockHut representing the item form of the given {@link AbstractBlockHut}. - * - * @param block the {@link AbstractBlockHut} this item represents. - * @param builder the item properties to use. - */ - public ItemBlockHut(AbstractBlockHut block, Properties builder) - { - super(block, builder); - this.block = block; - } -} diff --git a/src/main/java/com/minecolonies/api/items/ModArmorMaterials.java b/src/main/java/com/minecolonies/api/items/ModArmorMaterials.java new file mode 100644 index 00000000000..9b6dabf8071 --- /dev/null +++ b/src/main/java/com/minecolonies/api/items/ModArmorMaterials.java @@ -0,0 +1,100 @@ +package com.minecolonies.api.items; + +import com.minecolonies.api.util.constant.Constants; +import net.minecraft.Util; +import net.minecraft.core.Holder; +import net.minecraft.core.registries.BuiltInRegistries; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.world.item.ArmorItem; +import net.minecraft.world.item.ArmorMaterial; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.Ingredient; +import net.neoforged.neoforge.registries.DeferredRegister; + +import java.util.EnumMap; +import java.util.List; + +public class ModArmorMaterials +{ + public final static DeferredRegister REGISTRY = DeferredRegister.create(BuiltInRegistries.ARMOR_MATERIAL, Constants.MOD_ID); + + public static final Holder SANTA_HAT = REGISTRY.register("santa_hat", () -> new ArmorMaterial( + // Determines the defense value of this armor material, depending on what armor piece it is. + Util.make(new EnumMap<>(ArmorItem.Type.class), map -> { + map.put(ArmorItem.Type.BOOTS, 0); + map.put(ArmorItem.Type.LEGGINGS, 0); + map.put(ArmorItem.Type.CHESTPLATE, 0); + map.put(ArmorItem.Type.HELMET, 0); + }), + 500, + SoundEvents.ARMOR_EQUIP_LEATHER, + () -> Ingredient.EMPTY, + List.of(), + 0, + 0 + )); + + public static final Holder PLATE_ARMOR = REGISTRY.register("plate_armor", () -> new ArmorMaterial( + // Determines the defense value of this armor material, depending on what armor piece it is. + Util.make(new EnumMap<>(ArmorItem.Type.class), map -> { + map.put(ArmorItem.Type.BOOTS, 3); + map.put(ArmorItem.Type.LEGGINGS, 6); + map.put(ArmorItem.Type.CHESTPLATE, 8); + map.put(ArmorItem.Type.HELMET, 3); + }), + 37, + SoundEvents.ARMOR_EQUIP_IRON, + () -> Ingredient.of(Items.IRON_INGOT), + List.of(), + 0, + 0 + )); + + public static final Holder GOGGLES = REGISTRY.register("build_goggles", () -> new ArmorMaterial( + // Determines the defense value of this armor material, depending on what armor piece it is. + Util.make(new EnumMap<>(ArmorItem.Type.class), map -> { + map.put(ArmorItem.Type.BOOTS, 0); + map.put(ArmorItem.Type.LEGGINGS, 0); + map.put(ArmorItem.Type.CHESTPLATE, 0); + map.put(ArmorItem.Type.HELMET, 0); + }), + 20, + SoundEvents.ARMOR_EQUIP_LEATHER, + () -> Ingredient.EMPTY, + List.of(), + 0, + 0 + )); + + public static final Holder PIRATE_ARMOR_1 = REGISTRY.register("pirate_armor_1", () -> new ArmorMaterial( + // Determines the defense value of this armor material, depending on what armor piece it is. + Util.make(new EnumMap<>(ArmorItem.Type.class), map -> { + map.put(ArmorItem.Type.BOOTS, 2); + map.put(ArmorItem.Type.LEGGINGS, 5); + map.put(ArmorItem.Type.CHESTPLATE, 6); + map.put(ArmorItem.Type.HELMET, 2); + }), + 5, + SoundEvents.ARMOR_EQUIP_LEATHER, + () -> Ingredient.of(Items.DIAMOND), + List.of(), + 0, + 0 + )); + + public static final Holder PIRATE_ARMOR_2 = REGISTRY.register("pirate_armor_2", () -> new ArmorMaterial( + // Determines the defense value of this armor material, depending on what armor piece it is. + Util.make(new EnumMap<>(ArmorItem.Type.class), map -> { + map.put(ArmorItem.Type.BOOTS, 3); + map.put(ArmorItem.Type.LEGGINGS, 6); + map.put(ArmorItem.Type.CHESTPLATE, 8); + map.put(ArmorItem.Type.HELMET, 3); + }), + 5, + SoundEvents.ARMOR_EQUIP_LEATHER, + () -> Ingredient.of(Items.DIAMOND), + List.of(), + 2, + 0 + )); +} diff --git a/src/main/java/com/minecolonies/api/items/ModItems.java b/src/main/java/com/minecolonies/api/items/ModItems.java index ffc8b79d46f..d9bcdbec4d1 100755 --- a/src/main/java/com/minecolonies/api/items/ModItems.java +++ b/src/main/java/com/minecolonies/api/items/ModItems.java @@ -1,6 +1,21 @@ package com.minecolonies.api.items; +import com.minecolonies.api.blocks.ModBlocks; +import com.minecolonies.api.colony.jobs.ModJobs; +import com.minecolonies.api.util.constant.Constants; +import com.minecolonies.core.items.*; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.Mob; +import net.minecraft.world.food.FoodProperties; +import net.minecraft.world.item.ArmorItem; import net.minecraft.world.item.Item; +import net.minecraft.world.item.Items; +import net.neoforged.neoforge.common.DeferredSpawnEggItem; +import net.neoforged.neoforge.registries.DeferredItem; +import net.neoforged.neoforge.registries.DeferredRegister; + +import java.util.function.Function; +import java.util.function.Supplier; /** * Class handling the registering of the mod items. @@ -10,108 +25,128 @@ @SuppressWarnings({"squid:ClassVariableVisibilityCheck", "squid:S2444", "squid:S1444"}) public final class ModItems { - public static Item supplyChest; - public static Item permTool; - public static Item scepterGuard; - public static Item bannerRallyGuards; - public static Item supplyCamp; - public static Item ancientTome; - public static Item chiefSword; - public static Item scimitar; - public static Item scepterLumberjack; - public static Item pharaoscepter; - public static Item firearrow; - public static Item questLog; - public static Item scepterBeekeeper; - public static Item mistletoe; - public static Item spear; - - public static Item clipboard; - public static Item compost; - public static Item resourceScroll; - - public static Item pirateHelmet_1; - public static Item pirateChest_1; - public static Item pirateLegs_1; - public static Item pirateBoots_1; - - public static Item pirateHelmet_2; - public static Item pirateChest_2; - public static Item pirateLegs_2; - public static Item pirateBoots_2; - - public static Item plateArmorHelmet; - public static Item plateArmorChest; - public static Item plateArmorLegs; - public static Item plateArmorBoots; - - public static Item santaHat; - - public static Item flagBanner; - public static Item irongate; - public static Item woodgate; - - public static Item breadDough; - public static Item cookieDough; - public static Item cakeBatter; - public static Item rawPumpkinPie; - - public static Item milkyBread; - public static Item sugaryBread; - public static Item goldenBread; - public static Item chorusBread; - - public static Item adventureToken; - - public static Item scrollColonyTP; - public static Item scrollColonyAreaTP; - public static Item scrollBuff; - public static Item scrollGuardHelp; - public static Item scrollHighLight; - - public static Item sifterMeshString; - public static Item sifterMeshFlint; - public static Item sifterMeshIron; - public static Item sifterMeshDiamond; - - public static Item magicpotion; - - public static Item buildGoggles; - public static Item scanAnalyzer; - - public static Item butter; - public static Item cabochis; - public static Item cheddar_cheese; - public static Item congee; - public static Item cooked_rice; - public static Item eggplant_dolma; - public static Item feta_cheese; - public static Item flatbread; - public static Item hand_pie; - public static Item lamb_stew; - public static Item lembas_scone; - public static Item manchet_bread; - public static Item manchet_dough; - public static Item muffin; - public static Item muffin_dough; - public static Item pasta_plain; - public static Item pasta_tomato; - public static Item pepper_hummus; - public static Item pita_hummus; - public static Item pottage; - public static Item raw_noodle; - public static Item rice_ball; - public static Item stew_trencher; - public static Item stuffed_pepper; - public static Item stuffed_pita; - public static Item sushi_roll; - public static Item tofu; - - public static Item large_water_bottle; - public static Item large_milk_bottle; - public static Item large_soy_milk_bottle; - public static Item large_empty_bottle; - + public static final DeferredRegister.Items REGISTRY = DeferredRegister.createItems(Constants.MOD_ID); + + public static final DeferredItem adventureToken = custom("adventure_token", ItemAdventureToken::new); + public static final DeferredItem ancientTome = custom("ancienttome", ItemAncientTome::new); + public static final DeferredItem bannerRallyGuards = custom("banner_rally_guards", ItemBannerRallyGuards::new); + public static final DeferredItem buildGoggles = custom("build_goggles", ItemBuildGoggles::new); + public static final DeferredItem chiefSword = custom("chiefsword", ItemChiefSword::new); + public static final DeferredItem clipboard = custom("clipboard", ItemClipboard::new); + public static final DeferredItem compost = custom("compost", ItemCompost::new); + public static final DeferredItem firearrow = custom("firearrow", ItemFireArrow::new); + public static final DeferredItem flagBanner = custom("colony_banner", prop -> new ItemColonyFlagBanner(ModBlocks.blockColonyBanner.get(), ModBlocks.blockColonyWallBanner.get(), prop.stacksTo(1))); + public static final DeferredItem magicpotion = custom("magicpotion", ItemMagicPotion::new); + public static final DeferredItem mistletoe = custom("mistletoe", ItemMistletoe::new); + public static final DeferredItem permTool = custom("scepterpermission", ItemScepterPermission::new); + public static final DeferredItem pharaoscepter = custom("pharaoscepter", ItemPharaoScepter::new); + public static final DeferredItem questLog = custom("questlog", ItemQuestLog::new); + public static final DeferredItem resourceScroll = custom("resourcescroll", ItemResourceScroll::new); + public static final DeferredItem santaHat = custom("santa_hat", prop -> new ItemSantaHead(ModArmorMaterials.SANTA_HAT, ArmorItem.Type.HELMET, prop)); + public static final DeferredItem scanAnalyzer = custom("scan_analyzer", ItemScanAnalyzer::new); + public static final DeferredItem scepterBeekeeper = custom("scepterbeekeeper", ItemScepterBeekeeper::new); + public static final DeferredItem scepterGuard = custom("scepterguard", ItemScepterGuard::new); + public static final DeferredItem scepterLumberjack = custom("scepterlumberjack", ItemScepterLumberjack::new); + public static final DeferredItem scimitar = custom("iron_scimitar", ItemIronScimitar::new); + public static final DeferredItem spear = custom("spear", ItemSpear::new); + public static final DeferredItem supplyCamp = custom("supplycampdeployer", ItemSupplyCampDeployer::new); + public static final DeferredItem supplyChest = custom("supplychestdeployer", ItemSupplyChestDeployer::new); + + public static final DeferredItem pirateHelmet_1 = custom("pirate_hat", prop -> new ItemPirateGear(ModArmorMaterials.PIRATE_ARMOR_1, ArmorItem.Type.HELMET, prop)); + public static final DeferredItem pirateChest_1 = custom("pirate_top", prop -> new ItemPirateGear(ModArmorMaterials.PIRATE_ARMOR_1, ArmorItem.Type.CHESTPLATE, prop)); + public static final DeferredItem pirateLegs_1 = custom("pirate_leggins", prop -> new ItemPirateGear(ModArmorMaterials.PIRATE_ARMOR_1, ArmorItem.Type.LEGGINGS, prop)); + public static final DeferredItem pirateBoots_1 = custom("pirate_boots", prop -> new ItemPirateGear(ModArmorMaterials.PIRATE_ARMOR_1, ArmorItem.Type.BOOTS, prop)); + + public static final DeferredItem pirateHelmet_2 = custom("pirate_cap", prop -> new ItemPirateGear(ModArmorMaterials.PIRATE_ARMOR_2, ArmorItem.Type.HELMET, prop)); + public static final DeferredItem pirateChest_2 = custom("pirate_chest", prop -> new ItemPirateGear(ModArmorMaterials.PIRATE_ARMOR_2, ArmorItem.Type.CHESTPLATE, prop)); + public static final DeferredItem pirateLegs_2 = custom("pirate_legs", prop -> new ItemPirateGear(ModArmorMaterials.PIRATE_ARMOR_2, ArmorItem.Type.LEGGINGS, prop)); + public static final DeferredItem pirateBoots_2 = custom("pirate_shoes", prop -> new ItemPirateGear(ModArmorMaterials.PIRATE_ARMOR_2, ArmorItem.Type.BOOTS, prop)); + + public static final DeferredItem plateArmorHelmet = custom("plate_armor_helmet", prop -> new ItemPlateArmor(ModArmorMaterials.PLATE_ARMOR, ArmorItem.Type.HELMET, prop)); + public static final DeferredItem plateArmorChest = custom("plate_armor_chest", prop -> new ItemPlateArmor(ModArmorMaterials.PLATE_ARMOR, ArmorItem.Type.CHESTPLATE, prop)); + public static final DeferredItem plateArmorLegs = custom("plate_armor_legs", prop -> new ItemPlateArmor(ModArmorMaterials.PLATE_ARMOR, ArmorItem.Type.LEGGINGS, prop)); + public static final DeferredItem plateArmorBoots = custom("plate_armor_boots", prop -> new ItemPlateArmor(ModArmorMaterials.PLATE_ARMOR, ArmorItem.Type.BOOTS, prop)); + + public static final DeferredItem breadDough = custom("bread_dough", ItemBreadDough::new); + public static final DeferredItem cookieDough = custom("cookie_dough", ItemCookieDough::new); + public static final DeferredItem cakeBatter = custom("cake_batter", ItemCakeBatter::new); + public static final DeferredItem rawPumpkinPie = custom("raw_pumpkin_pie", ItemRawPumpkinPie::new); + + public static final DeferredItem milkyBread = custom("milky_bread", ItemMilkyBread::new); + public static final DeferredItem sugaryBread = custom("sugary_bread", ItemSugaryBread::new); + public static final DeferredItem goldenBread = custom("golden_bread", ItemGoldenBread::new); + public static final DeferredItem chorusBread = custom("chorus_bread", ItemChorusBread::new); + + public static final DeferredItem scrollColonyTP = custom("scroll_tp", prop -> new ItemScrollColonyTP(prop.stacksTo(16))); + public static final DeferredItem scrollColonyAreaTP = custom("scroll_area_tp", prop -> new ItemScrollColonyAreaTP(prop.stacksTo(16))); + public static final DeferredItem scrollBuff = custom("scroll_buff", prop -> new ItemScrollBuff(prop.stacksTo(16))); + public static final DeferredItem scrollGuardHelp = custom("scroll_guard_help", prop -> new ItemScrollGuardHelp(prop.stacksTo(16))); + public static final DeferredItem scrollHighLight = custom("scroll_highlight", prop -> new ItemScrollHighlight(prop.stacksTo(16))); + + public static final DeferredItem sifterMeshString = custom("sifter_mesh_string", prop -> new ItemSifterMesh(prop.durability(500).setNoRepair())); + public static final DeferredItem sifterMeshFlint = custom("sifter_mesh_flint", prop -> new ItemSifterMesh(prop.durability(1000).setNoRepair())); + public static final DeferredItem sifterMeshIron = custom("sifter_mesh_iron", prop -> new ItemSifterMesh(prop.durability(1500).setNoRepair())); + public static final DeferredItem sifterMeshDiamond = custom("sifter_mesh_diamond", prop -> new ItemSifterMesh(prop.durability(2000).setNoRepair())); + + // Tier 1 Food Items + public static final DeferredItem cheddar_cheese = custom("cheddar_cheese", prop -> new ItemFood(prop.food(new FoodProperties.Builder().nutrition(4).saturationModifier(0.6F).build()), ModJobs.CHEF_ID.getPath(), 1)); + public static final DeferredItem feta_cheese = custom("feta_cheese", prop -> new ItemFood(prop.food(new FoodProperties.Builder().nutrition(4).saturationModifier(0.6F).build()), ModJobs.CHEF_ID.getPath(), 1)); + public static final DeferredItem cooked_rice = custom("cooked_rice", prop -> new ItemFood(prop.food(new FoodProperties.Builder().nutrition(4).saturationModifier(0.6F).usingConvertsTo(Items.BOWL).build()), ModJobs.CHEF_ID.getPath(), 1)); + public static final DeferredItem tofu = custom("tofu", prop -> new ItemFood(prop.food(new FoodProperties.Builder().nutrition(4).saturationModifier(0.6F).build()), ModJobs.CHEF_ID.getPath(), 1)); + public static final DeferredItem flatbread = custom("flatbread", prop -> new ItemFood(prop.food(new FoodProperties.Builder().nutrition(4).saturationModifier(0.6F).build()), ModJobs.BAKER_ID.getPath(), 1)); + + // Tier 2 Food Items + public static final DeferredItem manchet_bread = custom("manchet_bread", prop -> new ItemFood(prop.food(new FoodProperties.Builder().nutrition(6).saturationModifier(1.0F).build()), ModJobs.BAKER_ID.getPath(), 2)); + public static final DeferredItem lembas_scone = custom("lembas_scone", prop -> new ItemFood(prop.food(new FoodProperties.Builder().nutrition(6).saturationModifier(1.0F).build()), ModJobs.BAKER_ID.getPath(), 2)); + public static final DeferredItem muffin = custom("muffin", prop -> new ItemFood(prop.food(new FoodProperties.Builder().nutrition(6).saturationModifier(1.0F).build()), ModJobs.BAKER_ID.getPath(), 2)); + public static final DeferredItem pottage = custom("pottage", prop -> new ItemFood(prop.food(new FoodProperties.Builder().nutrition(6).saturationModifier(1.0F).usingConvertsTo(Items.BOWL).build()), ModJobs.CHEF_ID.getPath(), 2)); + public static final DeferredItem pasta_plain = custom("pasta_plain", prop -> new ItemFood(prop.food(new FoodProperties.Builder().nutrition(6).saturationModifier(1.0F).usingConvertsTo(Items.BOWL).build()), ModJobs.CHEF_ID.getPath(), 2)); + + // Tier 3 Food items + public static final DeferredItem hand_pie = custom("hand_pie", prop -> new ItemFood(prop.food(new FoodProperties.Builder().nutrition(8).saturationModifier(1.2F).build()), ModJobs.CHEF_ID.getPath(), 3)); + + // Cold Biomes + // Tier 2 + public static final DeferredItem cabochis = custom("cabochis", prop -> new ItemFood(prop.food(new FoodProperties.Builder().nutrition(6).saturationModifier(1.0F).usingConvertsTo(Items.BOWL).build()), ModJobs.CHEF_ID.getPath(), 2)); + // Tier 3 + public static final DeferredItem lamb_stew = custom("lamb_stew", prop -> new ItemFood(prop.food(new FoodProperties.Builder().nutrition(8).saturationModifier(1.2F).usingConvertsTo(Items.BOWL).build()), ModJobs.CHEF_ID.getPath(), 3)); + + // Hot Humid Biomes + // Tier 2 + public static final DeferredItem rice_ball = custom("rice_ball", prop -> new ItemFood(prop.food(new FoodProperties.Builder().nutrition(6).saturationModifier(1.0F).build()), ModJobs.CHEF_ID.getPath(), 2)); + // Tier 3 + public static final DeferredItem sushi_roll = custom("sushi_roll", prop -> new ItemFood(prop.food(new FoodProperties.Builder().nutrition(8).saturationModifier(1.2F).build()), ModJobs.CHEF_ID.getPath(), 3)); + + // Temperate Biomes + // Tier 2 + public static final DeferredItem pasta_tomato = custom("pasta_tomato", prop -> new ItemFood(prop.food(new FoodProperties.Builder().nutrition(6).saturationModifier(1.0F).usingConvertsTo(Items.BOWL).build()), ModJobs.CHEF_ID.getPath(), 2)); + // Tier 3 + public static final DeferredItem eggplant_dolma = custom("eggplant_dolma", prop -> new ItemFood(prop.food(new FoodProperties.Builder().nutrition(8).saturationModifier(1.2F).build()), ModJobs.CHEF_ID.getPath(), 3)); + public static final DeferredItem stuffed_pita = custom("stuffed_pita", prop -> new ItemFood(prop.food(new FoodProperties.Builder().nutrition(8).saturationModifier(1.2F).build()), ModJobs.CHEF_ID.getPath(), 3)); + + // Hot Dry Biomes + // Tier 2 + public static final DeferredItem pepper_hummus = custom("pepper_hummus", prop -> new ItemFood(prop.food(new FoodProperties.Builder().nutrition(6).saturationModifier(1.0F).build()), ModJobs.CHEF_ID.getPath(), 2)); + // Tier 3 + public static final DeferredItem pita_hummus = custom("pita_hummus", prop -> new ItemFood(prop.food(new FoodProperties.Builder().nutrition(8).saturationModifier(1.2F).build()), ModJobs.CHEF_ID.getPath(), 3)); + + // Require trading + // Tier 2 + public static final DeferredItem congee = custom("congee", prop -> new ItemFood(prop.food(new FoodProperties.Builder().nutrition(6).saturationModifier(1.0F).usingConvertsTo(Items.BOWL).build()), ModJobs.CHEF_ID.getPath(), 2)); + // Tier 3 + public static final DeferredItem stew_trencher = custom("stew_trencher", prop -> new ItemFood(prop.food(new FoodProperties.Builder().nutrition(8).saturationModifier(1.2F).build()), ModJobs.CHEF_ID.getPath(), 3)); + public static final DeferredItem stuffed_pepper = custom("stuffed_pepper", prop -> new ItemFood(prop.food(new FoodProperties.Builder().nutrition(8).saturationModifier(1.2F).build()), ModJobs.CHEF_ID.getPath(), 3)); + + // Just dough + public static final DeferredItem muffin_dough = simple("muffin_dough"); + public static final DeferredItem manchet_dough = simple("manchet_dough"); + public static final DeferredItem raw_noodle = simple("raw_noodle"); + public static final DeferredItem butter = simple("butter"); + + public static final DeferredItem large_empty_bottle = custom("large_empty_bottle", ItemLargeBottle::new); + public static final DeferredItem large_milk_bottle = custom("large_milk_bottle", prop -> new ItemLargeBottle(prop.craftRemainder(large_empty_bottle.get()))); + public static final DeferredItem large_water_bottle = custom("large_water_bottle", prop -> new ItemLargeBottle(prop.craftRemainder(large_empty_bottle.get()))); + public static final DeferredItem large_soy_milk_bottle = custom("large_soy_milk_bottle", prop -> new ItemLargeBottle(prop.craftRemainder(large_empty_bottle.get()))); /** * Private constructor to hide the implicit public one. @@ -122,4 +157,31 @@ private ModItems() * Intentionally left empty. */ } + + /** + * Simply registers custom item, nothing else. + */ + private static DeferredItem custom(final String name, final Function item) + { + return REGISTRY.register(name, () -> item.apply(new Item.Properties())); + } + + /** + * Simply registers item, nothing else. + */ + private static DeferredItem simple(final String name) + { + return custom(name, Item::new); + } + + /** + * Registers spawn egg for given entity. + */ + private static DeferredItem spawnEgg(final String name, + final Supplier> entityType, + final int backgroundColor, + final int highlightColor) + { + return custom(name, prop -> new DeferredSpawnEggItem(entityType, backgroundColor, highlightColor, prop)); + } } diff --git a/src/main/java/com/minecolonies/api/research/AbstractResearchProvider.java b/src/main/java/com/minecolonies/api/research/AbstractResearchProvider.java index d432bcd766f..f0a68cc31f7 100644 --- a/src/main/java/com/minecolonies/api/research/AbstractResearchProvider.java +++ b/src/main/java/com/minecolonies/api/research/AbstractResearchProvider.java @@ -16,6 +16,7 @@ import net.minecraft.util.Tuple; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.ItemLike; import net.neoforged.neoforge.common.crafting.SizedIngredient; import org.jetbrains.annotations.NotNull; @@ -365,6 +366,16 @@ public Research setIcon(final Item item) return this; } + /** + * Sets an Item research icon. This icon will only be displayed after research is completed. + * @param item The item to use as an icon. + * @return this + */ + public Research setIcon(final ItemLike item) + { + return setIcon(item.asItem()); + } + /** * Sets an Item research icon. This icon will only be displayed after research is completed. * @param item The item to use as an icon. @@ -381,6 +392,17 @@ public Research setIcon(final Item item, final int count) return this; } + /** + * Sets an Item research icon. This icon will only be displayed after research is completed. + * @param item The item to use as an icon. + * @param count The number to mark the icon. + * @return this + */ + public Research setIcon(final ItemLike item, final int count) + { + return setIcon(item.asItem(), count); + } + /** * Sets a texture research icon. This icon will only be displayed after research is completed. * Overrides ItemStack and Item icons. @@ -555,7 +577,7 @@ public Research addResearchRequirement(final ResourceLocation researchReq, final * @param provider The registry provider. * @return this. */ - public Research addItemCost(final Item item, final int count, final HolderLookup.Provider provider) + public Research addItemCost(final ItemLike item, final int count, final HolderLookup.Provider provider) { return addItemCost(SizedIngredient.of(item, count), provider); } diff --git a/src/main/java/com/minecolonies/api/util/ItemStackUtils.java b/src/main/java/com/minecolonies/api/util/ItemStackUtils.java index 7aed23f5426..d3eaffd1e13 100755 --- a/src/main/java/com/minecolonies/api/util/ItemStackUtils.java +++ b/src/main/java/com/minecolonies/api/util/ItemStackUtils.java @@ -123,7 +123,7 @@ public final class ItemStackUtils /** * Predicate to check for compost items. */ - public static final Predicate IS_COMPOST = stack -> !stack.isEmpty() && stack.getItem() == ModItems.compost; + public static final Predicate IS_COMPOST = stack -> !stack.isEmpty() && stack.is(ModItems.compost); /** * Private constructor to hide the implicit one. diff --git a/src/main/java/com/minecolonies/api/util/LoadOnlyStructureHandler.java b/src/main/java/com/minecolonies/api/util/LoadOnlyStructureHandler.java index 8c8d3316b47..fba24aa4095 100755 --- a/src/main/java/com/minecolonies/api/util/LoadOnlyStructureHandler.java +++ b/src/main/java/com/minecolonies/api/util/LoadOnlyStructureHandler.java @@ -81,6 +81,6 @@ public boolean isStackFree(@Nullable final ItemStack itemStack) return itemStack == null || itemStack.isEmpty() || itemStack.is(ItemTags.LEAVES) - || itemStack.getItem() == new ItemStack(ModBlocks.blockDecorationPlaceholder, 1).getItem(); + || itemStack.getItem() == ModBlocks.blockDecorationPlaceholder.asItem(); } } diff --git a/src/main/java/com/minecolonies/api/util/constant/Constants.java b/src/main/java/com/minecolonies/api/util/constant/Constants.java index 54e9c82a29f..e2aadb55381 100755 --- a/src/main/java/com/minecolonies/api/util/constant/Constants.java +++ b/src/main/java/com/minecolonies/api/util/constant/Constants.java @@ -157,9 +157,6 @@ public final class Constants */ public static final int SLOT_PER_LINE = 9; - public static final String SCIMITAR_NAME = "iron_scimitar"; - public static final String CHIEFSWORD_NAME = "chiefsword"; - public static final int GLOW_EFFECT_DURATION = 20 * 30; public static final int GLOW_EFFECT_MULTIPLIER = 20; public static final int GLOW_EFFECT_DISTANCE = 60; diff --git a/src/main/java/com/minecolonies/apiimp/initializer/ModBlocksInitializer.java b/src/main/java/com/minecolonies/apiimp/initializer/ModBlocksInitializer.java deleted file mode 100755 index 9cd7b6edc17..00000000000 --- a/src/main/java/com/minecolonies/apiimp/initializer/ModBlocksInitializer.java +++ /dev/null @@ -1,237 +0,0 @@ -package com.minecolonies.apiimp.initializer; - -import com.minecolonies.api.blocks.ModBlocks; -import com.minecolonies.api.items.ModTags; -import com.minecolonies.api.util.constant.Constants; -import com.minecolonies.core.blocks.*; -import com.minecolonies.core.blocks.decorative.BlockColonyFlagBanner; -import com.minecolonies.core.blocks.decorative.BlockColonyFlagWallBanner; -import com.minecolonies.core.blocks.decorative.BlockConstructionTape; -import com.minecolonies.core.blocks.decorative.BlockGate; -import com.minecolonies.core.blocks.huts.*; -import com.minecolonies.core.blocks.schematic.BlockWaypoint; -import net.minecraft.core.Registry; -import net.minecraft.core.registries.Registries; -import net.minecraft.world.item.Item; -import net.minecraft.world.level.block.Block; -import net.neoforged.bus.api.SubscribeEvent; -import net.neoforged.fml.common.EventBusSubscriber; -import net.neoforged.fml.common.Mod; -import net.neoforged.neoforge.registries.RegisterEvent; - -import static com.minecolonies.api.blocks.decorative.AbstractBlockGate.IRON_GATE; -import static com.minecolonies.api.blocks.decorative.AbstractBlockGate.WOODEN_GATE; -import static com.minecolonies.core.blocks.MinecoloniesCropBlock.*; -import static com.minecolonies.core.blocks.MinecoloniesFarmland.FLOODED_FARMLAND; -import static com.minecolonies.core.blocks.MinecoloniesFarmland.FARMLAND; - -/** - * This class deals with the initialization of blocks and their items. - */ -@EventBusSubscriber(modid = Constants.MOD_ID, bus = EventBusSubscriber.Bus.MOD) -public final class ModBlocksInitializer -{ - - private ModBlocksInitializer() - { - throw new IllegalStateException("Tried to initialize: ModBlockInitializer but this is a Utility class."); - } - - @SubscribeEvent - public static void registerBlocks(RegisterEvent event) - { - if (event.getRegistryKey().equals(Registries.BLOCK)) - { - ModBlocksInitializer.init(event.getRegistry(Registries.BLOCK)); - } - } - - /** - * Initializes {@link ModBlocks} with the block instances. - * - * @param registry The registry to register the new blocks. - */ - @SuppressWarnings("PMD.ExcessiveMethodLength") - public static void init(final Registry registry) - { - ModBlocks.blockHutBaker = new BlockHutBaker().registerBlock(registry); - ModBlocks.blockHutBlacksmith = new BlockHutBlacksmith().registerBlock(registry); - ModBlocks.blockHutBuilder = new BlockHutBuilder().registerBlock(registry); - ModBlocks.blockHutHome = new BlockHutCitizen().registerBlock(registry); - ModBlocks.blockHutDeliveryman = new BlockHutDeliveryman().registerBlock(registry); - ModBlocks.blockHutFarmer = new BlockHutFarmer().registerBlock(registry); - ModBlocks.blockScarecrow = new BlockScarecrow().registerBlock(registry); - ModBlocks.blockHutFisherman = new BlockHutFisherman().registerBlock(registry); - ModBlocks.blockHutGuardTower = new BlockHutGuardTower().registerBlock(registry); - ModBlocks.blockHutLumberjack = new BlockHutLumberjack().registerBlock(registry); - ModBlocks.blockHutMiner = new BlockHutMiner().registerBlock(registry); - ModBlocks.blockHutStonemason = new BlockHutStonemason().registerBlock(registry); - ModBlocks.blockHutTownHall = new BlockHutTownHall().registerBlock(registry); - ModBlocks.blockHutWareHouse = new BlockHutWareHouse().registerBlock(registry); - ModBlocks.blockHutShepherd = new BlockHutShepherd().registerBlock(registry); - ModBlocks.blockHutCowboy = new BlockHutCowboy().registerBlock(registry); - ModBlocks.blockHutSwineHerder = new BlockHutSwineHerder().registerBlock(registry); - ModBlocks.blockHutChickenHerder = new BlockHutChickenHerder().registerBlock(registry); - ModBlocks.blockHutBarracks = new BlockHutBarracks().registerBlock(registry); - ModBlocks.blockHutBarracksTower = new BlockHutBarracksTower().registerBlock(registry); - ModBlocks.blockHutCook = new BlockHutCook().registerBlock(registry); - ModBlocks.blockHutSmeltery = new BlockHutSmeltery().registerBlock(registry); - ModBlocks.blockHutComposter = new BlockHutComposter().registerBlock(registry); - ModBlocks.blockHutLibrary = new BlockHutLibrary().registerBlock(registry); - ModBlocks.blockHutArchery = new BlockHutArchery().registerBlock(registry); - ModBlocks.blockHutSawmill = new BlockHutSawmill().registerBlock(registry); - ModBlocks.blockHutCombatAcademy = new BlockHutCombatAcademy().registerBlock(registry); - ModBlocks.blockHutStoneSmeltery = new BlockHutStoneSmeltery().registerBlock(registry); - ModBlocks.blockHutCrusher = new BlockHutCrusher().registerBlock(registry); - ModBlocks.blockHutSifter = new BlockHutSifter().registerBlock(registry); - ModBlocks.blockHutFlorist = new BlockHutFlorist().registerBlock(registry); - ModBlocks.blockHutEnchanter = new BlockHutEnchanter().registerBlock(registry); - ModBlocks.blockHutUniversity = new BlockHutUniversity().registerBlock(registry); - ModBlocks.blockHutHospital = new BlockHutHospital().registerBlock(registry); - ModBlocks.blockHutSchool = new BlockHutSchool().registerBlock(registry); - ModBlocks.blockHutGlassblower = new BlockHutGlassblower().registerBlock(registry); - ModBlocks.blockHutDyer = new BlockHutDyer().registerBlock(registry); - ModBlocks.blockHutFletcher = new BlockHutFletcher().registerBlock(registry); - ModBlocks.blockHutMechanic = new BlockHutMechanic().registerBlock(registry); - ModBlocks.blockHutTavern = new BlockHutTavern().registerBlock(registry); - ModBlocks.blockHutPlantation = new BlockHutPlantation().registerBlock(registry); - ModBlocks.blockPlantationField = new BlockPlantationField().registerBlock(registry); - ModBlocks.blockHutRabbitHutch = new BlockHutRabbitHutch().registerBlock(registry); - ModBlocks.blockHutConcreteMixer = new BlockHutConcreteMixer().registerBlock(registry); - ModBlocks.blockHutBeekeeper = new BlockHutBeekeeper().registerBlock(registry); - ModBlocks.blockHutMysticalSite = new BlockHutMysticalSite().registerBlock(registry); - ModBlocks.blockHutGraveyard = new BlockHutGraveyard().registerBlock(registry); - ModBlocks.blockHutNetherWorker = new BlockHutNetherWorker().registerBlock(registry); - ModBlocks.blockHutAlchemist = new BlockHutAlchemist().registerBlock(registry); - ModBlocks.blockHutKitchen = new BlockHutKitchen().registerBlock(registry); - - ModBlocks.blockConstructionTape = new BlockConstructionTape().registerBlock(registry); - ModBlocks.blockRack = new BlockMinecoloniesRack().registerBlock(registry); - ModBlocks.blockGrave = new BlockMinecoloniesGrave().registerBlock(registry); - ModBlocks.blockNamedGrave = new BlockMinecoloniesNamedGrave().registerBlock(registry); - ModBlocks.blockWayPoint = new BlockWaypoint().registerBlock(registry); - ModBlocks.blockPostBox = new BlockPostBox().registerBlock(registry); - ModBlocks.blockStash = new BlockStash().registerBlock(registry); - ModBlocks.blockDecorationPlaceholder = new BlockDecorationController().registerBlock(registry); - ModBlocks.blockBarrel = new BlockBarrel().registerBlock(registry); - ModBlocks.blockCompostedDirt = new BlockCompostedDirt().registerBlock(registry); - ModBlocks.blockColonyBanner = new BlockColonyFlagBanner().registerBlock(registry); - ModBlocks.blockColonyWallBanner = new BlockColonyFlagWallBanner().registerBlock(registry); - ModBlocks.blockIronGate = new BlockGate(IRON_GATE, 5f, 6, 8).registerBlock(registry); - ModBlocks.blockWoodenGate = new BlockGate(WOODEN_GATE, 4f, 6, 5).registerBlock(registry); - ModBlocks.farmland = new MinecoloniesFarmland(FARMLAND, false, 15.0).registerBlock(registry); - ModBlocks.floodedFarmland = new MinecoloniesFarmland(FLOODED_FARMLAND, true, 13.0).registerBlock(registry); - - // Could in the future add alternative versions of these crops that can be planted by the player and grow at a slower rate. - ModBlocks.blockBellPepper = new MinecoloniesCropBlock(BELL_PEPPER, ModBlocks.farmland, ModTags.temperateBiomes).registerBlock(registry); - ModBlocks.blockCabbage = new MinecoloniesCropBlock(CABBAGE, ModBlocks.farmland, ModTags.coldBiomes).registerBlock(registry); - ModBlocks.blockChickpea = new MinecoloniesCropBlock(CHICKPEA, ModBlocks.farmland, ModTags.dryBiomes).registerBlock(registry); - ModBlocks.blockDurum = new MinecoloniesCropBlock(DURUM, ModBlocks.farmland, null).registerBlock(registry); - ModBlocks.blockEggplant = new MinecoloniesCropBlock(EGGPLANT, ModBlocks.farmland, null).registerBlock(registry); - ModBlocks.blockGarlic = new MinecoloniesCropBlock(GARLIC, ModBlocks.farmland, null).registerBlock(registry); - ModBlocks.blockOnion = new MinecoloniesCropBlock(ONION, ModBlocks.farmland, null).registerBlock(registry); - ModBlocks.blockSoyBean = new MinecoloniesCropBlock(SOYBEAN, ModBlocks.farmland, ModTags.humidBiomes).registerBlock(registry); - ModBlocks.blockTomato = new MinecoloniesCropBlock(TOMATO, ModBlocks.farmland, ModTags.temperateBiomes).registerBlock(registry); - ModBlocks.blockRice = new MinecoloniesCropBlock(RICE, ModBlocks.floodedFarmland, ModTags.humidBiomes).registerBlock(registry); - - ModBlocks.blockSimpleQuarry = new SimpleQuarry().registerBlock(registry); - ModBlocks.blockMediumQuarry = new MediumQuarry().registerBlock(registry); - //ModBlocks.blockLargeQuarry = new LargeQuarry().registerBlock(registry); - } - - @SubscribeEvent - public static void registerItems(RegisterEvent event) - { - if (event.getRegistryKey().equals(Registries.ITEM)) - { - ModBlocksInitializer.registerBlockItem(event.getRegistry(Registries.ITEM)); - } - } - - /** - * Initializes the registry with the relevant item produced by the relevant blocks. - * - * @param registry The item registry to add the items too. - */ - public static void registerBlockItem(final Registry registry) - { - ModBlocks.blockHutBaker.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutBlacksmith.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutBuilder.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutHome.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutDeliveryman.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutFarmer.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockScarecrow.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutFisherman.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutGuardTower.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutLumberjack.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutMiner.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutStonemason.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutTownHall.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutWareHouse.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutShepherd.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutCowboy.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutSwineHerder.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutChickenHerder.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutBarracksTower.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutBarracks.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutCook.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutSmeltery.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutComposter.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutLibrary.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutArchery.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutCombatAcademy.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutSawmill.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutStoneSmeltery.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutCrusher.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutSifter.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutFlorist.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutEnchanter.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutUniversity.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutHospital.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutSchool.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutGlassblower.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutDyer.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutFletcher.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutMechanic.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutTavern.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutPlantation.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockPlantationField.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutRabbitHutch.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutConcreteMixer.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutBeekeeper.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutMysticalSite.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutGraveyard.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutNetherWorker.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutAlchemist.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockHutKitchen.registerBlockItem(registry, new Item.Properties()); - - ModBlocks.blockConstructionTape.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockRack.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockGrave.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockNamedGrave.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockWayPoint.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockBarrel.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockPostBox.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockStash.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockDecorationPlaceholder.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockCompostedDirt.registerBlockItem(registry, new Item.Properties()); - ModBlocks.farmland.registerBlockItem(registry, new Item.Properties()); - ModBlocks.floodedFarmland.registerBlockItem(registry, new Item.Properties()); - - ModBlocks.blockBellPepper.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockCabbage.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockChickpea.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockDurum.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockEggplant.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockGarlic.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockOnion.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockSoyBean.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockTomato.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockRice.registerBlockItem(registry, new Item.Properties()); - - ModBlocks.blockSimpleQuarry.registerBlockItem(registry, new Item.Properties()); - ModBlocks.blockMediumQuarry.registerBlockItem(registry, new Item.Properties()); - //ModBlocks.blockLargeQuarry.registerBlockItem(registry, new Item.Properties()); - } -} diff --git a/src/main/java/com/minecolonies/apiimp/initializer/ModItemsInitializer.java b/src/main/java/com/minecolonies/apiimp/initializer/ModItemsInitializer.java deleted file mode 100755 index 55d48aafadf..00000000000 --- a/src/main/java/com/minecolonies/apiimp/initializer/ModItemsInitializer.java +++ /dev/null @@ -1,446 +0,0 @@ -package com.minecolonies.apiimp.initializer; - -import com.minecolonies.api.blocks.ModBlocks; -import com.minecolonies.api.colony.jobs.ModJobs; -import com.minecolonies.api.entity.ModEntities; -import com.minecolonies.api.items.ModItems; -import com.minecolonies.api.util.constant.Constants; -import com.minecolonies.core.items.*; -import net.minecraft.Util; -import net.minecraft.core.Holder; -import net.minecraft.core.Registry; -import net.minecraft.core.registries.Registries; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.sounds.SoundEvents; -import net.minecraft.world.food.FoodProperties; -import net.minecraft.world.item.ArmorItem; -import net.minecraft.world.item.ArmorMaterial; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.Items; -import net.minecraft.world.item.crafting.Ingredient; -import net.neoforged.bus.api.SubscribeEvent; -import net.neoforged.fml.common.EventBusSubscriber; -import net.neoforged.neoforge.common.DeferredSpawnEggItem; -import net.neoforged.neoforge.registries.DeferredRegister; -import net.neoforged.neoforge.registries.RegisterEvent; - -import java.util.EnumMap; -import java.util.List; - -import static com.minecolonies.api.blocks.decorative.AbstractBlockGate.IRON_GATE; -import static com.minecolonies.api.blocks.decorative.AbstractBlockGate.WOODEN_GATE; -import static com.minecolonies.api.util.constant.Constants.CHIEFSWORD_NAME; -import static com.minecolonies.api.util.constant.Constants.SCIMITAR_NAME; - -@EventBusSubscriber(modid = Constants.MOD_ID, bus = EventBusSubscriber.Bus.MOD) -public final class ModItemsInitializer -{ - public final static DeferredRegister DEFERRED_REGISTER = DeferredRegister.create(Registries.ARMOR_MATERIAL, Constants.MOD_ID); - - /** - * Spawn egg colors. - */ - private static final int PRIMARY_COLOR_BARBARIAN = 5; - private static final int SECONDARY_COLOR_BARBARIAN = 700; - private static final int PRIMARY_COLOR_PIRATE = 7; - private static final int SECONDARY_COLOR_PIRATE = 600; - private static final int PRIMARY_COLOR_MERC = 8; - private static final int SECONDARY_COLOR_MERC = 300; - private static final int PRIMARY_COLOR_EG = 10; - private static final int SECONDARY_COLOR_EG = 400; - - private ModItemsInitializer() - { - throw new IllegalStateException("Tried to initialize: ModItemsInitializer but this is a Utility class."); - } - - @SubscribeEvent - public static void registerItems(RegisterEvent event) - { - if (event.getRegistryKey().equals(Registries.ITEM)) - { - ModItemsInitializer.init(event.getRegistry(Registries.ITEM)); - } - } - - /** - * Initates all the blocks. At the correct time. - * - * @param registry the registry. - */ - @SuppressWarnings("PMD.ExcessiveMethodLength") - public static void init(final Registry registry) - { - ModItems.scepterLumberjack = new ItemScepterLumberjack(new Item.Properties()); - ModItems.supplyChest = new ItemSupplyChestDeployer(new Item.Properties()); - ModItems.permTool = new ItemScepterPermission(new Item.Properties()); - ModItems.scepterGuard = new ItemScepterGuard(new Item.Properties()); - ModItems.bannerRallyGuards = new ItemBannerRallyGuards(new Item.Properties()); - ModItems.supplyCamp = new ItemSupplyCampDeployer(new Item.Properties()); - ModItems.ancientTome = new ItemAncientTome(new Item.Properties()); - ModItems.chiefSword = new ItemChiefSword(new Item.Properties()); - ModItems.scimitar = new ItemIronScimitar(new Item.Properties()); - ModItems.clipboard = new ItemClipboard(new Item.Properties()); - ModItems.compost = new ItemCompost(new Item.Properties()); - ModItems.resourceScroll = new ItemResourceScroll(new Item.Properties()); - ModItems.pharaoscepter = new ItemPharaoScepter(new Item.Properties()); - ModItems.firearrow = new ItemFireArrow(new Item.Properties()); - ModItems.scepterBeekeeper = new ItemScepterBeekeeper(new Item.Properties()); - ModItems.mistletoe = new ItemMistletoe(new Item.Properties()); - ModItems.spear = new ItemSpear(new Item.Properties()); - ModItems.questLog = new ItemQuestLog(new Item.Properties()); - - ModItems.breadDough = new ItemBreadDough(new Item.Properties()); - ModItems.cookieDough = new ItemCookieDough(new Item.Properties()); - ModItems.cakeBatter = new ItemCakeBatter(new Item.Properties()); - ModItems.rawPumpkinPie = new ItemRawPumpkinPie(new Item.Properties()); - - ModItems.milkyBread = new ItemMilkyBread(new Item.Properties()); - ModItems.sugaryBread = new ItemSugaryBread(new Item.Properties()); - ModItems.goldenBread = new ItemGoldenBread(new Item.Properties()); - ModItems.chorusBread = new ItemChorusBread(new Item.Properties()); - - ModItems.adventureToken = new ItemAdventureToken(new Item.Properties()); - - ModItems.scrollColonyTP = new ItemScrollColonyTP(new Item.Properties().stacksTo(16)); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "scroll_tp"), ModItems.scrollColonyTP); - - ModItems.scrollColonyAreaTP = new ItemScrollColonyAreaTP(new Item.Properties().stacksTo(16)); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "scroll_area_tp"), ModItems.scrollColonyAreaTP); - - ModItems.scrollBuff = new ItemScrollBuff(new Item.Properties().stacksTo(16)); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "scroll_buff"), ModItems.scrollBuff); - - ModItems.scrollGuardHelp = new ItemScrollGuardHelp(new Item.Properties().stacksTo(16)); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "scroll_guard_help"), ModItems.scrollGuardHelp); - - ModItems.scrollHighLight = new ItemScrollHighlight(new Item.Properties().stacksTo(16)); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "scroll_highlight"), ModItems.scrollHighLight); - - ModItems.santaHat = new ItemSantaHead("santa_hat", SANTA_HAT, ArmorItem.Type.HELMET, new Item.Properties()); - ModItems.irongate = new ItemGate(IRON_GATE, ModBlocks.blockIronGate, new Item.Properties()); - ModItems.woodgate = new ItemGate(WOODEN_GATE, ModBlocks.blockWoodenGate, new Item.Properties()); - - ModItems.flagBanner = new ItemColonyFlagBanner("colony_banner", new Item.Properties()); - ModItems.pirateHelmet_1 = new ItemPirateGear("pirate_hat", PIRATE_ARMOR_1, ArmorItem.Type.HELMET, new Item.Properties()); - ModItems.pirateChest_1 = new ItemPirateGear("pirate_top", PIRATE_ARMOR_1, ArmorItem.Type.CHESTPLATE, new Item.Properties()); - ModItems.pirateLegs_1 = new ItemPirateGear("pirate_leggins", PIRATE_ARMOR_1, ArmorItem.Type.LEGGINGS, new Item.Properties()); - ModItems.pirateBoots_1 = new ItemPirateGear("pirate_boots", PIRATE_ARMOR_1, ArmorItem.Type.BOOTS, new Item.Properties()); - - ModItems.pirateHelmet_2 = new ItemPirateGear("pirate_cap", PIRATE_ARMOR_2, ArmorItem.Type.HELMET, new Item.Properties()); - ModItems.pirateChest_2 = new ItemPirateGear("pirate_chest", PIRATE_ARMOR_2, ArmorItem.Type.CHESTPLATE, new Item.Properties()); - ModItems.pirateLegs_2 = new ItemPirateGear("pirate_legs", PIRATE_ARMOR_2, ArmorItem.Type.LEGGINGS, new Item.Properties()); - ModItems.pirateBoots_2 = new ItemPirateGear("pirate_shoes", PIRATE_ARMOR_2, ArmorItem.Type.BOOTS, new Item.Properties()); - - ModItems.plateArmorHelmet = new ItemPlateArmor("plate_armor_helmet", PLATE_ARMOR, ArmorItem.Type.HELMET, new Item.Properties()); - ModItems.plateArmorChest = new ItemPlateArmor("plate_armor_chest", PLATE_ARMOR, ArmorItem.Type.CHESTPLATE, new Item.Properties()); - ModItems.plateArmorLegs = new ItemPlateArmor("plate_armor_legs", PLATE_ARMOR, ArmorItem.Type.LEGGINGS, new Item.Properties()); - ModItems.plateArmorBoots = new ItemPlateArmor("plate_armor_boots", PLATE_ARMOR, ArmorItem.Type.BOOTS, new Item.Properties()); - - ModItems.sifterMeshString = new ItemSifterMesh("sifter_mesh_string", new Item.Properties().durability(500).setNoRepair()); - ModItems.sifterMeshFlint = new ItemSifterMesh("sifter_mesh_flint", new Item.Properties().durability(1000).setNoRepair()); - ModItems.sifterMeshIron = new ItemSifterMesh("sifter_mesh_iron", new Item.Properties().durability(1500).setNoRepair()); - ModItems.sifterMeshDiamond = new ItemSifterMesh("sifter_mesh_diamond", new Item.Properties().durability(2000).setNoRepair()); - - ModItems.magicpotion = new ItemMagicPotion("magicpotion", new Item.Properties()); - ModItems.buildGoggles = new ItemBuildGoggles("build_goggles", new Item.Properties()); - ModItems.scanAnalyzer = new ItemScanAnalyzer("scan_analyzer", new Item.Properties()); - - // Tier 1 Food Items - ModItems.cheddar_cheese = new ItemFood((new Item.Properties()).food(new FoodProperties.Builder().nutrition(4).saturationModifier(0.6F).build()), ModJobs.CHEF_ID.getPath(), 1); - ModItems.feta_cheese = new ItemFood((new Item.Properties()).food(new FoodProperties.Builder().nutrition(4).saturationModifier(0.6F).build()), ModJobs.CHEF_ID.getPath(), 1); - ModItems.cooked_rice = new ItemFood((new Item.Properties()).food(new FoodProperties.Builder().nutrition(4).saturationModifier(0.6F).usingConvertsTo(Items.BOWL).build()), ModJobs.CHEF_ID.getPath(), 1); - ModItems.tofu = new ItemFood((new Item.Properties()).food(new FoodProperties.Builder().nutrition(4).saturationModifier(0.6F).build()), ModJobs.CHEF_ID.getPath(), 1); - ModItems.flatbread = new ItemFood((new Item.Properties()).food(new FoodProperties.Builder().nutrition(4).saturationModifier(0.6F).build()), ModJobs.BAKER_ID.getPath(), 1); - - // Tier 2 Food Items - ModItems.manchet_bread = new ItemFood((new Item.Properties()).food(new FoodProperties.Builder().nutrition(6).saturationModifier(1.0F).build()), ModJobs.BAKER_ID.getPath(), 2); - ModItems.lembas_scone = new ItemFood((new Item.Properties()).food(new FoodProperties.Builder().nutrition(6).saturationModifier(1.0F).build()), ModJobs.BAKER_ID.getPath(), 2); - ModItems.muffin = new ItemFood((new Item.Properties()).food(new FoodProperties.Builder().nutrition(6).saturationModifier(1.0F).build()), ModJobs.BAKER_ID.getPath(), 2); - ModItems.pottage = new ItemFood((new Item.Properties()).food(new FoodProperties.Builder().nutrition(6).saturationModifier(1.0F).usingConvertsTo(Items.BOWL).build()), ModJobs.CHEF_ID.getPath(), 2); - ModItems.pasta_plain = new ItemFood((new Item.Properties()).food(new FoodProperties.Builder().nutrition(6).saturationModifier(1.0F).usingConvertsTo(Items.BOWL).build()), ModJobs.CHEF_ID.getPath(), 2); - - // Tier 3 Food items - ModItems.hand_pie = new ItemFood((new Item.Properties()).food(new FoodProperties.Builder().nutrition(8).saturationModifier(1.2F).build()), ModJobs.CHEF_ID.getPath(), 3); - - // Cold Biomes - // Tier 2 - ModItems.cabochis = new ItemFood((new Item.Properties()).food(new FoodProperties.Builder().nutrition(6).saturationModifier(1.0F).usingConvertsTo(Items.BOWL).build()), ModJobs.CHEF_ID.getPath(), 2); - // Tier 3 - ModItems.lamb_stew = new ItemFood((new Item.Properties()).food(new FoodProperties.Builder().nutrition(8).saturationModifier(1.2F).usingConvertsTo(Items.BOWL).build()), ModJobs.CHEF_ID.getPath(), 3); - - // Hot Humid Biomes - // Tier 2 - ModItems.rice_ball = new ItemFood((new Item.Properties()).food(new FoodProperties.Builder().nutrition(6).saturationModifier(1.0F).build()), ModJobs.CHEF_ID.getPath(), 2); - // Tier 3 - ModItems.sushi_roll = new ItemFood((new Item.Properties()).food(new FoodProperties.Builder().nutrition(8).saturationModifier(1.2F).build()), ModJobs.CHEF_ID.getPath(), 3); - - // Temperate Biomes - // Tier 2 - ModItems.pasta_tomato = new ItemFood((new Item.Properties()).food(new FoodProperties.Builder().nutrition(6).saturationModifier(1.0F).usingConvertsTo(Items.BOWL).build()), ModJobs.CHEF_ID.getPath(), 2); - // Tier 3 - ModItems.eggplant_dolma = new ItemFood((new Item.Properties()).food(new FoodProperties.Builder().nutrition(8).saturationModifier(1.2F).build()), ModJobs.CHEF_ID.getPath(), 3); - ModItems.stuffed_pita = new ItemFood((new Item.Properties()).food(new FoodProperties.Builder().nutrition(8).saturationModifier(1.2F).build()), ModJobs.CHEF_ID.getPath(), 3); - - // Hot Dry Biomes - // Tier 2 - ModItems.pepper_hummus = new ItemFood((new Item.Properties()).food(new FoodProperties.Builder().nutrition(6).saturationModifier(1.0F).build()), ModJobs.CHEF_ID.getPath(), 2); - // Tier 3 - ModItems.pita_hummus = new ItemFood((new Item.Properties()).food(new FoodProperties.Builder().nutrition(8).saturationModifier(1.2F).build()), ModJobs.CHEF_ID.getPath(), 3); - - // Require trading - // Tier 2 - ModItems.congee = new ItemFood((new Item.Properties()).food(new FoodProperties.Builder().nutrition(6).saturationModifier(1.0F).usingConvertsTo(Items.BOWL).build()), ModJobs.CHEF_ID.getPath(), 2); - // Tier 3 - ModItems.stew_trencher = new ItemFood((new Item.Properties()).food(new FoodProperties.Builder().nutrition(8).saturationModifier(1.2F).build()), ModJobs.CHEF_ID.getPath(), 3); - ModItems.stuffed_pepper = new ItemFood((new Item.Properties()).food(new FoodProperties.Builder().nutrition(8).saturationModifier(1.2F).build()), ModJobs.CHEF_ID.getPath(), 3); - - // Just dough - ModItems.muffin_dough = new Item((new Item.Properties())); - ModItems.manchet_dough = new Item((new Item.Properties())); - ModItems.raw_noodle = new Item((new Item.Properties())); - ModItems.butter = new Item((new Item.Properties())); - - ModItems.large_empty_bottle = new ItemLargeBottle((new Item.Properties())); - ModItems.large_milk_bottle = new ItemLargeBottle((new Item.Properties().craftRemainder(ModItems.large_empty_bottle))); - ModItems.large_water_bottle = new ItemLargeBottle((new Item.Properties().craftRemainder(ModItems.large_empty_bottle))); - ModItems.large_soy_milk_bottle = new ItemLargeBottle((new Item.Properties().craftRemainder(ModItems.large_empty_bottle))); - - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "supplychestdeployer"), ModItems.supplyChest); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "scan_analyzer"), ModItems.scanAnalyzer); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "scepterpermission"), ModItems.permTool); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "scepterguard"), ModItems.scepterGuard); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "banner_rally_guards"), ModItems.bannerRallyGuards); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "supplycampdeployer"), ModItems.supplyCamp); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "ancienttome"), ModItems.ancientTome); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, CHIEFSWORD_NAME), ModItems.chiefSword); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "clipboard"), ModItems.clipboard); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "compost"), ModItems.compost); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "resourcescroll"), ModItems.resourceScroll); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, SCIMITAR_NAME), ModItems.scimitar); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "scepterlumberjack"), ModItems.scepterLumberjack); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "pharaoscepter"), ModItems.pharaoscepter); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "firearrow"), ModItems.firearrow); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "scepterbeekeeper"), ModItems.scepterBeekeeper); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "mistletoe"), ModItems.mistletoe); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "spear"), ModItems.spear); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "questlog"), ModItems.questLog); - - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "bread_dough"), ModItems.breadDough); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "cookie_dough"), ModItems.cookieDough); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "cake_batter"), ModItems.cakeBatter); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "raw_pumpkin_pie"), ModItems.rawPumpkinPie); - - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "milky_bread"), ModItems.milkyBread); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "sugary_bread"), ModItems.sugaryBread); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "golden_bread"), ModItems.goldenBread); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "chorus_bread"), ModItems.chorusBread); - - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "adventure_token"), ModItems.adventureToken); - - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "pirate_hat"), ModItems.pirateHelmet_1); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "pirate_top"), ModItems.pirateChest_1); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "pirate_leggins"), ModItems.pirateLegs_1); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "pirate_boots"), ModItems.pirateBoots_1); - - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "pirate_cap"), ModItems.pirateHelmet_2); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "pirate_chest"), ModItems.pirateChest_2); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "pirate_legs"), ModItems.pirateLegs_2); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "pirate_shoes"), ModItems.pirateBoots_2); - - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "plate_armor_helmet"), ModItems.plateArmorHelmet); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "plate_armor_chest"), ModItems.plateArmorChest); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "plate_armor_legs"), ModItems.plateArmorLegs); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "plate_armor_boots"), ModItems.plateArmorBoots); - - - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "santa_hat"), ModItems.santaHat); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, IRON_GATE), ModItems.irongate); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, WOODEN_GATE), ModItems.woodgate); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "colony_banner"), ModItems.flagBanner); - - - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "sifter_mesh_string"), ModItems.sifterMeshString); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "sifter_mesh_flint"), ModItems.sifterMeshFlint); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "sifter_mesh_iron"), ModItems.sifterMeshIron); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "sifter_mesh_diamond"), ModItems.sifterMeshDiamond); - - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "magicpotion"), ModItems.magicpotion); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "build_goggles"), ModItems.buildGoggles); - - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "butter"), ModItems.butter); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "cabochis"), ModItems.cabochis); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "cheddar_cheese"), ModItems.cheddar_cheese); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "congee"), ModItems.congee); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "cooked_rice"), ModItems.cooked_rice); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "eggplant_dolma"), ModItems.eggplant_dolma); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "feta_cheese"), ModItems.feta_cheese); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "flatbread"), ModItems.flatbread); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "hand_pie"), ModItems.hand_pie); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "lamb_stew"), ModItems.lamb_stew); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "lembas_scone"), ModItems.lembas_scone); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "manchet_bread"), ModItems.manchet_bread); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "manchet_dough"), ModItems.manchet_dough); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "muffin"), ModItems.muffin); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "muffin_dough"), ModItems.muffin_dough); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "pasta_plain"), ModItems.pasta_plain); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "pasta_tomato"), ModItems.pasta_tomato); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "pepper_hummus"), ModItems.pepper_hummus); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "pita_hummus"), ModItems.pita_hummus); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "pottage"), ModItems.pottage); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "raw_noodle"), ModItems.raw_noodle); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "rice_ball"), ModItems.rice_ball); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "stew_trencher"), ModItems.stew_trencher); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "stuffed_pepper"), ModItems.stuffed_pepper); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "stuffed_pita"), ModItems.stuffed_pita); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "sushi_roll"), ModItems.sushi_roll); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "tofu"), ModItems.tofu); - - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "large_empty_bottle"), ModItems.large_empty_bottle); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "large_water_bottle"), ModItems.large_water_bottle); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "large_milk_bottle"), ModItems.large_milk_bottle); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "large_soy_milk_bottle"), ModItems.large_soy_milk_bottle); - - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "barbarianegg"), new DeferredSpawnEggItem(() -> ModEntities.BARBARIAN, - PRIMARY_COLOR_BARBARIAN, - SECONDARY_COLOR_BARBARIAN, - (new Item.Properties()))); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "barbarcheregg"), new DeferredSpawnEggItem(() -> ModEntities.ARCHERBARBARIAN, - PRIMARY_COLOR_BARBARIAN, - SECONDARY_COLOR_BARBARIAN, - (new Item.Properties()))); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "barbchiefegg"), new DeferredSpawnEggItem(() -> ModEntities.CHIEFBARBARIAN, - PRIMARY_COLOR_BARBARIAN, - SECONDARY_COLOR_BARBARIAN, - (new Item.Properties()))); - - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "pirateegg"), new DeferredSpawnEggItem(() -> ModEntities.PIRATE, - PRIMARY_COLOR_PIRATE, - SECONDARY_COLOR_PIRATE, - (new Item.Properties()))); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "piratearcheregg"), new DeferredSpawnEggItem(() -> ModEntities.ARCHERPIRATE, - PRIMARY_COLOR_PIRATE, - SECONDARY_COLOR_PIRATE, - (new Item.Properties()))); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "piratecaptainegg"), new DeferredSpawnEggItem(() -> ModEntities.CHIEFPIRATE, - PRIMARY_COLOR_PIRATE, - SECONDARY_COLOR_PIRATE, - (new Item.Properties()))); - - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "mummyegg"), new DeferredSpawnEggItem(() -> ModEntities.MUMMY, PRIMARY_COLOR_EG, SECONDARY_COLOR_EG, (new Item.Properties()))); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "mummyarcheregg"), new DeferredSpawnEggItem(() -> ModEntities.ARCHERMUMMY, - PRIMARY_COLOR_EG, - SECONDARY_COLOR_EG, - (new Item.Properties()))); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "pharaoegg"), new DeferredSpawnEggItem(() -> ModEntities.PHARAO, PRIMARY_COLOR_EG, SECONDARY_COLOR_EG, (new Item.Properties()))); - - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "shieldmaidenegg"), new DeferredSpawnEggItem(() -> ModEntities.SHIELDMAIDEN, - PRIMARY_COLOR_EG, - SECONDARY_COLOR_EG, - (new Item.Properties()))); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "norsemenarcheregg"), new DeferredSpawnEggItem(() -> ModEntities.NORSEMEN_ARCHER, - PRIMARY_COLOR_EG, - SECONDARY_COLOR_EG, - (new Item.Properties()))); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "norsemenchiefegg"), new DeferredSpawnEggItem(() -> ModEntities.NORSEMEN_CHIEF, - PRIMARY_COLOR_EG, - SECONDARY_COLOR_EG, - (new Item.Properties()))); - - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "amazonegg"), new DeferredSpawnEggItem(() -> ModEntities.AMAZON, PRIMARY_COLOR_EG, SECONDARY_COLOR_EG, (new Item.Properties()))); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "amazonspearmanegg"), new DeferredSpawnEggItem(() -> ModEntities.AMAZONSPEARMAN, - PRIMARY_COLOR_EG, - SECONDARY_COLOR_EG, - new Item.Properties())); - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "amazonchiefegg"), new DeferredSpawnEggItem(() -> ModEntities.AMAZONCHIEF, - PRIMARY_COLOR_EG, - SECONDARY_COLOR_EG, - (new Item.Properties()))); - - Registry.register(registry, new ResourceLocation(Constants.MOD_ID, "mercegg"), new DeferredSpawnEggItem(() -> ModEntities.MERCENARY, - PRIMARY_COLOR_MERC, - SECONDARY_COLOR_MERC, - (new Item.Properties()))); - } - - public static final Holder SANTA_HAT = DEFERRED_REGISTER.register("santa_hat", () -> new ArmorMaterial( - // Determines the defense value of this armor material, depending on what armor piece it is. - Util.make(new EnumMap<>(ArmorItem.Type.class), map -> { - map.put(ArmorItem.Type.BOOTS, 0); - map.put(ArmorItem.Type.LEGGINGS, 0); - map.put(ArmorItem.Type.CHESTPLATE, 0); - map.put(ArmorItem.Type.HELMET, 0); - }), - 500, - SoundEvents.ARMOR_EQUIP_LEATHER, - () -> Ingredient.EMPTY, - List.of(), - 0, - 0 - )); - - public static final Holder PLATE_ARMOR = DEFERRED_REGISTER.register("plate_armor", () -> new ArmorMaterial( - // Determines the defense value of this armor material, depending on what armor piece it is. - Util.make(new EnumMap<>(ArmorItem.Type.class), map -> { - map.put(ArmorItem.Type.BOOTS, 3); - map.put(ArmorItem.Type.LEGGINGS, 6); - map.put(ArmorItem.Type.CHESTPLATE, 8); - map.put(ArmorItem.Type.HELMET, 3); - }), - 37, - SoundEvents.ARMOR_EQUIP_IRON, - () -> Ingredient.of(Items.IRON_INGOT), - List.of(), - 0, - 0 - )); - - public static final Holder GOGGLES = DEFERRED_REGISTER.register("build_goggles", () -> new ArmorMaterial( - // Determines the defense value of this armor material, depending on what armor piece it is. - Util.make(new EnumMap<>(ArmorItem.Type.class), map -> { - map.put(ArmorItem.Type.BOOTS, 0); - map.put(ArmorItem.Type.LEGGINGS, 0); - map.put(ArmorItem.Type.CHESTPLATE, 0); - map.put(ArmorItem.Type.HELMET, 0); - }), - 20, - SoundEvents.ARMOR_EQUIP_LEATHER, - () -> Ingredient.EMPTY, - List.of(), - 0, - 0 - )); - - public static final Holder PIRATE_ARMOR_1 = DEFERRED_REGISTER.register("pirate_armor_1", () -> new ArmorMaterial( - // Determines the defense value of this armor material, depending on what armor piece it is. - Util.make(new EnumMap<>(ArmorItem.Type.class), map -> { - map.put(ArmorItem.Type.BOOTS, 2); - map.put(ArmorItem.Type.LEGGINGS, 5); - map.put(ArmorItem.Type.CHESTPLATE, 6); - map.put(ArmorItem.Type.HELMET, 2); - }), - 5, - SoundEvents.ARMOR_EQUIP_LEATHER, - () -> Ingredient.of(Items.DIAMOND), - List.of(), - 0, - 0 - )); - - public static final Holder PIRATE_ARMOR_2 = DEFERRED_REGISTER.register("pirate_armor_2", () -> new ArmorMaterial( - // Determines the defense value of this armor material, depending on what armor piece it is. - Util.make(new EnumMap<>(ArmorItem.Type.class), map -> { - map.put(ArmorItem.Type.BOOTS, 3); - map.put(ArmorItem.Type.LEGGINGS, 6); - map.put(ArmorItem.Type.CHESTPLATE, 8); - map.put(ArmorItem.Type.HELMET, 3); - }), - 5, - SoundEvents.ARMOR_EQUIP_LEATHER, - () -> Ingredient.of(Items.DIAMOND), - List.of(), - 2, - 0 - )); - -} diff --git a/src/main/java/com/minecolonies/apiimp/initializer/TileEntityInitializer.java b/src/main/java/com/minecolonies/apiimp/initializer/TileEntityInitializer.java index 09d0c45a0b9..b8d036ade99 100755 --- a/src/main/java/com/minecolonies/apiimp/initializer/TileEntityInitializer.java +++ b/src/main/java/com/minecolonies/apiimp/initializer/TileEntityInitializer.java @@ -5,42 +5,55 @@ import com.minecolonies.api.util.constant.Constants; import com.minecolonies.core.tileentities.*; import net.minecraft.core.registries.Registries; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.entity.BlockEntityType.BlockEntitySupplier; +import net.neoforged.neoforge.registries.DeferredBlock; +import net.neoforged.neoforge.registries.DeferredHolder; import net.neoforged.neoforge.registries.DeferredRegister; +import java.util.List; + public class TileEntityInitializer { public static final DeferredRegister> BLOCK_ENTITIES = DeferredRegister.create(Registries.BLOCK_ENTITY_TYPE, Constants.MOD_ID); static { - MinecoloniesTileEntities.SCARECROW = BLOCK_ENTITIES.register("scarecrow", () -> BlockEntityType.Builder.of(TileEntityScarecrow::new, ModBlocks.blockScarecrow).build(null)); - - MinecoloniesTileEntities.PLANTATION_FIELD = BLOCK_ENTITIES.register("plantationfield", () -> BlockEntityType.Builder.of(TileEntityPlantationField::new, ModBlocks.blockPlantationField).build(null)); - - MinecoloniesTileEntities.BARREL = BLOCK_ENTITIES.register("barrel", () -> BlockEntityType.Builder.of(TileEntityBarrel::new, ModBlocks.blockBarrel).build(null)); - - MinecoloniesTileEntities.BUILDING = BLOCK_ENTITIES.register("colonybuilding", () -> BlockEntityType.Builder.of(TileEntityColonyBuilding::new, ModBlocks.getHuts()).build(null)); - - MinecoloniesTileEntities.DECO_CONTROLLER = BLOCK_ENTITIES.register("decorationcontroller", () -> BlockEntityType.Builder - .of(TileEntityDecorationController::new, ModBlocks.blockDecorationPlaceholder) - .build(null)); - - MinecoloniesTileEntities.RACK = BLOCK_ENTITIES.register("rack", () -> BlockEntityType.Builder.of(TileEntityRack::new, ModBlocks.blockRack).build(null)); - - MinecoloniesTileEntities.GRAVE = BLOCK_ENTITIES.register("grave", () -> BlockEntityType.Builder.of(TileEntityGrave::new, ModBlocks.blockGrave).build(null)); - - MinecoloniesTileEntities.NAMED_GRAVE = BLOCK_ENTITIES.register("namedgrave", () -> BlockEntityType.Builder.of(TileEntityNamedGrave::new, ModBlocks.blockNamedGrave).build(null)); - - MinecoloniesTileEntities.WAREHOUSE = BLOCK_ENTITIES.register("warehouse", () -> BlockEntityType.Builder.of(TileEntityWareHouse::new, ModBlocks.blockHutWareHouse).build(null)); - - MinecoloniesTileEntities.COMPOSTED_DIRT = BLOCK_ENTITIES.register("composteddirt", () -> BlockEntityType.Builder.of(TileEntityCompostedDirt::new, ModBlocks.blockCompostedDirt) - .build(null)); - - MinecoloniesTileEntities.ENCHANTER = BLOCK_ENTITIES.register("enchanter", () -> BlockEntityType.Builder.of(TileEntityEnchanter::new, ModBlocks.blockHutEnchanter).build(null)); + MinecoloniesTileEntities.SCARECROW = simple("scarecrow", TileEntityScarecrow::new, ModBlocks.blockScarecrow); + MinecoloniesTileEntities.PLANTATION_FIELD = simple("plantationfield", TileEntityPlantationField::new, ModBlocks.blockPlantationField); + MinecoloniesTileEntities.BARREL = simple("barrel", TileEntityBarrel::new, ModBlocks.blockBarrel); + MinecoloniesTileEntities.BUILDING = list("colonybuilding", TileEntityColonyBuilding::new, ModBlocks.getHuts()); + MinecoloniesTileEntities.DECO_CONTROLLER = simple("decorationcontroller", TileEntityDecorationController::new, ModBlocks.blockDecorationPlaceholder); + MinecoloniesTileEntities.RACK = simple("rack", TileEntityRack::new, ModBlocks.blockRack); + MinecoloniesTileEntities.GRAVE = simple("grave", TileEntityGrave::new, ModBlocks.blockGrave); + MinecoloniesTileEntities.NAMED_GRAVE = simple("namedgrave", TileEntityNamedGrave::new, ModBlocks.blockNamedGrave); + MinecoloniesTileEntities.WAREHOUSE = simple("warehouse", TileEntityWareHouse::new, ModBlocks.blockHutWareHouse); + MinecoloniesTileEntities.COMPOSTED_DIRT = simple("composteddirt", TileEntityCompostedDirt::new, ModBlocks.blockCompostedDirt); + MinecoloniesTileEntities.ENCHANTER = simple("enchanter", TileEntityEnchanter::new, ModBlocks.blockHutEnchanter); + MinecoloniesTileEntities.STASH = simple("stash", TileEntityStash::new, ModBlocks.blockStash); + MinecoloniesTileEntities.COLONY_FLAG = list("colony_flag", TileEntityColonyFlag::new, List.of(ModBlocks.blockColonyBanner, ModBlocks.blockColonyWallBanner)); + } - MinecoloniesTileEntities.STASH = BLOCK_ENTITIES.register("stash", () -> BlockEntityType.Builder.of(TileEntityStash::new, ModBlocks.blockStash).build(null)); + private static DeferredHolder, BlockEntityType> simple(final String id, + final BlockEntitySupplier factory, + final DeferredBlock block) + { + return BLOCK_ENTITIES.register(id, () -> BlockEntityType.Builder.of(factory, block.get()).build(null)); + } - MinecoloniesTileEntities.COLONY_FLAG = BLOCK_ENTITIES.register("colony_flag", () -> BlockEntityType.Builder.of(TileEntityColonyFlag::new, ModBlocks.blockColonyBanner, ModBlocks.blockColonyWallBanner).build(null)); + private static DeferredHolder, BlockEntityType> list(final String id, + final BlockEntitySupplier factory, + final List> blocks) + { + return BLOCK_ENTITIES.register(id, () -> { + final Block[] dereferenced = new Block[blocks.size()]; + for (int i = 0; i < dereferenced.length; i++) + { + dereferenced[i] = blocks.get(i).get(); + } + return BlockEntityType.Builder.of(factory, dereferenced).build(null); + }); } } diff --git a/src/main/java/com/minecolonies/core/MineColonies.java b/src/main/java/com/minecolonies/core/MineColonies.java index 029a27fb832..02a7beebbf8 100755 --- a/src/main/java/com/minecolonies/core/MineColonies.java +++ b/src/main/java/com/minecolonies/core/MineColonies.java @@ -5,6 +5,7 @@ import com.ldtteam.structurize.storage.SurvivalBlueprintHandlers; import com.minecolonies.api.MinecoloniesAPIProxy; import com.minecolonies.api.advancements.AdvancementTriggers; +import com.minecolonies.api.blocks.ModBlocks; import com.minecolonies.api.configuration.ClientConfiguration; import com.minecolonies.api.configuration.CommonConfiguration; import com.minecolonies.api.configuration.ServerConfiguration; @@ -13,6 +14,7 @@ import com.minecolonies.api.entity.citizen.AbstractEntityCitizen; import com.minecolonies.api.entity.mobs.AbstractEntityRaiderMob; import com.minecolonies.api.entity.mobs.RaiderMobUtils; +import com.minecolonies.api.items.ModArmorMaterials; import com.minecolonies.api.items.ModBannerPatterns; import com.minecolonies.api.items.ModItems; import com.minecolonies.api.items.ModTags; @@ -95,6 +97,9 @@ public MineColonies(final FMLModContainer modContainer, final Dist dist) LanguageHandler.loadLangPath("assets/minecolonies/lang/%s.json"); config = new Configurations<>(modContainer, modBus, ClientConfiguration::new, ServerConfiguration::new, CommonConfiguration::new); + ModBlocks.REGISTRY.register(modBus); + ModArmorMaterials.REGISTRY.register(modBus); + ModItems.REGISTRY.register(modBus); TileEntityInitializer.BLOCK_ENTITIES.register(modBus); AdvancementTriggers.DEFERRED_REGISTER.register(modBus); ModIngredientTypeInitializer.DEFERRED_REGISTER.register(modBus); @@ -117,7 +122,6 @@ public MineColonies(final FMLModContainer modContainer, final Dist dist) ModLootConditions.DEFERRED_REGISTER.register(modBus); SupplyLoot.GLM.register(modBus); ModBannerPatterns.BANNER_PATTERNS.register(modBus); - ModItemsInitializer.DEFERRED_REGISTER.register(modBus); ModQuestInitializer.DEFERRED_REGISTER_OBJECTIVE.register(modBus); ModQuestInitializer.DEFERRED_REGISTER_TRIGGER.register(modBus); @@ -411,7 +415,7 @@ public BlockEntityWithoutLevelRenderer getCustomRenderer() { return new SpearItemTileEntityRenderer(); } - }, ModItems.spear); + }, ModItems.spear.get()); } /** diff --git a/src/main/java/com/minecolonies/core/blocks/BlockBarrel.java b/src/main/java/com/minecolonies/core/blocks/BlockBarrel.java index 2daf85aad69..7ee669c75dd 100755 --- a/src/main/java/com/minecolonies/core/blocks/BlockBarrel.java +++ b/src/main/java/com/minecolonies/core/blocks/BlockBarrel.java @@ -40,10 +40,6 @@ public class BlockBarrel extends AbstractBlockBarrel implements Ent * The hardness this block has. */ private static final float BLOCK_HARDNESS = 5F; - /** - * This blocks name. - */ - private static final String BLOCK_NAME = "barrel_block"; /** * The resistance this block has. */ @@ -66,12 +62,6 @@ protected MapCodec codec() return CODEC; } - @Override - public ResourceLocation getRegistryName() - { - return new ResourceLocation(Constants.MOD_ID, BLOCK_NAME); - } - @Override protected void createBlockStateDefinition(StateDefinition.Builder builder) { @@ -149,6 +139,6 @@ public BlockState getStateForPlacement(final BlockPlaceContext context) public boolean canSurvive(final BlockState state, final LevelReader worldIn, final BlockPos pos) { return !worldIn.isEmptyBlock(pos.below()) - && worldIn.getBlockState(pos.below()).getBlock() != ModBlocks.blockBarrel; + && worldIn.getBlockState(pos.below()).getBlock() != ModBlocks.blockBarrel.get(); } } diff --git a/src/main/java/com/minecolonies/core/blocks/BlockCompostedDirt.java b/src/main/java/com/minecolonies/core/blocks/BlockCompostedDirt.java index cf3ec55beef..0bbaf04199f 100755 --- a/src/main/java/com/minecolonies/core/blocks/BlockCompostedDirt.java +++ b/src/main/java/com/minecolonies/core/blocks/BlockCompostedDirt.java @@ -1,11 +1,9 @@ package com.minecolonies.core.blocks; -import com.minecolonies.api.blocks.AbstractBlockMinecolonies; import com.minecolonies.api.blocks.interfaces.ITickableBlockMinecolonies; -import com.minecolonies.api.util.constant.Constants; import com.minecolonies.core.tileentities.TileEntityCompostedDirt; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.core.Direction; @@ -23,9 +21,8 @@ /** * Block that if activated with BoneMeal or Compost by an AI will produce flowers by intervals until it deactivates */ -public class BlockCompostedDirt extends AbstractBlockMinecolonies implements ITickableBlockMinecolonies +public class BlockCompostedDirt extends Block implements ITickableBlockMinecolonies { - private static final String BLOCK_NAME = "composted_dirt"; private static final float BLOCK_HARDNESS = 5f; private static final float RESISTANCE = 1f; private final static VoxelShape SHAPE = Shapes.box(0, 0, 0, 1, 1, 1); @@ -38,12 +35,6 @@ public BlockCompostedDirt() super(Properties.of().mapColor(MapColor.DIRT).sound(SoundType.ROOTED_DIRT).strength(BLOCK_HARDNESS, RESISTANCE).sound(SoundType.GRAVEL)); } - @Override - public ResourceLocation getRegistryName() - { - return new ResourceLocation(Constants.MOD_ID, BLOCK_NAME); - } - @Nullable @Override public BlockEntity newBlockEntity(@NotNull final BlockPos blockPos, @NotNull final BlockState blockState) diff --git a/src/main/java/com/minecolonies/core/blocks/BlockDecorationController.java b/src/main/java/com/minecolonies/core/blocks/BlockDecorationController.java index f5251784a86..4b494101ffd 100755 --- a/src/main/java/com/minecolonies/core/blocks/BlockDecorationController.java +++ b/src/main/java/com/minecolonies/core/blocks/BlockDecorationController.java @@ -2,21 +2,16 @@ import com.ldtteam.structurize.blocks.interfaces.IAnchorBlock; import com.ldtteam.structurize.blocks.interfaces.ILeveledBlueprintAnchorBlock; -import com.minecolonies.api.blocks.AbstractBlockMinecoloniesDirectional; import com.minecolonies.api.colony.IColony; import com.minecolonies.api.colony.IColonyManager; import com.minecolonies.api.entity.ai.workers.util.IBuilderUndestroyable; -import com.minecolonies.api.util.constant.Constants; -import com.minecolonies.core.MineColonies; import com.minecolonies.core.client.gui.WindowDecorationController; import com.minecolonies.core.tileentities.TileEntityDecorationController; import com.mojang.serialization.MapCodec; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; @@ -51,7 +46,7 @@ /** * Creates a decoration controller block. */ -public class BlockDecorationController extends AbstractBlockMinecoloniesDirectional implements IBuilderUndestroyable, IAnchorBlock, EntityBlock, ILeveledBlueprintAnchorBlock, SimpleWaterloggedBlock +public class BlockDecorationController extends DirectionalBlock implements IBuilderUndestroyable, IAnchorBlock, EntityBlock, ILeveledBlueprintAnchorBlock, SimpleWaterloggedBlock { public static final MapCodec CODEC = simpleCodec(BlockDecorationController::new); @@ -60,11 +55,6 @@ public class BlockDecorationController extends AbstractBlockMinecoloniesDirectio */ private static final float BLOCK_HARDNESS = 5F; - /** - * This blocks name. - */ - private static final String BLOCK_NAME = "decorationcontroller"; - /** * The resistance this block has. */ @@ -110,12 +100,6 @@ protected MapCodec codec() return CODEC; } - @Override - public ResourceLocation getRegistryName() - { - return new ResourceLocation(Constants.MOD_ID, BLOCK_NAME); - } - @Override public VoxelShape getShape(final BlockState decoController, final BlockGetter level, final BlockPos pos, final CollisionContext context) { diff --git a/src/main/java/com/minecolonies/core/blocks/BlockMinecoloniesGrave.java b/src/main/java/com/minecolonies/core/blocks/BlockMinecoloniesGrave.java index 0fda6ee753b..b3662bcf1e5 100644 --- a/src/main/java/com/minecolonies/core/blocks/BlockMinecoloniesGrave.java +++ b/src/main/java/com/minecolonies/core/blocks/BlockMinecoloniesGrave.java @@ -8,8 +8,6 @@ import com.minecolonies.api.tileentities.AbstractTileEntityGrave; import com.minecolonies.core.tileentities.TileEntityGrave; import com.minecolonies.api.util.InventoryUtils; -import com.minecolonies.api.util.constant.Constants; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.SoundType; @@ -37,7 +35,6 @@ import net.minecraft.core.Direction; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; import net.minecraft.world.level.block.Mirror; import net.minecraft.world.level.block.Rotation; @@ -51,11 +48,6 @@ public class BlockMinecoloniesGrave extends AbstractBlockMinecoloniesGrave implements IBuilderUndestroyable, IAnchorBlock, IBuildingBrowsableBlock, EntityBlock +public class BlockPlantationField extends HorizontalDirectionalBlock implements IBuilderUndestroyable, IAnchorBlock, IBuildingBrowsableBlock, EntityBlock { public static final MapCodec CODEC = simpleCodec(BlockPlantationField::new); @@ -58,11 +54,6 @@ public class BlockPlantationField extends AbstractBlockMinecoloniesHorizontal codec() return CODEC; } - @Override - public ResourceLocation getRegistryName() - { - return new ResourceLocation(Constants.MOD_ID, BLOCK_NAME); - } - @Override public BlockEntity newBlockEntity(@NotNull final BlockPos blockPos, @NotNull final BlockState blockState) { diff --git a/src/main/java/com/minecolonies/core/blocks/BlockScarecrow.java b/src/main/java/com/minecolonies/core/blocks/BlockScarecrow.java index 5aa5856ba95..8e98e4d5b16 100755 --- a/src/main/java/com/minecolonies/core/blocks/BlockScarecrow.java +++ b/src/main/java/com/minecolonies/core/blocks/BlockScarecrow.java @@ -1,19 +1,15 @@ package com.minecolonies.core.blocks; -import com.minecolonies.api.blocks.huts.AbstractBlockMinecoloniesDefault; import com.minecolonies.api.blocks.interfaces.IBuildingBrowsableBlock; import com.minecolonies.api.colony.IColony; import com.minecolonies.api.colony.IColonyManager; import com.minecolonies.api.colony.fields.registry.FieldRegistries; -import com.minecolonies.api.util.constant.Constants; import com.minecolonies.core.client.gui.containers.WindowField; import com.minecolonies.core.colony.fields.FarmField; import com.minecolonies.core.tileentities.TileEntityScarecrow; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; import net.minecraft.world.ItemInteractionResult; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; @@ -28,6 +24,7 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.DirectionProperty; import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; import net.minecraft.world.level.block.state.properties.EnumProperty; import net.minecraft.world.level.material.MapColor; @@ -42,25 +39,36 @@ * The net.minecraft.core.Directions, placement and activation. */ @SuppressWarnings("PMD.ExcessiveImports") -public class BlockScarecrow extends AbstractBlockMinecoloniesDefault implements EntityBlock, IBuildingBrowsableBlock +public class BlockScarecrow extends Block implements EntityBlock, IBuildingBrowsableBlock { public static final EnumProperty HALF = BlockStateProperties.DOUBLE_BLOCK_HALF; + public static final DirectionProperty FACING = HorizontalDirectionalBlock.FACING; + /** + * Start of the collision box at y. + */ + public static final double BOTTOM_COLLISION = 0.0; + /** + * Start of the collision box at x and z. + */ + public static final double START_COLLISION = 0.1; + /** + * End of the collision box. + */ + public static final double END_COLLISION = 0.9; + /** + * Height of the collision box. + */ + public static final double HEIGHT_COLLISION = 2.2; /** * Constructor called on block placement. */ public BlockScarecrow() { - super(Properties.of().mapColor(MapColor.WOOD).sound(SoundType.WOOD).strength(HARDNESS, RESISTANCE)); + super(Properties.of().mapColor(MapColor.WOOD).sound(SoundType.WOOD).strength(10F, 10F)); this.registerDefaultState(this.defaultBlockState().setValue(FACING, Direction.NORTH).setValue(HALF, DoubleBlockHalf.LOWER)); } - @Override - public ResourceLocation getRegistryName() - { - return new ResourceLocation(Constants.MOD_ID, REGISTRY_NAME); - } - @Nullable @Override public BlockEntity newBlockEntity(@NotNull final BlockPos blockPos, @NotNull final BlockState blockState) diff --git a/src/main/java/com/minecolonies/core/blocks/MinecoloniesCropBlock.java b/src/main/java/com/minecolonies/core/blocks/MinecoloniesCropBlock.java index c44edb090b4..3bf9741e852 100644 --- a/src/main/java/com/minecolonies/core/blocks/MinecoloniesCropBlock.java +++ b/src/main/java/com/minecolonies/core/blocks/MinecoloniesCropBlock.java @@ -1,20 +1,9 @@ package com.minecolonies.core.blocks; -import com.minecolonies.api.blocks.AbstractBlockMinecolonies; -import com.minecolonies.api.util.constant.Constants; -import com.minecolonies.core.items.ItemCrop; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.core.Registry; -import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.tags.TagKey; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.ItemInteractionResult; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.BoneMealItem; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.*; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.block.Block; @@ -29,25 +18,15 @@ import net.minecraft.world.level.pathfinder.PathComputationType; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; +import net.neoforged.neoforge.registries.DeferredBlock; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** * Abstract Minecolonies crop type. We have our own to avoid cheesing the crop.s */ -public class MinecoloniesCropBlock extends AbstractBlockMinecolonies +public class MinecoloniesCropBlock extends Block { - public static String BELL_PEPPER = "bell_pepper"; - public static String CABBAGE = "cabbage"; - public static String CHICKPEA = "chickpea"; - public static String DURUM = "durum"; - public static String EGGPLANT = "eggplant"; - public static String GARLIC = "garlic"; - public static String ONION = "onion"; - public static String SOYBEAN = "soybean"; - public static String TOMATO = "tomato"; - public static String RICE = "rice"; - public static final IntegerProperty AGE = IntegerProperty.create("age", 0, 6); private static final VoxelShape[] SHAPE_BY_AGE = new VoxelShape[] { Block.box(0.0, 0.0, 0.0, 16.0, 2.0, 16.0), @@ -58,20 +37,18 @@ public class MinecoloniesCropBlock extends AbstractBlockMinecolonies preferredFarmland; - private final ResourceLocation blockId; private final TagKey preferredBiome; /** * Constructor to create a block of this type. * @param blockName the block id. */ - public MinecoloniesCropBlock(final String blockName, final Block preferredFarmland, @Nullable final TagKey preferredBiome) + public MinecoloniesCropBlock(final DeferredBlock preferredFarmland, @Nullable final TagKey preferredBiome) { super(BlockBehaviour.Properties.of().mapColor(MapColor.PLANT).noCollission().instabreak().sound(SoundType.CROP).pushReaction(PushReaction.DESTROY)); this.registerDefaultState(this.stateDefinition.any().setValue(AGE, 0)); - this.blockId = new ResourceLocation(Constants.MOD_ID, blockName); this.preferredFarmland = preferredFarmland; this.preferredBiome = preferredBiome; } @@ -126,7 +103,7 @@ public void attemptGrow(BlockState state, ServerLevel level, BlockPos pos) @Override public boolean canSurvive(@NotNull BlockState state, LevelReader level, @NotNull BlockPos pos) { - return (level.getRawBrightness(pos, 0) >= 8 || level.canSeeSky(pos)) && super.canSurvive(state, level, pos) && level.getBlockState(pos.below()).getBlock() == preferredFarmland && (preferredBiome == null || level.getBiome(pos).is(preferredBiome)); + return (level.getRawBrightness(pos, 0) >= 8 || level.canSeeSky(pos)) && super.canSurvive(state, level, pos) && level.getBlockState(pos.below()).getBlock() == preferredFarmland.get() && (preferredBiome == null || level.getBiome(pos).is(preferredBiome)); } @Override @@ -154,24 +131,12 @@ public boolean isPathfindable(@NotNull BlockState state, @NotNull PathComputatio return pathComputationType == PathComputationType.AIR && !this.hasCollision || super.isPathfindable(state, pathComputationType); } - @Override - public ResourceLocation getRegistryName() - { - return blockId; - } - - @Override - public void registerBlockItem(final Registry registry, final Item.Properties properties) - { - Registry.register(registry, getRegistryName(), new ItemCrop(this, properties, preferredBiome)); - } - /** * Get the preferred farmland for this crop. * @return the preferred farmland. */ public Block getPreferredFarmland() { - return preferredFarmland; + return preferredFarmland.get(); } } diff --git a/src/main/java/com/minecolonies/core/blocks/MinecoloniesFarmland.java b/src/main/java/com/minecolonies/core/blocks/MinecoloniesFarmland.java index f26f392a22c..abed1773cee 100644 --- a/src/main/java/com/minecolonies/core/blocks/MinecoloniesFarmland.java +++ b/src/main/java/com/minecolonies/core/blocks/MinecoloniesFarmland.java @@ -1,10 +1,7 @@ package com.minecolonies.core.blocks; -import com.minecolonies.api.blocks.AbstractBlockMinecolonies; -import com.minecolonies.api.util.constant.Constants; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; -import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.util.RandomSource; import net.minecraft.world.entity.Entity; @@ -38,7 +35,7 @@ import javax.annotation.Nullable; -public class MinecoloniesFarmland extends AbstractBlockMinecolonies implements SimpleWaterloggedBlock +public class MinecoloniesFarmland extends Block implements SimpleWaterloggedBlock { public static final BooleanProperty WATERLOGGED = BlockStateProperties.WATERLOGGED; @@ -48,13 +45,10 @@ public class MinecoloniesFarmland extends AbstractBlockMinecolonies true).isSuffocating((s,g,p) -> true)); this.registerDefaultState(this.stateDefinition.any().setValue(MOISTURE, 0)); - this.blockId = new ResourceLocation(Constants.MOD_ID, blockName);; this.registerDefaultState(this.stateDefinition.any().setValue(WATERLOGGED, Boolean.valueOf(waterLogged))); this.shape = Block.box(0.0, 0.0, 0.0, 16.0, height, 16.0); } @@ -194,12 +188,6 @@ protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(ROTATION); } - - @Override - public ResourceLocation getRegistryName() - { - return new ResourceLocation(Constants.MOD_ID, REGISTRY_NAME); - } } diff --git a/src/main/java/com/minecolonies/core/blocks/decorative/BlockColonyFlagWallBanner.java b/src/main/java/com/minecolonies/core/blocks/decorative/BlockColonyFlagWallBanner.java index 09d745988e5..befd0c76634 100644 --- a/src/main/java/com/minecolonies/core/blocks/decorative/BlockColonyFlagWallBanner.java +++ b/src/main/java/com/minecolonies/core/blocks/decorative/BlockColonyFlagWallBanner.java @@ -3,10 +3,8 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; import com.minecolonies.api.blocks.decorative.AbstractColonyFlagBanner; -import com.minecolonies.api.util.constant.Constants; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.DyeColor; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.block.state.properties.DirectionProperty; @@ -126,10 +124,4 @@ public BlockState mirror(BlockState state, Mirror mirrorIn) @Override protected void createBlockStateDefinition(StateDefinition.Builder builder) { builder.add(HORIZONTAL_FACING); } - - @Override - public ResourceLocation getRegistryName() - { - return new ResourceLocation(Constants.MOD_ID, REGISTRY_NAME_WALL); - } } diff --git a/src/main/java/com/minecolonies/core/blocks/decorative/BlockConstructionTape.java b/src/main/java/com/minecolonies/core/blocks/decorative/BlockConstructionTape.java index e7d939f3166..3c53c7d8248 100755 --- a/src/main/java/com/minecolonies/core/blocks/decorative/BlockConstructionTape.java +++ b/src/main/java/com/minecolonies/core/blocks/decorative/BlockConstructionTape.java @@ -1,9 +1,7 @@ package com.minecolonies.core.blocks.decorative; import com.minecolonies.api.blocks.decorative.AbstractBlockMinecoloniesConstructionTape; -import com.minecolonies.api.util.constant.Constants; import com.mojang.serialization.MapCodec; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.state.BlockState; @@ -37,11 +35,6 @@ public class BlockConstructionTape extends AbstractBlockMinecoloniesConstruction { public static final MapCodec CODEC = simpleCodec(BlockConstructionTape::new); - /** - * This blocks name. - */ - private static final String BLOCK_NAME = "blockconstructiontape"; - /** * Constructor for the Construction Tape decoration. */ @@ -81,12 +74,6 @@ protected MapCodec codec() return CODEC; } - @Override - public ResourceLocation getRegistryName() - { - return new ResourceLocation(Constants.MOD_ID, BLOCK_NAME); - } - @NotNull @Override public VoxelShape getShape(final BlockState state, final BlockGetter worldIn, final BlockPos pos, final CollisionContext context) diff --git a/src/main/java/com/minecolonies/core/blocks/decorative/BlockGate.java b/src/main/java/com/minecolonies/core/blocks/decorative/BlockGate.java index b9cd37a7691..3395ced6a8e 100644 --- a/src/main/java/com/minecolonies/core/blocks/decorative/BlockGate.java +++ b/src/main/java/com/minecolonies/core/blocks/decorative/BlockGate.java @@ -7,8 +7,8 @@ */ public class BlockGate extends AbstractBlockGate { - public BlockGate(final String name, final float hardness, final int maxWidth, final int maxHeight) + public BlockGate(final float hardness, final int maxWidth, final int maxHeight) { - super(name, hardness, maxWidth, maxHeight); + super(hardness, maxWidth, maxHeight); } } diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutAlchemist.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutAlchemist.java index 6818bfdbe68..13a20ef61b9 100644 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutAlchemist.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutAlchemist.java @@ -3,20 +3,12 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Alchemist hut block. */ public class BlockHutAlchemist extends AbstractBlockHut { - @NotNull - @Override - public String getHutName() - { - return "blockhutalchemist"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutArchery.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutArchery.java index 6d87343a487..803fb6babfe 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutArchery.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutArchery.java @@ -3,20 +3,12 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Block of the Archers trainings camp. */ public class BlockHutArchery extends AbstractBlockHut { - @NotNull - @Override - public String getHutName() - { - return "blockhutarchery"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutBaker.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutBaker.java index 41c11bb7c0a..29c393fc6b5 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutBaker.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutBaker.java @@ -3,26 +3,12 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Hut for the bakery. No different from {@link AbstractBlockHut} */ public class BlockHutBaker extends AbstractBlockHut { - public BlockHutBaker() - { - //No different from Abstract parent - super(); - } - - @NotNull - @Override - public String getHutName() - { - return "blockhutbaker"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutBarracks.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutBarracks.java index 8e3ecff9581..9ef69960427 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutBarracks.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutBarracks.java @@ -3,29 +3,12 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Block of the Barracks. */ public class BlockHutBarracks extends AbstractBlockHut { - /** - * Default constructor. - */ - public BlockHutBarracks() - { - //No different from Abstract parent - super(); - } - - @NotNull - @Override - public String getHutName() - { - return "blockhutbarracks"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutBarracksTower.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutBarracksTower.java index 08684e7484b..4a6aff8af0a 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutBarracksTower.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutBarracksTower.java @@ -4,7 +4,6 @@ import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; import net.minecraft.nbt.CompoundTag; -import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** @@ -12,28 +11,12 @@ */ public class BlockHutBarracksTower extends AbstractBlockHut { - /** - * Default constructor. - */ - public BlockHutBarracksTower() - { - //No different from Abstract parent - super(); - } - @Override public boolean isVisible(@Nullable final CompoundTag beData) { return false; } - @NotNull - @Override - public String getHutName() - { - return "blockhutbarrackstower"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutBeekeeper.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutBeekeeper.java index f5430c96da3..5ea6218da5e 100644 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutBeekeeper.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutBeekeeper.java @@ -9,17 +9,6 @@ */ public class BlockHutBeekeeper extends AbstractBlockHut { - /** - * Method to return the name of the block. - * - * @return Name of the block. - */ - @Override - public String getHutName() - { - return "blockhutbeekeeper"; - } - /** * Method to get the building registry entry. * diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutBlacksmith.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutBlacksmith.java index 7927797bfde..be803cb526f 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutBlacksmith.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutBlacksmith.java @@ -3,26 +3,12 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Hut for the blacksmith. No different from {@link AbstractBlockHut} */ public class BlockHutBlacksmith extends AbstractBlockHut { - public BlockHutBlacksmith() - { - //No different from Abstract parent - super(); - } - - @NotNull - @Override - public String getHutName() - { - return "blockhutblacksmith"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutBuilder.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutBuilder.java index 92b69fcb731..2f90335dc58 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutBuilder.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutBuilder.java @@ -3,26 +3,12 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Hut for the builder. No different from {@link AbstractBlockHut} */ public class BlockHutBuilder extends AbstractBlockHut { - public BlockHutBuilder() - { - //No different from Abstract parent - super(); - } - - @NotNull - @Override - public String getHutName() - { - return "blockhutbuilder"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutChickenHerder.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutChickenHerder.java index 30cf9129d24..4d3e6d197f4 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutChickenHerder.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutChickenHerder.java @@ -3,26 +3,12 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Hut for the shepherd. No different from {@link AbstractBlockHut} */ public class BlockHutChickenHerder extends AbstractBlockHut { - public BlockHutChickenHerder() - { - //No different from Abstract parent - super(); - } - - @NotNull - @Override - public String getHutName() - { - return "blockhutchickenherder"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutCitizen.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutCitizen.java index cd48c4575fc..7c5b938f1dc 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutCitizen.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutCitizen.java @@ -3,26 +3,12 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Hut for the citizen. No different from {@link AbstractBlockHut} */ public class BlockHutCitizen extends AbstractBlockHut { - public BlockHutCitizen() - { - //No different from Abstract parent - super(); - } - - @NotNull - @Override - public String getHutName() - { - return "blockhutcitizen"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutCombatAcademy.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutCombatAcademy.java index 7748ab0b8ad..21fdcc2c043 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutCombatAcademy.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutCombatAcademy.java @@ -3,20 +3,12 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Block of the combat academy camp. */ public class BlockHutCombatAcademy extends AbstractBlockHut { - @NotNull - @Override - public String getHutName() - { - return "blockhutcombatacademy"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutComposter.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutComposter.java index 8cd1e4f916e..cfa8e1a50d5 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutComposter.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutComposter.java @@ -4,18 +4,8 @@ import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; - public class BlockHutComposter extends AbstractBlockHut { - - @NotNull - @Override - public String getHutName() - { - return "blockhutcomposter"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutConcreteMixer.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutConcreteMixer.java index de02e84f777..c4462ec3ac3 100644 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutConcreteMixer.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutConcreteMixer.java @@ -4,20 +4,11 @@ import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; - /** * Hut for the concrete mason. No different from {@link AbstractBlockHut} */ public class BlockHutConcreteMixer extends AbstractBlockHut { - @NotNull - @Override - public String getHutName() - { - return "blockhutconcretemixer"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutCook.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutCook.java index 7cbcb0bf2ef..7b403c5026f 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutCook.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutCook.java @@ -3,26 +3,12 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Hut for the lumberjack. No different from {@link AbstractBlockHut} */ public class BlockHutCook extends AbstractBlockHut { - public BlockHutCook() - { - //No different from Abstract parent - super(); - } - - @NotNull - @Override - public String getHutName() - { - return "blockhutcook"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutCowboy.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutCowboy.java index e8c3df73445..ce112e1b6fb 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutCowboy.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutCowboy.java @@ -3,26 +3,12 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Hut for the shepherd. No different from {@link AbstractBlockHut} */ public class BlockHutCowboy extends AbstractBlockHut { - public BlockHutCowboy() - { - //No different from Abstract parent - super(); - } - - @NotNull - @Override - public String getHutName() - { - return "blockhutcowboy"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutCrusher.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutCrusher.java index cdc16bda92e..3c0e755d2cb 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutCrusher.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutCrusher.java @@ -3,20 +3,12 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Hut for the crusher. No different from {@link AbstractBlockHut} */ public class BlockHutCrusher extends AbstractBlockHut { - @NotNull - @Override - public String getHutName() - { - return "blockhutcrusher"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutDeliveryman.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutDeliveryman.java index 0a755e3e392..5de3853be99 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutDeliveryman.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutDeliveryman.java @@ -3,7 +3,6 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Hut for the warehouse. No different from {@link AbstractBlockHut} @@ -11,19 +10,6 @@ public class BlockHutDeliveryman extends AbstractBlockHut { - public BlockHutDeliveryman() - { - //No different from Abstract parent - super(); - } - - @NotNull - @Override - public String getHutName() - { - return "blockhutdeliveryman"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutDyer.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutDyer.java index 70ef8513693..9d8950035c2 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutDyer.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutDyer.java @@ -3,20 +3,12 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Hut for the dyer. No different from {@link AbstractBlockHut} */ public class BlockHutDyer extends AbstractBlockHut { - @NotNull - @Override - public String getHutName() - { - return "blockhutdyer"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutEnchanter.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutEnchanter.java index f651002e6c2..07425822b6c 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutEnchanter.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutEnchanter.java @@ -12,13 +12,6 @@ public class BlockHutEnchanter extends AbstractBlockHut { - @NotNull - @Override - public String getHutName() - { - return "blockhutenchanter"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutFarmer.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutFarmer.java index 6fc35b39df5..6e78652864a 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutFarmer.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutFarmer.java @@ -3,7 +3,6 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Hut for the Farmer. No different from {@link AbstractBlockHut} @@ -11,19 +10,6 @@ public class BlockHutFarmer extends AbstractBlockHut { - public BlockHutFarmer() - { - //No different from Abstract parent - super(); - } - - @NotNull - @Override - public String getHutName() - { - return "blockhutfarmer"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutFisherman.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutFisherman.java index 336028e2472..5856a55382e 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutFisherman.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutFisherman.java @@ -3,26 +3,12 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Hut for the fisherman. No different from {@link AbstractBlockHut} */ public class BlockHutFisherman extends AbstractBlockHut { - public BlockHutFisherman() - { - //No different from Abstract parent - super(); - } - - @NotNull - @Override - public String getHutName() - { - return "blockhutfisherman"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutFletcher.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutFletcher.java index a82a0f0335b..e2a6edf01b3 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutFletcher.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutFletcher.java @@ -3,20 +3,12 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Hut for the fletcher. No different from {@link AbstractBlockHut} */ public class BlockHutFletcher extends AbstractBlockHut { - @NotNull - @Override - public String getHutName() - { - return "blockhutfletcher"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutFlorist.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutFlorist.java index 070b02ad504..61e4632a80f 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutFlorist.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutFlorist.java @@ -3,17 +3,9 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; public class BlockHutFlorist extends AbstractBlockHut { - @NotNull - @Override - public String getHutName() - { - return "blockhutflorist"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutGlassblower.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutGlassblower.java index 0c1d301c261..9a2ca275b39 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutGlassblower.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutGlassblower.java @@ -3,20 +3,12 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Hut for the glassblower. No different from {@link AbstractBlockHut} */ public class BlockHutGlassblower extends AbstractBlockHut { - @NotNull - @Override - public String getHutName() - { - return "blockhutglassblower"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutGraveyard.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutGraveyard.java index e74277bd8f0..9d40effc81d 100644 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutGraveyard.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutGraveyard.java @@ -22,12 +22,6 @@ public class BlockHutGraveyard extends AbstractBlockHut */ private static final VoxelShape SHAPE = Shapes.box(0.1, 0.1, 0.1, 0.9, 1.9, 0.9); - public BlockHutGraveyard() - { - //No different from Abstract parent - super(); - } - @NotNull @Override public VoxelShape getShape(final BlockState state, final BlockGetter worldIn, final BlockPos pos, final CollisionContext context) @@ -35,10 +29,6 @@ public VoxelShape getShape(final BlockState state, final BlockGetter worldIn, fi return SHAPE; } - @NotNull - @Override - public String getHutName() { return "blockhutgraveyard"; } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutGuardTower.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutGuardTower.java index 7240cf35341..23b68d2886a 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutGuardTower.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutGuardTower.java @@ -3,29 +3,12 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Block of the GuardTower hut. */ public class BlockHutGuardTower extends AbstractBlockHut { - /** - * Default constructor. - */ - public BlockHutGuardTower() - { - //No different from Abstract parent - super(); - } - - @NotNull - @Override - public String getHutName() - { - return "blockhutguardtower"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutHospital.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutHospital.java index e3446e9c0d4..fd16674e861 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutHospital.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutHospital.java @@ -3,26 +3,12 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Hut for the hospital. No different from {@link AbstractBlockHut} */ public class BlockHutHospital extends AbstractBlockHut { - public BlockHutHospital() - { - //No different from Abstract parent - super(); - } - - @NotNull - @Override - public String getHutName() - { - return "blockhuthospital"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutKitchen.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutKitchen.java index 22cf61ead8c..7289aaf64d0 100644 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutKitchen.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutKitchen.java @@ -3,26 +3,12 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Hut for the kitchen. No different from {@link AbstractBlockHut} */ public class BlockHutKitchen extends AbstractBlockHut { - public BlockHutKitchen() - { - //No different from Abstract parent - super(); - } - - @NotNull - @Override - public String getHutName() - { - return "blockhutkitchen"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutLibrary.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutLibrary.java index d6bea3c491b..562f4454dbb 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutLibrary.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutLibrary.java @@ -3,20 +3,12 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Hut for the library. No different from {@link AbstractBlockHut} */ public class BlockHutLibrary extends AbstractBlockHut { - @NotNull - @Override - public String getHutName() - { - return "blockhutlibrary"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutLumberjack.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutLumberjack.java index 10a3bd43e85..7722423bab0 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutLumberjack.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutLumberjack.java @@ -3,26 +3,12 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Hut for the lumberjack. No different from {@link AbstractBlockHut} */ public class BlockHutLumberjack extends AbstractBlockHut { - public BlockHutLumberjack() - { - //No different from Abstract parent - super(); - } - - @NotNull - @Override - public String getHutName() - { - return "blockhutlumberjack"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutMechanic.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutMechanic.java index 8d0c480f88d..7043de3814c 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutMechanic.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutMechanic.java @@ -3,20 +3,12 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Hut for the mechanic. No different from {@link AbstractBlockHut} */ public class BlockHutMechanic extends AbstractBlockHut { - @NotNull - @Override - public String getHutName() - { - return "blockhutmechanic"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutMiner.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutMiner.java index 16d01a0cf9e..83b3da13479 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutMiner.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutMiner.java @@ -3,7 +3,6 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Hut for the miner. No different from {@link AbstractBlockHut} @@ -11,19 +10,6 @@ public class BlockHutMiner extends AbstractBlockHut { - public BlockHutMiner() - { - //No different from Abstract parent - super(); - } - - @NotNull - @Override - public String getHutName() - { - return "blockhutminer"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutMysticalSite.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutMysticalSite.java index 1d91c45279b..1213f3925fe 100644 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutMysticalSite.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutMysticalSite.java @@ -9,22 +9,6 @@ */ public class BlockHutMysticalSite extends AbstractBlockHut { - /** - * Method to return the name of the block. - * - * @return Name of the block. - */ - @Override - public String getHutName() - { - return "blockhutmysticalsite"; - } - - /** - * Method to get the building registry entry. - * - * @return The building entry. - */ @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutNetherWorker.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutNetherWorker.java index a3a2430ff2e..8a087c3da96 100644 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutNetherWorker.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutNetherWorker.java @@ -6,23 +6,6 @@ public class BlockHutNetherWorker extends AbstractBlockHut { - - /** - * Method to return the name of the block. - * - * @return Name of the block. - */ - @Override - public String getHutName() - { - return "blockhutnetherworker"; - } - - /** - * Method to get the building registry entry. - * - * @return The building entry. - */ @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutPlantation.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutPlantation.java index 4f1be55a520..5d761eaa811 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutPlantation.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutPlantation.java @@ -3,7 +3,6 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Hut for the plantation. No different from {@link AbstractBlockHut} @@ -11,13 +10,6 @@ public class BlockHutPlantation extends AbstractBlockHut { - @NotNull - @Override - public String getHutName() - { - return "blockhutplantation"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutRabbitHutch.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutRabbitHutch.java index 517f010149b..f949cd6c574 100644 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutRabbitHutch.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutRabbitHutch.java @@ -3,20 +3,12 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Hut for the rabbit hutch. No different from {@link AbstractBlockHut} */ public class BlockHutRabbitHutch extends AbstractBlockHut { - @NotNull - @Override - public String getHutName() - { - return "blockhutrabbithutch"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutSawmill.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutSawmill.java index c4c5df9bec9..072f7447b78 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutSawmill.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutSawmill.java @@ -3,20 +3,12 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Hut for the sawmill. No different from {@link AbstractBlockHut} */ public class BlockHutSawmill extends AbstractBlockHut { - @NotNull - @Override - public String getHutName() - { - return "blockhutsawmill"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutSchool.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutSchool.java index cdeea72e3c2..73727fa4c7b 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutSchool.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutSchool.java @@ -3,26 +3,12 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Hut for the school. No different from {@link AbstractBlockHut} */ public class BlockHutSchool extends AbstractBlockHut { - public BlockHutSchool() - { - //No different from Abstract parent - super(); - } - - @NotNull - @Override - public String getHutName() - { - return "blockhutschool"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutShepherd.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutShepherd.java index 2c59f562712..500e161e577 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutShepherd.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutShepherd.java @@ -3,26 +3,12 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Hut for the shepherd. No different from {@link AbstractBlockHut} */ public class BlockHutShepherd extends AbstractBlockHut { - public BlockHutShepherd() - { - //No different from Abstract parent - super(); - } - - @NotNull - @Override - public String getHutName() - { - return "blockhutshepherd"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutSifter.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutSifter.java index c8455986bc6..5714a776b48 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutSifter.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutSifter.java @@ -3,20 +3,12 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Hut for the sifter. No different from {@link AbstractBlockHut} */ public class BlockHutSifter extends AbstractBlockHut { - @NotNull - @Override - public String getHutName() - { - return "blockhutsifter"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutSmeltery.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutSmeltery.java index 724f48b3b8f..b937b7230eb 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutSmeltery.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutSmeltery.java @@ -3,7 +3,6 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Hut for the Smeltery. No different from {@link AbstractBlockHut} @@ -16,13 +15,6 @@ public BlockHutSmeltery() super(); } - @NotNull - @Override - public String getHutName() - { - return "blockhutsmeltery"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutStoneSmeltery.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutStoneSmeltery.java index 6f950cf91e5..3dbf1504ddd 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutStoneSmeltery.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutStoneSmeltery.java @@ -3,20 +3,12 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Hut for the StoneSmeltery. No different from {@link AbstractBlockHut} */ public class BlockHutStoneSmeltery extends AbstractBlockHut { - @NotNull - @Override - public String getHutName() - { - return "blockhutstonesmeltery"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutStonemason.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutStonemason.java index 3ef3aaf21c4..545224996f4 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutStonemason.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutStonemason.java @@ -3,20 +3,12 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Hut for the stone mason. No different from {@link AbstractBlockHut} */ public class BlockHutStonemason extends AbstractBlockHut { - @NotNull - @Override - public String getHutName() - { - return "blockhutstonemason"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutSwineHerder.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutSwineHerder.java index b01b4a356ea..adccbe2f69e 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutSwineHerder.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutSwineHerder.java @@ -3,7 +3,6 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Hut for the shepherd. No different from {@link AbstractBlockHut} @@ -16,13 +15,6 @@ public BlockHutSwineHerder() super(); } - @NotNull - @Override - public String getHutName() - { - return "blockhutswineherder"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutTavern.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutTavern.java index c97db2adbf6..5e577380228 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutTavern.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutTavern.java @@ -3,25 +3,12 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * HutBlock for the Tavern */ public class BlockHutTavern extends AbstractBlockHut { - /** - * Block name - */ - public static final String BLOCKHUT_TAVERN = "blockhuttavern"; - - @NotNull - @Override - public String getHutName() - { - return BLOCKHUT_TAVERN; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutTownHall.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutTownHall.java index 700b412ccb3..2640ae5a972 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutTownHall.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutTownHall.java @@ -9,7 +9,6 @@ import com.minecolonies.api.colony.permissions.Action; import com.minecolonies.api.util.InventoryUtils; import com.minecolonies.api.util.MessageUtils; -import com.minecolonies.api.util.constant.Constants; import com.minecolonies.core.MineColonies; import com.minecolonies.core.network.messages.server.GetColonyInfoMessage; import net.minecraft.ChatFormatting; @@ -22,7 +21,6 @@ import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionHand; import net.minecraft.core.BlockPos; import net.minecraft.world.level.material.MapColor; @@ -135,7 +133,7 @@ public List getRequirements(final ClientLevel level, final Blo final List requirements = new ArrayList<>(); if (InventoryUtils.findFirstSlotInItemHandlerWith(new InvWrapper(player.getInventory()), this) == -1) { - requirements.add(Component.translatableEscape("com.minecolonies.coremod.hut.cost", Component.translatableEscape("block." + Constants.MOD_ID + "." + getHutName())).setStyle((Style.EMPTY).withColor( + requirements.add(Component.translatableEscape("com.minecolonies.coremod.hut.cost", Component.translatableEscape(getDescriptionId())).setStyle((Style.EMPTY).withColor( ChatFormatting.RED))); } @@ -151,13 +149,6 @@ public boolean getValidBreak() return validTownHallBreak; } - @NotNull - @Override - public String getHutName() - { - return "blockhuttownhall"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutUniversity.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutUniversity.java index 774c6a289c9..b78a838deb7 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutUniversity.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutUniversity.java @@ -3,7 +3,6 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Hut for the university. No different from {@link AbstractBlockHut} @@ -16,13 +15,6 @@ public BlockHutUniversity() super(); } - @NotNull - @Override - public String getHutName() - { - return "blockhutuniversity"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutWareHouse.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutWareHouse.java index 65d43c472f8..9b69ea40a2c 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockHutWareHouse.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockHutWareHouse.java @@ -23,13 +23,6 @@ public BlockHutWareHouse() super(); } - @NotNull - @Override - public String getHutName() - { - return "blockhutwarehouse"; - } - @Nullable @Override public BlockEntity newBlockEntity(@NotNull final BlockPos blockPos, @NotNull final BlockState blockState) diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockPostBox.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockPostBox.java index 94e23f4e161..48a00991dd7 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockPostBox.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockPostBox.java @@ -23,13 +23,6 @@ public class BlockPostBox extends AbstractBlockHut implements IRSC private static final VoxelShape SHAPE_SOUTH = Block.box(0.0D, 0.0D, 8.0D, 16.0D, 16.0D, 16.0D); private static final VoxelShape SHAPE_WEST = Block.box(0.0D, 0.0D, 0.0D, 8.0D, 16.0D, 16.0D); - @NotNull - @Override - public String getHutName() - { - return "blockpostbox"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/BlockStash.java b/src/main/java/com/minecolonies/core/blocks/huts/BlockStash.java index 711a064d0e9..b8e96b2f5e2 100755 --- a/src/main/java/com/minecolonies/core/blocks/huts/BlockStash.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/BlockStash.java @@ -16,7 +16,6 @@ import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionHand; import net.minecraft.core.BlockPos; import net.minecraft.world.phys.BlockHitResult; @@ -38,13 +37,6 @@ public class BlockStash extends AbstractBlockHut implements IRSCompo private static final VoxelShape SHAPE_SOUTH = Block.box(0.0D, 0.0D, 8.0D, 16.0D, 16.0D, 16.0D); private static final VoxelShape SHAPE_WEST = Block.box(0.0D, 0.0D, 0.0D, 8.0D, 16.0D, 16.0D); - @NotNull - @Override - public String getHutName() - { - return "blockstash"; - } - @Override public @Nullable BlockEntity newBlockEntity(final @NotNull BlockPos blockPos, final @NotNull BlockState blockState) { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/LargeQuarry.java b/src/main/java/com/minecolonies/core/blocks/huts/LargeQuarry.java index c1539439ae1..f66a1233b73 100644 --- a/src/main/java/com/minecolonies/core/blocks/huts/LargeQuarry.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/LargeQuarry.java @@ -2,7 +2,6 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Hut for the Large quarry. No different from {@link AbstractBlockHut} @@ -15,13 +14,6 @@ public LargeQuarry() super(); } - @NotNull - @Override - public String getHutName() - { - return "largequarry"; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/MediumQuarry.java b/src/main/java/com/minecolonies/core/blocks/huts/MediumQuarry.java index 96d4e954003..385acb2ca59 100644 --- a/src/main/java/com/minecolonies/core/blocks/huts/MediumQuarry.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/MediumQuarry.java @@ -3,7 +3,6 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Hut for the Medium quarry. No different from {@link AbstractBlockHut} @@ -16,13 +15,6 @@ public MediumQuarry() super(); } - @NotNull - @Override - public String getHutName() - { - return ModBuildings.MEDIUM_QUARRY_ID; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/huts/SimpleQuarry.java b/src/main/java/com/minecolonies/core/blocks/huts/SimpleQuarry.java index 46c2b18ccbc..5741116a795 100644 --- a/src/main/java/com/minecolonies/core/blocks/huts/SimpleQuarry.java +++ b/src/main/java/com/minecolonies/core/blocks/huts/SimpleQuarry.java @@ -3,7 +3,6 @@ import com.minecolonies.api.blocks.AbstractBlockHut; import com.minecolonies.api.colony.buildings.ModBuildings; import com.minecolonies.api.colony.buildings.registry.BuildingEntry; -import org.jetbrains.annotations.NotNull; /** * Hut for the simple quarry. No different from {@link AbstractBlockHut} @@ -16,13 +15,6 @@ public SimpleQuarry() super(); } - @NotNull - @Override - public String getHutName() - { - return ModBuildings.SIMPLE_QUARRY_ID; - } - @Override public BuildingEntry getBuildingEntry() { diff --git a/src/main/java/com/minecolonies/core/blocks/schematic/BlockWaypoint.java b/src/main/java/com/minecolonies/core/blocks/schematic/BlockWaypoint.java index 24c19a4969d..22f82a12839 100755 --- a/src/main/java/com/minecolonies/core/blocks/schematic/BlockWaypoint.java +++ b/src/main/java/com/minecolonies/core/blocks/schematic/BlockWaypoint.java @@ -1,26 +1,19 @@ package com.minecolonies.core.blocks.schematic; -import com.minecolonies.api.blocks.AbstractBlockMinecolonies; -import com.minecolonies.api.util.constant.Constants; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.material.MapColor; /** * This block is a waypoint, which makes citizens path to it. */ -public class BlockWaypoint extends AbstractBlockMinecolonies +public class BlockWaypoint extends Block { /** * The hardness this block has. */ private static final float BLOCK_HARDNESS = 0.0F; - /** - * This blocks name. - */ - private static final String BLOCK_NAME = "blockwaypoint"; - /** * The resistance this block has. */ @@ -33,10 +26,4 @@ public BlockWaypoint() { super(Properties.of().mapColor(MapColor.WOOD).sound(SoundType.WOOD).strength(BLOCK_HARDNESS, RESISTANCE).noCollission()); } - - @Override - public ResourceLocation getRegistryName() - { - return new ResourceLocation(Constants.MOD_ID, BLOCK_NAME); - } } diff --git a/src/main/java/com/minecolonies/core/client/gui/WindowDecorationController.java b/src/main/java/com/minecolonies/core/client/gui/WindowDecorationController.java index ea9072c38f6..1566a79cdc8 100755 --- a/src/main/java/com/minecolonies/core/client/gui/WindowDecorationController.java +++ b/src/main/java/com/minecolonies/core/client/gui/WindowDecorationController.java @@ -94,7 +94,7 @@ public WindowDecorationController(final BlockPos b) if (blueprint != null) { final BlockState blockState = blueprint.getBlockState(blueprint.getPrimaryBlockOffset()); - if (blockState.getBlock() == ModBlocks.blockDecorationPlaceholder) + if (blockState.getBlock() == ModBlocks.blockDecorationPlaceholder.get()) { findPaneByID(BUTTON_REPAIR).show(); } @@ -110,7 +110,7 @@ public WindowDecorationController(final BlockPos b) if (blueprint != null) { final BlockState blockState = blueprint.getBlockState(blueprint.getPrimaryBlockOffset()); - if (blockState.getBlock() == ModBlocks.blockDecorationPlaceholder) + if (blockState.getBlock() == ModBlocks.blockDecorationPlaceholder.get()) { findPaneByID(BUTTON_BUILD).show(); } diff --git a/src/main/java/com/minecolonies/core/client/gui/WindowSupplyStory.java b/src/main/java/com/minecolonies/core/client/gui/WindowSupplyStory.java index 8c4fc505506..45d56275d28 100644 --- a/src/main/java/com/minecolonies/core/client/gui/WindowSupplyStory.java +++ b/src/main/java/com/minecolonies/core/client/gui/WindowSupplyStory.java @@ -76,7 +76,7 @@ public WindowSupplyStory(final BlockPos pos, final String type, final ItemStack final Random random = new Random(currentComponent.randomKey()); final List> biomes = mc.level.registryAccess().registryOrThrow(Registries.BIOME).holders().toList(); final Holder biome = biomes.get(random.nextInt(biomes.size())); - if (stack.getItem() == ModItems.supplyCamp) + if (stack.is(ModItems.supplyCamp)) { story.add(Component.literal(ColonyStoryListener.pickRandom(ColonyStoryListener.supplyCampStories, biome, random))); } @@ -90,7 +90,7 @@ public WindowSupplyStory(final BlockPos pos, final String type, final ItemStack story.add(Component.translatable("com.minecolonies.core.gui.supplies.guide", Component.translatable(stack.getItem().getDescriptionId()))); story.add(Component.empty()); - if (stack.getItem() == ModItems.supplyCamp) + if (stack.is(ModItems.supplyCamp)) { story.add(Component.translatable("com.minecolonies.core.gui.supplycamp.guide")); } diff --git a/src/main/java/com/minecolonies/core/client/gui/townhall/WindowPermissionsPage.java b/src/main/java/com/minecolonies/core/client/gui/townhall/WindowPermissionsPage.java index 169f825ec61..2c83ef5bcad 100644 --- a/src/main/java/com/minecolonies/core/client/gui/townhall/WindowPermissionsPage.java +++ b/src/main/java/com/minecolonies/core/client/gui/townhall/WindowPermissionsPage.java @@ -437,7 +437,7 @@ else if (row < freeBlocks.size() + freePositions.size()) */ private void giveBlockTool(final Button button) { - new GiveToolMessage(buildingView, ModItems.permTool).sendToServer(); + new GiveToolMessage(buildingView, ModItems.permTool.get()).sendToServer(); } /** diff --git a/src/main/java/com/minecolonies/core/client/render/TileEntityNamedGraveRenderer.java b/src/main/java/com/minecolonies/core/client/render/TileEntityNamedGraveRenderer.java index 76b0b74a62e..f1cd97fd91e 100644 --- a/src/main/java/com/minecolonies/core/client/render/TileEntityNamedGraveRenderer.java +++ b/src/main/java/com/minecolonies/core/client/render/TileEntityNamedGraveRenderer.java @@ -1,7 +1,7 @@ package com.minecolonies.core.client.render; import com.minecolonies.api.blocks.ModBlocks; -import com.minecolonies.api.blocks.huts.AbstractBlockMinecoloniesDefault; +import com.minecolonies.core.blocks.BlockScarecrow; import com.minecolonies.core.tileentities.TileEntityNamedGrave; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.math.Axis; @@ -55,9 +55,9 @@ public void render(@NotNull final TileEntityNamedGrave tileEntity, final float p if(tileEntity != null) { final BlockState state = tileEntity.getLevel().getBlockState(tileEntity.getBlockPos()); - if (state.getBlock() == ModBlocks.blockNamedGrave) + if (state.getBlock() == ModBlocks.blockNamedGrave.get()) { - final Direction facing = state.getValue(AbstractBlockMinecoloniesDefault.FACING); + final Direction facing = state.getValue(BlockScarecrow.FACING); switch (facing) { case NORTH: diff --git a/src/main/java/com/minecolonies/core/client/render/TileEntityScarecrowRenderer.java b/src/main/java/com/minecolonies/core/client/render/TileEntityScarecrowRenderer.java index a17a13628c1..94c5126e899 100755 --- a/src/main/java/com/minecolonies/core/client/render/TileEntityScarecrowRenderer.java +++ b/src/main/java/com/minecolonies/core/client/render/TileEntityScarecrowRenderer.java @@ -1,6 +1,5 @@ package com.minecolonies.core.client.render; -import com.minecolonies.api.blocks.huts.AbstractBlockMinecoloniesDefault; import com.minecolonies.api.tileentities.AbstractTileEntityScarecrow; import com.minecolonies.api.tileentities.ScareCrowType; import com.minecolonies.api.util.constant.Constants; @@ -110,7 +109,7 @@ public void render( //In the case of worldLags tileEntities may sometimes disappear. if (te.getLevel().getBlockState(te.getBlockPos()).getBlock() instanceof BlockScarecrow) { - final Direction facing = te.getLevel().getBlockState(te.getBlockPos()).getValue(AbstractBlockMinecoloniesDefault.FACING); + final Direction facing = te.getLevel().getBlockState(te.getBlockPos()).getValue(BlockScarecrow.FACING); switch (facing) { case EAST: diff --git a/src/main/java/com/minecolonies/core/client/render/worldevent/ColonyBlueprintRenderer.java b/src/main/java/com/minecolonies/core/client/render/worldevent/ColonyBlueprintRenderer.java index a36fe7de299..ba2e2d783fa 100644 --- a/src/main/java/com/minecolonies/core/client/render/worldevent/ColonyBlueprintRenderer.java +++ b/src/main/java/com/minecolonies/core/client/render/worldevent/ColonyBlueprintRenderer.java @@ -380,7 +380,7 @@ public boolean isEnabled(final WorldEventContext ctx) { return RenderingCache.hasBlueprint("blueprint") && MinecoloniesAPIProxy.getInstance().getConfig().getClient().neighborbuildingrendering.get() && - ctx.mainHandItem.getItem() == buildTool.get(); + ctx.mainHandItem.is(buildTool); } @Override diff --git a/src/main/java/com/minecolonies/core/client/render/worldevent/ColonyBorderRenderer.java b/src/main/java/com/minecolonies/core/client/render/worldevent/ColonyBorderRenderer.java index 57438808d3f..8b727773067 100644 --- a/src/main/java/com/minecolonies/core/client/render/worldevent/ColonyBorderRenderer.java +++ b/src/main/java/com/minecolonies/core/client/render/worldevent/ColonyBorderRenderer.java @@ -39,7 +39,7 @@ public class ColonyBorderRenderer static void render(final WorldEventContext ctx) { - if (ctx.mainHandItem.getItem() != ModItems.buildTool.get() || !ctx.hasNearestColony()) + if (!ctx.mainHandItem.is(ModItems.buildTool) || !ctx.hasNearestColony()) { return; } diff --git a/src/main/java/com/minecolonies/core/client/render/worldevent/ColonyPatrolPointRenderer.java b/src/main/java/com/minecolonies/core/client/render/worldevent/ColonyPatrolPointRenderer.java index bf5058f1810..d2ff2ad314f 100644 --- a/src/main/java/com/minecolonies/core/client/render/worldevent/ColonyPatrolPointRenderer.java +++ b/src/main/java/com/minecolonies/core/client/render/worldevent/ColonyPatrolPointRenderer.java @@ -30,7 +30,7 @@ public class ColonyPatrolPointRenderer */ static void render(final WorldEventContext ctx) { - if (ctx.mainHandItem.getItem() != ModItems.scepterGuard) + if (ctx.mainHandItem.getItem() != ModItems.scepterGuard.get()) { return; } diff --git a/src/main/java/com/minecolonies/core/client/render/worldevent/GuardTowerRallyBannerRenderer.java b/src/main/java/com/minecolonies/core/client/render/worldevent/GuardTowerRallyBannerRenderer.java index f6eba2a1027..5104b2ae56f 100644 --- a/src/main/java/com/minecolonies/core/client/render/worldevent/GuardTowerRallyBannerRenderer.java +++ b/src/main/java/com/minecolonies/core/client/render/worldevent/GuardTowerRallyBannerRenderer.java @@ -14,7 +14,7 @@ public class GuardTowerRallyBannerRenderer */ static void render(final WorldEventContext ctx) { - if (ctx.mainHandItem.getItem() != ModItems.bannerRallyGuards) + if (!ctx.mainHandItem.is(ModItems.bannerRallyGuards)) { return; } diff --git a/src/main/java/com/minecolonies/core/colony/Colony.java b/src/main/java/com/minecolonies/core/colony/Colony.java index 310abd5c006..20487955db6 100644 --- a/src/main/java/com/minecolonies/core/colony/Colony.java +++ b/src/main/java/com/minecolonies/core/colony/Colony.java @@ -1213,7 +1213,7 @@ private boolean updateWayPoints() { final Block worldBlock = world.getBlockState(entry.getKey()).getBlock(); if ( - ((worldBlock != (entry.getValue().getBlock()) && entry.getValue().getBlock() != ModBlocks.blockWayPoint) && worldBlock != ModBlocks.blockConstructionTape) + ((worldBlock != (entry.getValue().getBlock()) && entry.getValue().getBlock() != ModBlocks.blockWayPoint.get()) && worldBlock != ModBlocks.blockConstructionTape.get()) || (world.isEmptyBlock(entry.getKey().below()) && !BlockUtils.isAnySolid(entry.getValue()))) { wayPoints.remove(entry.getKey()); diff --git a/src/main/java/com/minecolonies/core/colony/buildings/modules/BuildingModules.java b/src/main/java/com/minecolonies/core/colony/buildings/modules/BuildingModules.java index e3042e3e050..511a181801a 100644 --- a/src/main/java/com/minecolonies/core/colony/buildings/modules/BuildingModules.java +++ b/src/main/java/com/minecolonies/core/colony/buildings/modules/BuildingModules.java @@ -149,7 +149,7 @@ public class BuildingModules .with(BuildingBeekeeper.MODE, new BeekeeperCollectionSetting(BuildingBeekeeper.HONEYCOMB, BuildingBeekeeper.HONEY, BuildingBeekeeper.BOTH)), () -> SettingsModuleView::new); public static final BuildingEntry.ModuleProducer BEEKEEPER_TOOL = - new BuildingEntry.ModuleProducer<>("beekeeper_tool", null, () -> () -> new ToolModuleView(ModItems.scepterBeekeeper)); + new BuildingEntry.ModuleProducer<>("beekeeper_tool", null, () -> () -> new ToolModuleView(ModItems.scepterBeekeeper.get())); public static final BuildingEntry.ModuleProducer BEEKEEPER_HERDING = new BuildingEntry.ModuleProducer<>("beekeeper_herding", BuildingBeekeeper.HerdingModule::new, null); @@ -443,7 +443,7 @@ public class BuildingModules .with(BuildingLumberjack.DYNAMIC_TREES_SIZE, new DynamicTreesSetting()) .with(AbstractBuilding.USE_SHEARS, new BoolSetting(false)), () -> SettingsModuleView::new); public static final BuildingEntry.ModuleProducer FORESTER_TOOL = - new BuildingEntry.ModuleProducer<>("forester_zone", null, () -> () -> new ToolModuleView(ModItems.scepterLumberjack)); + new BuildingEntry.ModuleProducer<>("forester_zone", null, () -> () -> new ToolModuleView(ModItems.scepterLumberjack.get())); public static final BuildingEntry.ModuleProducer HEALER_WORK = new BuildingEntry.ModuleProducer<>("healer_work", @@ -528,7 +528,7 @@ public class BuildingModules public static final BuildingEntry.ModuleProducer GUARD_TOOL = new BuildingEntry.ModuleProducer<>("tool_scepterguard_view", null, () -> () -> new ToolModuleView( - ModItems.scepterGuard)); + ModItems.scepterGuard.get())); public static final BuildingEntry.ModuleProducer GUARD_SETTINGS = new BuildingEntry.ModuleProducer<>("guard_settings", () -> new SettingsModule() .with(AbstractBuildingGuards.GUARD_TASK, new GuardTaskSetting(GuardTaskSetting.PATROL, GuardTaskSetting.GUARD, GuardTaskSetting.FOLLOW, GuardTaskSetting.PATROL_MINE)) .with(AbstractBuildingGuards.RETREAT, new BoolSetting(true)) diff --git a/src/main/java/com/minecolonies/core/colony/buildings/modules/GraveyardManagementModule.java b/src/main/java/com/minecolonies/core/colony/buildings/modules/GraveyardManagementModule.java index dbdd3fe6abc..7745971f2d3 100644 --- a/src/main/java/com/minecolonies/core/colony/buildings/modules/GraveyardManagementModule.java +++ b/src/main/java/com/minecolonies/core/colony/buildings/modules/GraveyardManagementModule.java @@ -181,7 +181,7 @@ public void buryCitizenHere(final Tuple positionAndDirectio colony.getWorld().destroyBlock(positionAndDirection.getA(), true, worker); colony.getWorld().setBlockAndUpdate(positionAndDirection.getA(), - ModBlocks.blockNamedGrave.defaultBlockState().setValue(AbstractBlockMinecoloniesNamedGrave.FACING, facing)); + ModBlocks.blockNamedGrave.get().defaultBlockState().setValue(AbstractBlockMinecoloniesNamedGrave.FACING, facing)); BlockEntity tileEntity = colony.getWorld().getBlockEntity(positionAndDirection.getA()); if (tileEntity instanceof TileEntityNamedGrave) diff --git a/src/main/java/com/minecolonies/core/colony/buildings/workerbuildings/BuildingAlchemist.java b/src/main/java/com/minecolonies/core/colony/buildings/workerbuildings/BuildingAlchemist.java index 428ac265c86..2cbc41c2be3 100644 --- a/src/main/java/com/minecolonies/core/colony/buildings/workerbuildings/BuildingAlchemist.java +++ b/src/main/java/com/minecolonies/core/colony/buildings/workerbuildings/BuildingAlchemist.java @@ -243,7 +243,7 @@ public boolean isRecipeCompatible(@NotNull final IGenericRecipe recipe) if (!super.isRecipeCompatible(recipe)) return false; - return recipe.getPrimaryOutput().getItem() == ModItems.magicpotion; + return recipe.getPrimaryOutput().is(ModItems.magicpotion); } @Override @@ -258,7 +258,7 @@ public Set getSupportedCraftingTypes() final List recipes = new ArrayList<>(super.getAdditionalRecipesForDisplayPurposesOnly(world)); // growing mistletoe - recipes.add(new GenericRecipe(null, new ItemStack(ModItems.mistletoe), + recipes.add(new GenericRecipe(null, ModItems.mistletoe.toStack(), Collections.emptyList(), Collections.emptyList(), 1, Blocks.OAK_LEAVES, diff --git a/src/main/java/com/minecolonies/core/colony/buildings/workerbuildings/BuildingBarracks.java b/src/main/java/com/minecolonies/core/colony/buildings/workerbuildings/BuildingBarracks.java index 10bc64208d8..bf2e1de477a 100755 --- a/src/main/java/com/minecolonies/core/colony/buildings/workerbuildings/BuildingBarracks.java +++ b/src/main/java/com/minecolonies/core/colony/buildings/workerbuildings/BuildingBarracks.java @@ -114,7 +114,7 @@ public void onUpgradeComplete(final int newLevel) public void registerBlockPosition(@NotNull final BlockState block, @NotNull final BlockPos pos, @NotNull final Level world) { super.registerBlockPosition(block, pos, world); - if (block.getBlock() == ModBlocks.blockHutBarracksTower) + if (block.getBlock() == ModBlocks.blockHutBarracksTower.get()) { final IBuilding building = getColony().getBuildingManager().getBuilding(pos); if (building instanceof BuildingBarracksTower) diff --git a/src/main/java/com/minecolonies/core/colony/buildings/workerbuildings/BuildingComposter.java b/src/main/java/com/minecolonies/core/colony/buildings/workerbuildings/BuildingComposter.java index 8a4b12e3f1e..b8181c822b9 100755 --- a/src/main/java/com/minecolonies/core/colony/buildings/workerbuildings/BuildingComposter.java +++ b/src/main/java/com/minecolonies/core/colony/buildings/workerbuildings/BuildingComposter.java @@ -106,7 +106,7 @@ public int getMaxBuildingLevel() public void registerBlockPosition(@NotNull final Block block, @NotNull final BlockPos pos, @NotNull final Level world) { super.registerBlockPosition(block, pos, world); - if (block == ModBlocks.blockBarrel && !barrels.contains(pos)) + if (block == ModBlocks.blockBarrel.get() && !barrels.contains(pos)) { barrels.add(pos); } diff --git a/src/main/java/com/minecolonies/core/colony/buildings/workerbuildings/BuildingCowboy.java b/src/main/java/com/minecolonies/core/colony/buildings/workerbuildings/BuildingCowboy.java index 1823670e442..e4b4928ba8e 100755 --- a/src/main/java/com/minecolonies/core/colony/buildings/workerbuildings/BuildingCowboy.java +++ b/src/main/java/com/minecolonies/core/colony/buildings/workerbuildings/BuildingCowboy.java @@ -118,9 +118,9 @@ public boolean canEat(final ItemStack stack) */ public ItemStack getMilkInputItem() { - if (getSetting(MILK_ITEM).getValue().equals(ModItems.large_milk_bottle.getDescriptionId())) + if (getSetting(MILK_ITEM).getValue().equals(ModItems.large_milk_bottle.get().getDescriptionId())) { - return ModItems.large_empty_bottle.getDefaultInstance(); + return ModItems.large_empty_bottle.toStack(); } return Items.BUCKET.getDefaultInstance(); } @@ -131,9 +131,9 @@ public ItemStack getMilkInputItem() */ public ItemStack getMilkOutputItem() { - if (getSetting(MILK_ITEM).getValue().equals(ModItems.large_milk_bottle.getDescriptionId())) + if (getSetting(MILK_ITEM).getValue().equals(ModItems.large_milk_bottle.get().getDescriptionId())) { - return ModItems.large_milk_bottle.getDefaultInstance(); + return ModItems.large_milk_bottle.toStack(); } return Items.MILK_BUCKET.getDefaultInstance(); } @@ -201,10 +201,10 @@ else if (animal instanceof Cow) Collections.singletonList(Collections.singletonList(new ItemStack(Items.BUCKET))), // input 1, Blocks.AIR, null, ToolType.NONE, animal, Collections.emptyList(), 0)); recipes.add(new GenericRecipe(null, - new ItemStack(ModItems.large_milk_bottle), // output + ModItems.large_milk_bottle.toStack(), // output Collections.emptyList(), // alt output Collections.emptyList(), // extra output - Collections.singletonList(Collections.singletonList(new ItemStack(ModItems.large_empty_bottle))), // input + Collections.singletonList(Collections.singletonList(ModItems.large_empty_bottle.toStack())), // input 1, Blocks.AIR, null, ToolType.NONE, animal, Collections.emptyList(), 0)); } diff --git a/src/main/java/com/minecolonies/core/colony/buildings/workerbuildings/BuildingEnchanter.java b/src/main/java/com/minecolonies/core/colony/buildings/workerbuildings/BuildingEnchanter.java index 418e54f4a74..aa1336ec7ea 100755 --- a/src/main/java/com/minecolonies/core/colony/buildings/workerbuildings/BuildingEnchanter.java +++ b/src/main/java/com/minecolonies/core/colony/buildings/workerbuildings/BuildingEnchanter.java @@ -36,7 +36,7 @@ public class BuildingEnchanter extends AbstractBuilding public BuildingEnchanter(@NotNull final IColony c, final BlockPos l) { super(c, l); - keepX.put((stack) -> stack.getItem() == ModItems.ancientTome, new Tuple<>(STACKSIZE, true)); + keepX.put((stack) -> stack.is(ModItems.ancientTome), new Tuple<>(STACKSIZE, true)); } @NotNull diff --git a/src/main/java/com/minecolonies/core/colony/buildings/workerbuildings/BuildingFlorist.java b/src/main/java/com/minecolonies/core/colony/buildings/workerbuildings/BuildingFlorist.java index 1806bbc8358..49e3fd0662d 100755 --- a/src/main/java/com/minecolonies/core/colony/buildings/workerbuildings/BuildingFlorist.java +++ b/src/main/java/com/minecolonies/core/colony/buildings/workerbuildings/BuildingFlorist.java @@ -65,7 +65,7 @@ public class BuildingFlorist extends AbstractBuilding public BuildingFlorist(@NotNull final IColony c, final BlockPos l) { super(c, l); - keepX.put((stack) -> stack.getItem() == ModItems.compost, new Tuple<>(STACKSIZE, true)); + keepX.put((stack) -> stack.is(ModItems.compost), new Tuple<>(STACKSIZE, true)); } /** @@ -95,7 +95,7 @@ public int getMaxBuildingLevel() public void registerBlockPosition(@NotNull final Block block, @NotNull final BlockPos pos, @NotNull final Level world) { super.registerBlockPosition(block, pos, world); - if (block == ModBlocks.blockCompostedDirt && !plantGround.contains(pos)) + if (block == ModBlocks.blockCompostedDirt.get() && !plantGround.contains(pos)) { plantGround.add(pos); } diff --git a/src/main/java/com/minecolonies/core/colony/buildings/workerbuildings/BuildingGraveyard.java b/src/main/java/com/minecolonies/core/colony/buildings/workerbuildings/BuildingGraveyard.java index be0adbe1fda..ea0047077de 100644 --- a/src/main/java/com/minecolonies/core/colony/buildings/workerbuildings/BuildingGraveyard.java +++ b/src/main/java/com/minecolonies/core/colony/buildings/workerbuildings/BuildingGraveyard.java @@ -190,7 +190,7 @@ public int getMaxBuildingLevel() public void registerBlockPosition(@NotNull final BlockState state, @NotNull final BlockPos pos, @NotNull final Level world) { super.registerBlockPosition(state, pos, world); - if (state.getBlock() == ModBlocks.blockNamedGrave) + if (state.getBlock() == ModBlocks.blockNamedGrave.get()) { visualGravePositions.add(new Tuple<>(pos, state.getValue(AbstractBlockMinecoloniesNamedGrave.FACING))); } diff --git a/src/main/java/com/minecolonies/core/colony/buildings/workerbuildings/plantation/modules/generic/BoneMealedPlantModule.java b/src/main/java/com/minecolonies/core/colony/buildings/workerbuildings/plantation/modules/generic/BoneMealedPlantModule.java index b28d023be8a..6e174ef4103 100644 --- a/src/main/java/com/minecolonies/core/colony/buildings/workerbuildings/plantation/modules/generic/BoneMealedPlantModule.java +++ b/src/main/java/com/minecolonies/core/colony/buildings/workerbuildings/plantation/modules/generic/BoneMealedPlantModule.java @@ -186,6 +186,6 @@ protected int getMaxWorkingPositions() @Override public List getValidBonemeal() { - return List.of(Items.BONE_MEAL, ModItems.compost); + return List.of(Items.BONE_MEAL, ModItems.compost.get()); } } \ No newline at end of file diff --git a/src/main/java/com/minecolonies/core/colony/crafting/LootTableAnalyzer.java b/src/main/java/com/minecolonies/core/colony/crafting/LootTableAnalyzer.java index 30114a1d1af..e2d6c61cafc 100644 --- a/src/main/java/com/minecolonies/core/colony/crafting/LootTableAnalyzer.java +++ b/src/main/java/com/minecolonies/core/colony/crafting/LootTableAnalyzer.java @@ -176,7 +176,7 @@ private static List entryToDrops(@NotNull final HolderLookup.Provider modifier = result.getB(); } modifier = adjustModifier(modifier, conditions); - if (stack.getItem().equals(ModItems.adventureToken)) + if (stack.is(ModItems.adventureToken)) { final List mobDrops = expandAdventureToken(provider, stack); for (final LootDrop drop : mobDrops) diff --git a/src/main/java/com/minecolonies/core/colony/managers/GraveManager.java b/src/main/java/com/minecolonies/core/colony/managers/GraveManager.java index 17f2dc90e50..4816f023cc5 100644 --- a/src/main/java/com/minecolonies/core/colony/managers/GraveManager.java +++ b/src/main/java/com/minecolonies/core/colony/managers/GraveManager.java @@ -292,7 +292,7 @@ public boolean createCitizenGrave(final Level world, final BlockPos pos, final I if (firstValidPosition != null) { world.setBlockAndUpdate(firstValidPosition, - BlockMinecoloniesGrave.getPlacementState(ModBlocks.blockGrave.defaultBlockState(), firstValidPosition)); + BlockMinecoloniesGrave.getPlacementState(ModBlocks.blockGrave.get().defaultBlockState(), firstValidPosition)); final TileEntityGrave graveEntity = (TileEntityGrave) world.getBlockEntity(firstValidPosition); if (!InventoryUtils.transferAllItemHandler(citizenData.getInventory(), graveEntity.getInventory())) { diff --git a/src/main/java/com/minecolonies/core/colony/permissions/ColonyPermissionEventHandler.java b/src/main/java/com/minecolonies/core/colony/permissions/ColonyPermissionEventHandler.java index 95aecaef483..cff02944410 100755 --- a/src/main/java/com/minecolonies/core/colony/permissions/ColonyPermissionEventHandler.java +++ b/src/main/java/com/minecolonies/core/colony/permissions/ColonyPermissionEventHandler.java @@ -255,7 +255,7 @@ public void on(final BlockEvent.BreakEvent event) return; } - if (event.getState().getBlock() == ModBlocks.blockHutTownHall && !((BlockHutTownHall)event.getState().getBlock()).getValidBreak() && !event.getPlayer().isCreative()) + if (event.getState().getBlock() == ModBlocks.blockHutTownHall.get() && !((BlockHutTownHall)event.getState().getBlock()).getValidBreak() && !event.getPlayer().isCreative()) { cancelEvent(event, event.getPlayer(), colony, Action.BREAK_HUTS, event.getPos()); return; @@ -271,7 +271,7 @@ public void on(final BlockEvent.BreakEvent event) building.destroy(); - if (MineColonies.getConfig().getServer().pvp_mode.get() && event.getState().getBlock() == ModBlocks.blockHutTownHall) + if (MineColonies.getConfig().getServer().pvp_mode.get() && event.getState().getBlock() == ModBlocks.blockHutTownHall.get()) { IColonyManager.getInstance().deleteColonyByWorld(building.getColony().getID(), false, world); } diff --git a/src/main/java/com/minecolonies/core/commands/generalcommands/CommandResetPlayerSupplies.java b/src/main/java/com/minecolonies/core/commands/generalcommands/CommandResetPlayerSupplies.java index fdc0eae8f00..b2dba8776a3 100755 --- a/src/main/java/com/minecolonies/core/commands/generalcommands/CommandResetPlayerSupplies.java +++ b/src/main/java/com/minecolonies/core/commands/generalcommands/CommandResetPlayerSupplies.java @@ -42,7 +42,7 @@ public int onExecute(final CommandContext context) return 0; } - player.awardStat(Stats.ITEM_USED.get(ModItems.supplyChest), -1); + player.awardStat(Stats.ITEM_USED.get(ModItems.supplyChest.get()), -1); context.getSource().sendSuccess(() -> Component.translatableEscape(COMMAND_RESET_SUPPLY_SUCCESS), true); MessageUtils.format(COMMAND_RESET_SUPPLY_SUCCESS).sendTo(player); return 1; diff --git a/src/main/java/com/minecolonies/core/compatibility/jei/CompostRecipeCategory.java b/src/main/java/com/minecolonies/core/compatibility/jei/CompostRecipeCategory.java index eb6e1b2e4c0..52034b44ed4 100644 --- a/src/main/java/com/minecolonies/core/compatibility/jei/CompostRecipeCategory.java +++ b/src/main/java/com/minecolonies/core/compatibility/jei/CompostRecipeCategory.java @@ -39,7 +39,7 @@ public class CompostRecipeCategory implements IRecipeCategory public CompostRecipeCategory(@NotNull final IGuiHelper guiHelper) { - this.title = Component.translatableEscape(ModBlocks.blockBarrel.getDescriptionId()).getString(); + this.title = Component.translatableEscape(ModBlocks.blockBarrel.get().getDescriptionId()).getString(); this.background = guiHelper.createBlankDrawable(80, 50); this.icon = guiHelper.createDrawableIngredient(VanillaTypes.ITEM_STACK, new ItemStack(ModBlocks.blockBarrel)); @@ -104,7 +104,7 @@ public void draw(@NotNull final CompostRecipe recipe, final double mouseX, final double mouseY) { final BarrelType type = BarrelType.byMetadata(this.timer.getValue()); - final BlockState barrel = ModBlocks.blockBarrel.defaultBlockState() + final BlockState barrel = ModBlocks.blockBarrel.get().defaultBlockState() .setValue(AbstractBlockBarrel.FACING, Direction.SOUTH) .setValue(AbstractBlockBarrel.VARIANT, type); RenderHelper.renderBlock(stack, barrel, 40, 20, 100, -30F, 20F, 25F); diff --git a/src/main/java/com/minecolonies/core/compatibility/jei/ToolRecipeCategory.java b/src/main/java/com/minecolonies/core/compatibility/jei/ToolRecipeCategory.java index d54d0236d50..7c76bc67a8e 100644 --- a/src/main/java/com/minecolonies/core/compatibility/jei/ToolRecipeCategory.java +++ b/src/main/java/com/minecolonies/core/compatibility/jei/ToolRecipeCategory.java @@ -45,7 +45,7 @@ public class ToolRecipeCategory implements IRecipeCategory public ToolRecipeCategory(@NotNull final IGuiHelper guiHelper) { this.background = guiHelper.createBlankDrawable(WIDTH, HEIGHT); - this.icon = guiHelper.createDrawableItemStack(new ItemStack(ModItems.plateArmorChest)); + this.icon = guiHelper.createDrawableItemStack(ModItems.plateArmorChest.toStack()); this.slot = guiHelper.getSlotDrawable(); } diff --git a/src/main/java/com/minecolonies/core/entity/ai/workers/AbstractEntityAIStructure.java b/src/main/java/com/minecolonies/core/entity/ai/workers/AbstractEntityAIStructure.java index ad76ab10a28..b9455b3cc50 100755 --- a/src/main/java/com/minecolonies/core/entity/ai/workers/AbstractEntityAIStructure.java +++ b/src/main/java/com/minecolonies/core/entity/ai/workers/AbstractEntityAIStructure.java @@ -984,7 +984,7 @@ public static boolean isBlockFree(@Nullable final BlockState block) return block == null || BlockUtils.isWater(block) || block.is(BlockTags.LEAVES) - || block.getBlock() == ModBlocks.blockDecorationPlaceholder; + || block.getBlock() == ModBlocks.blockDecorationPlaceholder.get(); } /** diff --git a/src/main/java/com/minecolonies/core/entity/ai/workers/crafting/EntityAIWorkAlchemist.java b/src/main/java/com/minecolonies/core/entity/ai/workers/crafting/EntityAIWorkAlchemist.java index 2c91694d3dc..f6ce107af87 100644 --- a/src/main/java/com/minecolonies/core/entity/ai/workers/crafting/EntityAIWorkAlchemist.java +++ b/src/main/java/com/minecolonies/core/entity/ai/workers/crafting/EntityAIWorkAlchemist.java @@ -265,7 +265,7 @@ private IAIState harvestMistleToe() if (worker.getRandom().nextInt(120) < 1) { worker.decreaseSaturationForContinuousAction(); - InventoryUtils.addItemStackToItemHandler(worker.getInventoryCitizen(), new ItemStack(ModItems.mistletoe, 1)); + InventoryUtils.addItemStackToItemHandler(worker.getInventoryCitizen(), ModItems.mistletoe.toStack()); walkTo = null; worker.getCitizenItemHandler().damageItemInHand(InteractionHand.MAIN_HAND, 1); return INVENTORY_FULL; diff --git a/src/main/java/com/minecolonies/core/entity/ai/workers/guard/DruidCombatAI.java b/src/main/java/com/minecolonies/core/entity/ai/workers/guard/DruidCombatAI.java index 069972131e8..f2d12e3e26f 100644 --- a/src/main/java/com/minecolonies/core/entity/ai/workers/guard/DruidCombatAI.java +++ b/src/main/java/com/minecolonies/core/entity/ai/workers/guard/DruidCombatAI.java @@ -136,7 +136,7 @@ protected void doAttack(final LivingEntity target) boolean gotMaterial = false; BiPredicate predicate; if (user.getCitizenColonyHandler().getColony().getResearchManager().getResearchEffects().getEffectStrength(DRUID_USE_POTIONS) > 0 - && InventoryUtils.hasItemInItemHandler(user.getInventoryCitizen(), item -> item.getItem() == ModItems.magicpotion)) + && InventoryUtils.hasItemInItemHandler(user.getInventoryCitizen(), item -> item.is(ModItems.magicpotion))) { gotMaterial = true; } @@ -156,7 +156,7 @@ protected void doAttack(final LivingEntity target) if (gotMaterial) { - InventoryUtils.removeStackFromItemHandler(user.getCitizenData().getInventory(), new ItemStack(ModItems.magicpotion, 1), 1); + InventoryUtils.removeStackFromItemHandler(user.getCitizenData().getInventory(), ModItems.magicpotion.toStack(), 1); } this.instantEffect = effect.value().isInstantenous(); diff --git a/src/main/java/com/minecolonies/core/entity/ai/workers/guard/EntityAIDruid.java b/src/main/java/com/minecolonies/core/entity/ai/workers/guard/EntityAIDruid.java index 99f9e09561b..b1e3d0d14c9 100644 --- a/src/main/java/com/minecolonies/core/entity/ai/workers/guard/EntityAIDruid.java +++ b/src/main/java/com/minecolonies/core/entity/ai/workers/guard/EntityAIDruid.java @@ -51,13 +51,13 @@ protected void atBuildingActions() { // Mistletoes and water bottles InventoryUtils.transferXOfFirstSlotInProviderWithIntoNextFreeSlotInItemHandler(building, - item -> item.getItem() == ModItems.magicpotion, + item -> item.is(ModItems.magicpotion), 32, worker.getInventoryCitizen()); - if (InventoryUtils.getItemCountInItemHandler(worker.getInventoryCitizen(), item -> item.getItem() == ModItems.magicpotion) < 8) + if (InventoryUtils.getItemCountInItemHandler(worker.getInventoryCitizen(), item -> item.is(ModItems.magicpotion)) < 8) { - checkIfRequestForItemExistOrCreateAsync(new ItemStack(ModItems.magicpotion), 16, 8); + checkIfRequestForItemExistOrCreateAsync(ModItems.magicpotion.toStack(), 16, 8); } } } diff --git a/src/main/java/com/minecolonies/core/entity/ai/workers/production/agriculture/EntityAIWorkFarmer.java b/src/main/java/com/minecolonies/core/entity/ai/workers/production/agriculture/EntityAIWorkFarmer.java index 50cb3cf4a66..9a1058c8ee5 100755 --- a/src/main/java/com/minecolonies/core/entity/ai/workers/production/agriculture/EntityAIWorkFarmer.java +++ b/src/main/java/com/minecolonies/core/entity/ai/workers/production/agriculture/EntityAIWorkFarmer.java @@ -232,7 +232,7 @@ private IAIState prepareForFarming() if (building.requestFertilizer() && !building.hasWorkerOpenRequestsOfType(worker.getCitizenData().getId(), TypeToken.of(StackList.class))) { final List compostAbleItems = new ArrayList<>(); - compostAbleItems.add(new ItemStack(ModItems.compost, 1)); + compostAbleItems.add(ModItems.compost.toStack()); compostAbleItems.add(new ItemStack(Items.BONE_MEAL, 1)); worker.getCitizenData().createRequestAsync(new StackList(compostAbleItems, RequestSystemTranslationConstants.REQUEST_TYPE_FERTILIZER, STACKSIZE, 1)); } @@ -284,11 +284,11 @@ else if (farmField.getFieldStage() == FarmField.Stage.EMPTY && checkIfShouldExec */ private boolean isCompost(final ItemStack itemStack) { - if (itemStack.getItem() == ModItems.compost) + if (itemStack.is(ModItems.compost)) { return true; } - return itemStack.getItem() == Items.BONE_MEAL; + return itemStack.is(Items.BONE_MEAL); } /** diff --git a/src/main/java/com/minecolonies/core/entity/ai/workers/production/agriculture/EntityAIWorkFlorist.java b/src/main/java/com/minecolonies/core/entity/ai/workers/production/agriculture/EntityAIWorkFlorist.java index 893bba8bd8c..37b35bbbda0 100755 --- a/src/main/java/com/minecolonies/core/entity/ai/workers/production/agriculture/EntityAIWorkFlorist.java +++ b/src/main/java/com/minecolonies/core/entity/ai/workers/production/agriculture/EntityAIWorkFlorist.java @@ -169,7 +169,7 @@ private IAIState decide() } else { - checkIfRequestForItemExistOrCreateAsync(new ItemStack(ModItems.compost, COMPOST_REQUEST_QTY)); + checkIfRequestForItemExistOrCreateAsync(ModItems.compost.toStack(COMPOST_REQUEST_QTY)); } } diff --git a/src/main/java/com/minecolonies/core/entity/ai/workers/production/herders/EntityAIWorkCowboy.java b/src/main/java/com/minecolonies/core/entity/ai/workers/production/herders/EntityAIWorkCowboy.java index b8f5373e042..7a0fba996c3 100755 --- a/src/main/java/com/minecolonies/core/entity/ai/workers/production/herders/EntityAIWorkCowboy.java +++ b/src/main/java/com/minecolonies/core/entity/ai/workers/production/herders/EntityAIWorkCowboy.java @@ -70,7 +70,7 @@ public EntityAIWorkCowboy(@NotNull final JobCowboy job) protected void updateRenderMetaData() { String renderMeta = getState() == IDLE ? "" : RENDER_META_WORKING; - if (worker.getCitizenInventoryHandler().hasItemInInventory(Items.BUCKET) || worker.getCitizenInventoryHandler().hasItemInInventory(ModItems.large_empty_bottle)) + if (worker.getCitizenInventoryHandler().hasItemInInventory(Items.BUCKET) || worker.getCitizenInventoryHandler().hasItemInInventory(ModItems.large_empty_bottle.get())) { renderMeta += RENDER_META_BUCKET; } diff --git a/src/main/java/com/minecolonies/core/entity/ai/workers/service/EntityAIWorkEnchanter.java b/src/main/java/com/minecolonies/core/entity/ai/workers/service/EntityAIWorkEnchanter.java index 7d79daf17aa..c1bc9f3bef4 100755 --- a/src/main/java/com/minecolonies/core/entity/ai/workers/service/EntityAIWorkEnchanter.java +++ b/src/main/java/com/minecolonies/core/entity/ai/workers/service/EntityAIWorkEnchanter.java @@ -53,12 +53,12 @@ public class EntityAIWorkEnchanter extends AbstractEntityAICrafting IS_ANCIENT_TOME = item -> !item.isEmpty() && item.getItem() == ModItems.ancientTome; + private static final Predicate IS_ANCIENT_TOME = item -> !item.isEmpty() && item.is(ModItems.ancientTome); /** * Predicate to define an ancient tome which can be enchanted. */ - private static final Predicate IS_BOOK = item -> !item.isEmpty() && item.getItem() == Items.BOOK; + private static final Predicate IS_BOOK = item -> !item.isEmpty() && item.is(Items.BOOK); /** * Min distance to drain from citizen. @@ -177,7 +177,7 @@ protected IAIState decide() for (final IToken token : craftingModule.getRecipes()) { final IRecipeStorage storage = IColonyManager.getInstance().getRecipeManager().getRecipes().get(token); - if (storage != null && !storage.getInput().isEmpty() && storage.getInput().get(0).getItem() == ModItems.ancientTome && craftingModule.isDisabled(token)) + if (storage != null && !storage.getInput().isEmpty() && storage.getInput().get(0).is(ModItems.ancientTome) && craftingModule.isDisabled(token)) { ancientTomeCraftingDisabled = true; } @@ -194,7 +194,7 @@ protected IAIState decide() needsCurrently = new Tuple<>(IS_ANCIENT_TOME, 1); return GATHERING_REQUIRED_MATERIALS; } - checkIfRequestForItemExistOrCreateAsync(new ItemStack(ModItems.ancientTome, 1), 1, 1, false); + checkIfRequestForItemExistOrCreateAsync(ModItems.ancientTome.toStack(), 1, 1, false); return IDLE; } } diff --git a/src/main/java/com/minecolonies/core/entity/ai/workers/util/BuildingStructureHandler.java b/src/main/java/com/minecolonies/core/entity/ai/workers/util/BuildingStructureHandler.java index 8a5ee1c61fb..494f4b30523 100755 --- a/src/main/java/com/minecolonies/core/entity/ai/workers/util/BuildingStructureHandler.java +++ b/src/main/java/com/minecolonies/core/entity/ai/workers/util/BuildingStructureHandler.java @@ -222,7 +222,7 @@ public void triggerSuccess(final BlockPos pos, final List list, final structureAI.getWorker().queueSound(state.getSoundType().getPlaceSound(), worldPos, 10, 0); } - if (state.getBlock() == ModBlocks.blockWayPoint) + if (state.getBlock() == ModBlocks.blockWayPoint.get()) { structureAI.getWorker().getCitizenColonyHandler().getColony().addWayPoint(worldPos, state); } @@ -347,7 +347,7 @@ public boolean shouldBlocksBeConsideredEqual(final BlockState state1, final Bloc return (block1 == Blocks.GRASS_BLOCK && block2 == Blocks.DIRT) || (block2 == Blocks.GRASS_BLOCK && block1 == Blocks.DIRT) - || (block1 == ModBlocks.blockRack && block2 == ModBlocks.blockRack); + || (block1 == ModBlocks.blockRack.get() && block2 == ModBlocks.blockRack.get()); } /** diff --git a/src/main/java/com/minecolonies/core/entity/ai/workers/util/ConstructionTapeHelper.java b/src/main/java/com/minecolonies/core/entity/ai/workers/util/ConstructionTapeHelper.java index 880c5a63fd0..6d6b3e30a2a 100755 --- a/src/main/java/com/minecolonies/core/entity/ai/workers/util/ConstructionTapeHelper.java +++ b/src/main/java/com/minecolonies/core/entity/ai/workers/util/ConstructionTapeHelper.java @@ -14,8 +14,8 @@ import net.minecraft.core.Direction; import net.minecraft.util.Tuple; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.state.BlockState; +import net.neoforged.neoforge.registries.DeferredBlock; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -74,7 +74,7 @@ public static void placeConstructionTape(final Tuple orgCorn final Level world = colony.getWorld(); final Tuple corners = new Tuple<>(orgCorners.getA().offset(-1, 0, -1), orgCorners.getB().offset(1, 0, 1)); - final BlockState constructionTape = ModBlocks.blockConstructionTape.defaultBlockState(); + final BlockState constructionTape = ModBlocks.blockConstructionTape.get().defaultBlockState(); final int x = Math.min(corners.getA().getX(), corners.getB().getX()); final int y = Math.max(corners.getA().getY(), corners.getB().getY()); @@ -249,14 +249,14 @@ public static void removeConstructionTape(final Tuple orgCor public static void removeTapeIfNecessary( @NotNull final Level world, @NotNull final BlockPos block, - @NotNull final Block tapeOrTapeCorner, + @NotNull final DeferredBlock tapeOrTapeCorner, final int minHeight, final int maxHeight) { for (int y = minHeight; y <= maxHeight; y++) { final BlockPos newBlock = new BlockPos(block.getX(), y, block.getZ()); - if (world.getBlockState(newBlock).getBlock() == tapeOrTapeCorner) + if (world.getBlockState(newBlock).getBlock() == tapeOrTapeCorner.get()) { world.removeBlock(newBlock, false); break; diff --git a/src/main/java/com/minecolonies/core/entity/citizen/EntityCitizen.java b/src/main/java/com/minecolonies/core/entity/citizen/EntityCitizen.java index 2be1d2f2077..0f206692c71 100755 --- a/src/main/java/com/minecolonies/core/entity/citizen/EntityCitizen.java +++ b/src/main/java/com/minecolonies/core/entity/citizen/EntityCitizen.java @@ -788,10 +788,10 @@ private boolean updateVisualData() { if (hat.isEmpty()) { - this.setItemSlot(EquipmentSlot.HEAD, new ItemStack(ModItems.santaHat)); + this.setItemSlot(EquipmentSlot.HEAD, ModItems.santaHat.toStack()); } } - else if (!hat.isEmpty() && hat.getItem() == ModItems.santaHat) + else if (!hat.isEmpty() && hat.is(ModItems.santaHat)) { this.setItemSlot(EquipmentSlot.HEAD, ItemStackUtils.EMPTY); } diff --git a/src/main/java/com/minecolonies/core/entity/other/FireArrowEntity.java b/src/main/java/com/minecolonies/core/entity/other/FireArrowEntity.java index 3788b899161..a546c2ce5c7 100755 --- a/src/main/java/com/minecolonies/core/entity/other/FireArrowEntity.java +++ b/src/main/java/com/minecolonies/core/entity/other/FireArrowEntity.java @@ -31,6 +31,6 @@ public void setOwner(@Nullable final Entity shooter) @Override protected ItemStack getPickupItem() { - return new ItemStack(ModItems.firearrow, 1); + return ModItems.firearrow.toStack(); } } diff --git a/src/main/java/com/minecolonies/core/entity/other/SpearEntity.java b/src/main/java/com/minecolonies/core/entity/other/SpearEntity.java index a7d7d244a46..e688f72e7bd 100644 --- a/src/main/java/com/minecolonies/core/entity/other/SpearEntity.java +++ b/src/main/java/com/minecolonies/core/entity/other/SpearEntity.java @@ -57,7 +57,7 @@ public class SpearEntity extends ThrownTrident implements ICustomAttackSound /** * The weapon item stack, defaults to a generic ItemStack of the spear. */ - protected ItemStack weapon = new ItemStack(ModItems.spear); + protected ItemStack weapon = ModItems.spear.toStack(); /** * The value of damage the spear has dealt. diff --git a/src/main/java/com/minecolonies/core/entity/pathfinding/PathfindingUtils.java b/src/main/java/com/minecolonies/core/entity/pathfinding/PathfindingUtils.java index edfb59176b0..e8aa11633a7 100644 --- a/src/main/java/com/minecolonies/core/entity/pathfinding/PathfindingUtils.java +++ b/src/main/java/com/minecolonies/core/entity/pathfinding/PathfindingUtils.java @@ -2,9 +2,9 @@ import com.ldtteam.domumornamentum.block.decorative.PanelBlock; import com.ldtteam.domumornamentum.block.vanilla.TrapdoorBlock; -import com.minecolonies.api.blocks.huts.AbstractBlockMinecoloniesDefault; import com.minecolonies.api.entity.mobs.drownedpirate.AbstractDrownedEntityPirate; import com.minecolonies.api.items.ModTags; +import com.minecolonies.core.blocks.BlockScarecrow; import com.minecolonies.core.network.messages.client.SyncPathReachedMessage; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -130,7 +130,7 @@ public static BlockPos prepareStart(@NotNull final LivingEntity entity) bs = level.getBlockState(pos); } } - else if (b instanceof FenceBlock || b instanceof WallBlock || b instanceof AbstractBlockMinecoloniesDefault || (bs.blocksMotion() && !canStandInSolidBlock(bs))) + else if (b instanceof FenceBlock || b instanceof WallBlock || b instanceof BlockScarecrow || (bs.blocksMotion() && !canStandInSolidBlock(bs))) { final VoxelShape shape = bs.getCollisionShape(level, pos); if (shape.isEmpty()) diff --git a/src/main/java/com/minecolonies/core/entity/pathfinding/SurfaceType.java b/src/main/java/com/minecolonies/core/entity/pathfinding/SurfaceType.java index f7a80f98ce1..7707cddadb2 100644 --- a/src/main/java/com/minecolonies/core/entity/pathfinding/SurfaceType.java +++ b/src/main/java/com/minecolonies/core/entity/pathfinding/SurfaceType.java @@ -5,8 +5,8 @@ import com.ldtteam.domumornamentum.block.vanilla.TrapdoorBlock; import com.ldtteam.structurize.util.BlockUtils; import com.minecolonies.api.blocks.decorative.AbstractBlockMinecoloniesConstructionTape; -import com.minecolonies.api.blocks.huts.AbstractBlockMinecoloniesDefault; import com.minecolonies.api.util.ShapeUtil; +import com.minecolonies.core.blocks.BlockScarecrow; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.level.BlockGetter; @@ -69,7 +69,7 @@ public static SurfaceType getSurfaceType(final BlockGetter world, final BlockSta if (block instanceof FenceBlock || block instanceof FenceGateBlock || block instanceof WallBlock - || block instanceof AbstractBlockMinecoloniesDefault + || block instanceof BlockScarecrow || block instanceof BambooStalkBlock || block instanceof BambooSaplingBlock || block instanceof DoorBlock) diff --git a/src/main/java/com/minecolonies/core/event/ClientEventHandler.java b/src/main/java/com/minecolonies/core/event/ClientEventHandler.java index e76dfc2a4d4..cb77a0dc623 100644 --- a/src/main/java/com/minecolonies/core/event/ClientEventHandler.java +++ b/src/main/java/com/minecolonies/core/event/ClientEventHandler.java @@ -29,6 +29,7 @@ import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.player.LocalPlayer; import net.minecraft.core.BlockPos; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.Style; @@ -265,7 +266,7 @@ private static void handleCrafterRecipeTooltips(@Nullable final IColony colony, */ private static Component getFullBuildingName(@NotNull final BuildingEntry building) { - final String namespace = building.getBuildingBlock().getRegistryName().getNamespace(); + final String namespace = BuiltInRegistries.BLOCK.getKey(building.getBuildingBlock()).getNamespace(); final String modName = ModList.get().getModContainerById(namespace) .map(m -> m.getModInfo().getDisplayName()) .orElse(namespace); diff --git a/src/main/java/com/minecolonies/core/event/ClientRegistryHandler.java b/src/main/java/com/minecolonies/core/event/ClientRegistryHandler.java index 73074c9927b..7aa6bc38f74 100644 --- a/src/main/java/com/minecolonies/core/event/ClientRegistryHandler.java +++ b/src/main/java/com/minecolonies/core/event/ClientRegistryHandler.java @@ -317,21 +317,21 @@ public static void doClientStuff(final EntityRenderersEvent.RegisterRenderers ev event.registerBlockEntityRenderer(MinecoloniesTileEntities.NAMED_GRAVE.get(), TileEntityNamedGraveRenderer::new); event.registerBlockEntityRenderer(MinecoloniesTileEntities.DECO_CONTROLLER.get(), TileEntityDecoControllerRenderer::new); - Arrays.stream(ModBlocks.getHuts()) - .forEach(hut -> ItemBlockRenderTypes.setRenderLayer(hut, renderType -> renderType.equals(RenderType.cutout()) || renderType.equals(RenderType.solid()))); - ItemBlockRenderTypes.setRenderLayer(ModBlocks.blockScarecrow, RenderType.cutout()); - ItemBlockRenderTypes.setRenderLayer(ModBlocks.blockRack, RenderType.cutout()); - ItemBlockRenderTypes.setRenderLayer(ModBlocks.blockDecorationPlaceholder, RenderType.cutout()); - ItemBlockRenderTypes.setRenderLayer(ModBlocks.blockCompostedDirt, RenderType.cutout()); - ItemBlockRenderTypes.setRenderLayer(ModBlocks.blockBarrel, RenderType.cutout()); - ItemBlockRenderTypes.setRenderLayer(ModBlocks.blockWayPoint, RenderType.cutout()); - ItemBlockRenderTypes.setRenderLayer(ModBlocks.floodedFarmland, RenderType.cutout()); - - Arrays.stream(ModBlocks.getCrops()).forEach(hut -> ItemBlockRenderTypes.setRenderLayer(hut, RenderType.cutout())); - - ItemProperties.register(ModItems.spear, ResourceLocation.withDefaultNamespace("throwing"), (item, world, entity, light) -> + ModBlocks.getHuts().stream() + .forEach(hut -> ItemBlockRenderTypes.setRenderLayer(hut.get(), renderType -> renderType.equals(RenderType.cutout()) || renderType.equals(RenderType.solid()))); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.blockScarecrow.get(), RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.blockRack.get(), RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.blockDecorationPlaceholder.get(), RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.blockCompostedDirt.get(), RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.blockBarrel.get(), RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.blockWayPoint.get(), RenderType.cutout()); + ItemBlockRenderTypes.setRenderLayer(ModBlocks.floodedFarmland.get(), RenderType.cutout()); + + ModBlocks.getCrops().stream().forEach(hut -> ItemBlockRenderTypes.setRenderLayer(hut.get(), RenderType.cutout())); + + ItemProperties.register(ModItems.spear.get(), ResourceLocation.withDefaultNamespace("throwing"), (item, world, entity, light) -> (entity != null && entity.isUsingItem() && entity.getUseItem() == item) ? 1.0F : 0.0F); - ItemProperties.register(ModItems.buildGoggles, ResourceLocation.withDefaultNamespace("disabled"), (item, world, entity, light) -> + ItemProperties.register(ModItems.buildGoggles.get(), ResourceLocation.withDefaultNamespace("disabled"), (item, world, entity, light) -> (ColonyBlueprintRenderer.willRenderBlueprints() ? 0.0F : 1.0F)); } diff --git a/src/main/java/com/minecolonies/core/generation/defaults/DefaultAdvancementsProvider.java b/src/main/java/com/minecolonies/core/generation/defaults/DefaultAdvancementsProvider.java index 73acd76ffba..d2289ce4fd9 100644 --- a/src/main/java/com/minecolonies/core/generation/defaults/DefaultAdvancementsProvider.java +++ b/src/main/java/com/minecolonies/core/generation/defaults/DefaultAdvancementsProvider.java @@ -289,8 +289,8 @@ private static void addProductionAdvancements(@NotNull final Consumer registrylookup = this.registries.lookupOrThrow(Registries.ENCHANTMENT); - saveBlocks(Arrays.asList(ModBlocks.getHuts())); + saveBlocks(ModBlocks.getHuts()); saveBlock(ModBlocks.blockHutWareHouse); saveBlock(ModBlocks.blockStash); @@ -67,9 +70,9 @@ public void generate() saveBlock(ModBlocks.farmland, lootPool -> lootPool.add(AlternativesEntry.alternatives().otherwise(LootItem.lootTableItem(Blocks.DIRT)))); saveBlock(ModBlocks.floodedFarmland, lootPool -> lootPool.add(AlternativesEntry.alternatives().otherwise(LootItem.lootTableItem(Blocks.DIRT)))); - for (Block block : ModBlocks.getCrops()) + for (DeferredBlock block : ModBlocks.getCrops()) { - final LootItemBlockStatePropertyCondition.Builder cropCondition = LootItemBlockStatePropertyCondition.hasBlockStateProperties(block).setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(CropBlock.AGE, 6)); + final LootItemBlockStatePropertyCondition.Builder cropCondition = LootItemBlockStatePropertyCondition.hasBlockStateProperties(block.get()).setProperties(StatePropertiesPredicate.Builder.properties().hasProperty(CropBlock.AGE, 6)); saveBlock(block, lootPool -> lootPool.add(LootItem.lootTableItem(block.asItem()).when(cropCondition).apply(ApplyBonusCount.addBonusBinomialDistributionCount(registrylookup.getOrThrow(Enchantments.FORTUNE), 0.5714286F, 3)).otherwise(LootItem.lootTableItem(block.asItem())))); } @@ -94,18 +97,18 @@ public void generate() saveBannerBlock(Blocks.YELLOW_BANNER); } - private void saveBlocks(@NotNull final List blocks) + private void saveBlocks(@NotNull final List> blocks) { - for (final Block block : blocks) + for (final DeferredBlock block : blocks) { saveBlock(block); } } - private void saveBlock(@NotNull final Block block) + private void saveBlock(@NotNull final DeferredBlock block) { final LootPoolSingletonContainer.Builder item = LootItem.lootTableItem(block); - if (block instanceof AbstractBlockHut || block instanceof BlockMinecoloniesRack) + if (block.get() instanceof AbstractBlockHut || block.get() instanceof BlockMinecoloniesRack) { item.apply(CopyNameFunction.copyName(CopyNameFunction.NameSource.BLOCK_ENTITY)); } @@ -113,11 +116,11 @@ private void saveBlock(@NotNull final Block block) this.saveBlock(block, lootPool -> lootPool.add(item).when(ExplosionCondition.survivesExplosion())); } - private void saveBlock(@NotNull final Block block, final Consumer lootPoolConfigurer) + private void saveBlock(@NotNull final DeferredBlock block, final Consumer lootPoolConfigurer) { final Builder lootPoolbuilder = LootPool.lootPool(); lootPoolConfigurer.accept(lootPoolbuilder); - add(block, LootTable.lootTable().withPool(lootPoolbuilder)); + add(block.get(), LootTable.lootTable().withPool(lootPoolbuilder)); } private void saveBannerBlock(@NotNull final Block block) @@ -134,7 +137,10 @@ private void saveBannerBlock(@NotNull final Block block) @Override protected Iterable getKnownBlocks() { - return Stream.concat(Arrays.stream(ModBlocks.getCrops()), Stream.concat(Arrays.stream(ModBlocks.getHuts()), Stream.of( + final List> blocks = new ArrayList<>(); + blocks.addAll(ModBlocks.getCrops()); + blocks.addAll(ModBlocks.getHuts()); + blocks.addAll(List.of( ModBlocks.blockHutWareHouse, ModBlocks.blockStash, //ModBlocks.blockConstructionTape, // no loot table @@ -150,8 +156,9 @@ protected Iterable getKnownBlocks() ModBlocks.blockCompostedDirt, //ModBlocks.blockDecorationPlaceholder, // creative only ModBlocks.floodedFarmland, - ModBlocks.farmland, + ModBlocks.farmland)); + return Stream.concat(blocks.stream().map(DeferredBlock::get).map(Block.class::cast), Stream.of( Blocks.BLACK_BANNER, Blocks.BLUE_BANNER, Blocks.BROWN_BANNER, @@ -168,6 +175,6 @@ protected Iterable getKnownBlocks() Blocks.PURPLE_BANNER, Blocks.RED_BANNER, Blocks.YELLOW_BANNER - )).map(Block.class::cast)).toList(); + )).toList(); } } diff --git a/src/main/java/com/minecolonies/core/generation/defaults/DefaultBlockTagsProvider.java b/src/main/java/com/minecolonies/core/generation/defaults/DefaultBlockTagsProvider.java index 5a15776148d..8bd261b0e70 100644 --- a/src/main/java/com/minecolonies/core/generation/defaults/DefaultBlockTagsProvider.java +++ b/src/main/java/com/minecolonies/core/generation/defaults/DefaultBlockTagsProvider.java @@ -11,6 +11,7 @@ import net.neoforged.neoforge.common.Tags; import net.neoforged.neoforge.common.data.BlockTagsProvider; import net.neoforged.neoforge.common.data.ExistingFileHelper; +import net.neoforged.neoforge.registries.DeferredBlock; import org.jetbrains.annotations.Nullable; import java.util.concurrent.CompletableFuture; @@ -45,8 +46,8 @@ protected void addTags(final HolderLookup.Provider holder) .add(Blocks.TUBE_CORAL_BLOCK) .add(Blocks.BELL) .add(Blocks.LANTERN) - .add(ModBlocks.blockWoodenGate) - .add(ModBlocks.blockIronGate) + .add(ModBlocks.blockWoodenGate.get()) + .add(ModBlocks.blockIronGate.get()) .addTag(BlockTags.BANNERS) .addTag(BlockTags.SIGNS) .addTag(BlockTags.CAMPFIRES); @@ -196,25 +197,25 @@ protected void addTags(final HolderLookup.Provider holder) .addTags(BlockTags.BASE_STONE_OVERWORLD, BlockTags.BASE_STONE_NETHER); tag(BlockTags.MINEABLE_WITH_PICKAXE) - .add(ModBlocks.blockIronGate); + .add(ModBlocks.blockIronGate.get()); tag(BlockTags.MINEABLE_WITH_AXE) - .add(ModBlocks.blockBarrel) - .add(ModBlocks.blockRack) - .add(ModBlocks.blockWoodenGate) - .add(ModBlocks.blockScarecrow) - .add(ModBlocks.blockDecorationPlaceholder) - .add(ModBlocks.blockColonyBanner) - .add(ModBlocks.blockColonyWallBanner) - .add(ModBlocks.blockPostBox) - .add(ModBlocks.blockStash) - .add(ModBlocks.blockPlantationField) - .add(ModBlocks.getHuts()); + .add(ModBlocks.blockBarrel.get()) + .add(ModBlocks.blockRack.get()) + .add(ModBlocks.blockWoodenGate.get()) + .add(ModBlocks.blockScarecrow.get()) + .add(ModBlocks.blockDecorationPlaceholder.get()) + .add(ModBlocks.blockColonyBanner.get()) + .add(ModBlocks.blockColonyWallBanner.get()) + .add(ModBlocks.blockPostBox.get()) + .add(ModBlocks.blockStash.get()) + .add(ModBlocks.blockPlantationField.get()) + .add(ModBlocks.getHuts().stream().map(DeferredBlock::get).toArray(Block[]::new)); tag(BlockTags.MINEABLE_WITH_SHOVEL) - .add(ModBlocks.blockCompostedDirt) - .add(ModBlocks.blockGrave) - .add(ModBlocks.blockNamedGrave); + .add(ModBlocks.blockCompostedDirt.get()) + .add(ModBlocks.blockGrave.get()) + .add(ModBlocks.blockNamedGrave.get()); tag(ModTags.validSpawn) .add(Blocks.AIR, Blocks.CAVE_AIR, Blocks.SNOW, Blocks.TALL_GRASS, Blocks.SHORT_GRASS, Blocks.FERN, Blocks.TORCH) .addTags(BlockTags.BUTTONS) diff --git a/src/main/java/com/minecolonies/core/generation/defaults/DefaultItemModelProvider.java b/src/main/java/com/minecolonies/core/generation/defaults/DefaultItemModelProvider.java index 0449c36cd19..cc90aacf14a 100644 --- a/src/main/java/com/minecolonies/core/generation/defaults/DefaultItemModelProvider.java +++ b/src/main/java/com/minecolonies/core/generation/defaults/DefaultItemModelProvider.java @@ -26,7 +26,7 @@ protected void registerModels() { final ResourceLocation disabledGoggles = modLoc("build_goggles_disabled"); basicItem(disabledGoggles); - basicItem(ModItems.buildGoggles) + basicItem(ModItems.buildGoggles.get()) .override() .predicate(ResourceLocation.withDefaultNamespace("disabled"), 1.0F) .model(getExistingFile(disabledGoggles)) diff --git a/src/main/java/com/minecolonies/core/generation/defaults/DefaultItemTagsProvider.java b/src/main/java/com/minecolonies/core/generation/defaults/DefaultItemTagsProvider.java index 9042bd7ac82..46c4d1bff3c 100644 --- a/src/main/java/com/minecolonies/core/generation/defaults/DefaultItemTagsProvider.java +++ b/src/main/java/com/minecolonies/core/generation/defaults/DefaultItemTagsProvider.java @@ -139,10 +139,10 @@ protected void addTags(final HolderLookup.Provider p_256380_) copy(ModTags.fungiBlocks, ModTags.fungi); tag(ModTags.meshes) - .add(ModItems.sifterMeshString) - .add(ModItems.sifterMeshFlint) - .add(ModItems.sifterMeshIron) - .add(ModItems.sifterMeshDiamond); + .add(ModItems.sifterMeshString.get()) + .add(ModItems.sifterMeshFlint.get()) + .add(ModItems.sifterMeshIron.get()) + .add(ModItems.sifterMeshDiamond.get()); tag(ModTags.excludedFood) .add(Items.ENCHANTED_GOLDEN_APPLE) @@ -152,8 +152,8 @@ protected void addTags(final HolderLookup.Provider p_256380_) .add(Items.TROPICAL_FISH) .add(Items.PUFFERFISH) .add(Items.SUSPICIOUS_STEW) - .add(ModItems.chorusBread) - .add(ModItems.goldenBread); + .add(ModItems.chorusBread.get()) + .add(ModItems.goldenBread.get()); tag(ModTags.breakable_ore) .addTag(ItemTags.COAL_ORES) @@ -213,9 +213,9 @@ protected void addTags(final HolderLookup.Provider p_256380_) .add(Items.DRIED_KELP) .add(Items.DRIED_KELP_BLOCK) .add(Items.EGG) - .add(ModItems.large_milk_bottle) - .add(ModItems.large_soy_milk_bottle) - .add(ModItems.large_water_bottle) + .add(ModItems.large_milk_bottle.get()) + .add(ModItems.large_soy_milk_bottle.get()) + .add(ModItems.large_water_bottle.get()) .add(Items.MILK_BUCKET); tag(ModTags.crafterIngredientExclusions.get(TagConstants.CRAFTING_COOK)) @@ -488,10 +488,10 @@ protected void addTags(final HolderLookup.Provider p_256380_) tag(ModTags.crafterProductExclusions.get(TagConstants.CRAFTING_REDUCEABLE)) .add(Items.GLOWSTONE) - .add(ModItems.breadDough) - .add(ModItems.cookieDough) - .add(ModItems.rawPumpkinPie) - .add(ModItems.cakeBatter) + .add(ModItems.breadDough.get()) + .add(ModItems.cookieDough.get()) + .add(ModItems.rawPumpkinPie.get()) + .add(ModItems.cakeBatter.get()) .addTags(Tags.Items.STONES, Tags.Items.COBBLESTONES) .addTags(Tags.Items.GRAVELS, Tags.Items.SANDS) .addTags(Tags.Items.INGOTS, storageBlocks); diff --git a/src/main/java/com/minecolonies/core/generation/defaults/DefaultResearchProvider.java b/src/main/java/com/minecolonies/core/generation/defaults/DefaultResearchProvider.java index af79ddd7edc..9f8baa72a9d 100644 --- a/src/main/java/com/minecolonies/core/generation/defaults/DefaultResearchProvider.java +++ b/src/main/java/com/minecolonies/core/generation/defaults/DefaultResearchProvider.java @@ -214,7 +214,7 @@ public Collection getCivilResearch(Collection r) //Primary Research #1 final Research stamina = new Research(new ResourceLocation(Constants.MOD_ID, "civilian/stamina"), CIVIL).setTranslatedName("Stamina") .setOnlyChild() - .setIcon(ModBlocks.blockHutHospital.asItem()) + .setIcon(ModBlocks.blockHutHospital) .addItemCost(Items.CARROT, 1, provider) .addEffect(ModBuildings.hospital.get().getBuildingBlock(), 1) .addToList(r); @@ -293,35 +293,35 @@ public Collection getCivilResearch(Collection r) //Primary Research #2 final Research keen = new Research(new ResourceLocation(Constants.MOD_ID, "civilian/keen"), CIVIL).setTranslatedName("Keen") .setSortOrder(2) - .setIcon(ModBlocks.blockHutLibrary.asItem()) + .setIcon(ModBlocks.blockHutLibrary) .addBuildingRequirement(ModBuildings.HOME_ID, 3) .addItemCost(Items.BOOK, 3, provider) .addEffect(ModBuildings.library.get().getBuildingBlock(), 1) .addToList(r); final Research outpost = new Research(new ResourceLocation(Constants.MOD_ID, "civilian/outpost"), CIVIL).setParentResearch(keen) .setTranslatedName("Outpost") - .setIcon(ModBlocks.blockHutHome.asItem(), 50) + .setIcon(ModBlocks.blockHutHome, 50) .addBuildingRequirement(ModBuildings.HOME_ID, 4) .addItemCost(Items.COOKED_BEEF, 64, provider) .addEffect(CITIZEN_CAP, 2) .addToList(r); final Research hamlet = new Research(new ResourceLocation(Constants.MOD_ID, "civilian/hamlet"), CIVIL).setParentResearch(outpost) .setTranslatedName("Hamlet") - .setIcon(ModBlocks.blockHutHome.asItem(), 75) + .setIcon(ModBlocks.blockHutHome, 75) .addBuildingRequirement(ModBuildings.HOME_ID, 5) .addItemCost(Items.COOKED_BEEF, 128, provider) .addEffect(CITIZEN_CAP, 3) .addToList(r); final Research village = new Research(new ResourceLocation(Constants.MOD_ID, "civilian/village"), CIVIL).setParentResearch(hamlet) .setTranslatedName("Village") - .setIcon(ModBlocks.blockHutHome.asItem(), 100) + .setIcon(ModBlocks.blockHutHome, 100) .addBuildingRequirement(ModBuildings.TOWNHALL_ID, 4) .addItemCost(Items.COOKED_BEEF, 256, provider) .addEffect(CITIZEN_CAP, 4) .addToList(r); new Research(new ResourceLocation(Constants.MOD_ID, "civilian/city"), CIVIL).setParentResearch(village) .setTranslatedName("City") - .setIcon(ModBlocks.blockHutHome.asItem(), 200) + .setIcon(ModBlocks.blockHutHome, 200) .addBuildingRequirement(ModBuildings.TOWNHALL_ID, 5) .addItemCost(Items.COOKED_BEEF, 512, provider) .addEffect(CITIZEN_CAP, 5) @@ -590,7 +590,7 @@ public Collection getCivilResearch(Collection r) .setTranslatedSubtitle("Well, we had to find something to occupy them.") .setSortOrder(4) .setOnlyChild() - .setIcon(ModBlocks.blockHutSchool.asItem()) + .setIcon(ModBlocks.blockHutSchool) .addBuildingRequirement("residence", 3) .addItemCost(Items.BOOK, 3, provider) .addEffect(ModBuildings.school.get().getBuildingBlock(), 1) @@ -678,7 +678,7 @@ public Collection getCivilResearch(Collection r) // Primary Research #5 final Research ambition = new Research(new ResourceLocation(Constants.MOD_ID, "civilian/ambition"), CIVIL).setTranslatedName("Ambition") .setSortOrder(5) - .setIcon(ModBlocks.blockHutMysticalSite.asItem()) + .setIcon(ModBlocks.blockHutMysticalSite) .addItemCost(Items.DIAMOND, 1, provider) .addEffect(ModBuildings.mysticalSite.get().getBuildingBlock(), 1) .addToList(r); @@ -695,7 +695,7 @@ public Collection getCivilResearch(Collection r) final Research remembrance = new Research(new ResourceLocation(Constants.MOD_ID, "civilian/remembrance"), CIVIL) .setTranslatedName("Remembrance") .setSortOrder(6) - .setIcon(ModBlocks.blockHutGraveyard.asItem()) + .setIcon(ModBlocks.blockHutGraveyard) .addEffect(ModBuildings.graveyard.get().getBuildingBlock(), 1) .addBuildingRequirement(ModBuildings.TOWNHALL_ID, 2) .addItemCost(Items.BONE, 8, provider) @@ -706,7 +706,7 @@ public Collection getCivilResearch(Collection r) .setParentResearch(remembrance) .setTranslatedName("Undertaker Emergency") .setSortOrder(3) - .setIcon(ModBlocks.blockHutGraveyard.asItem()) + .setIcon(ModBlocks.blockHutGraveyard) .addBuildingRequirement(ModBuildings.GRAVEYARD_ID, 2) .addItemCost(Items.IRON_BOOTS, 1, provider) .addEffect(UNDERTAKER_RUN, 1) @@ -717,7 +717,7 @@ public Collection getCivilResearch(Collection r) .setTranslatedName("Resurrection Chance I") .setTranslatedSubtitle("Use the right words") .setSortOrder(1) - .setIcon(ModBlocks.blockHutGraveyard.asItem()) + .setIcon(ModBlocks.blockHutGraveyard) .addBuildingRequirement(ModBuildings.GRAVEYARD_ID, 3) .addItemCost(Items.GHAST_TEAR, 1, provider) .addEffect(RESURRECT_CHANCE, 1) @@ -728,7 +728,7 @@ public Collection getCivilResearch(Collection r) .setTranslatedName("Resurrection Chance II") .setTranslatedSubtitle("Dance around and wave your hands") .setSortOrder(1) - .setIcon(ModBlocks.blockHutGraveyard.asItem()) + .setIcon(ModBlocks.blockHutGraveyard) .addBuildingRequirement(ModBuildings.GRAVEYARD_ID, 5) .addItemCost(Items.CHORUS_FRUIT, 16, provider) .addEffect(RESURRECT_CHANCE, 2) @@ -739,7 +739,7 @@ public Collection getCivilResearch(Collection r) .setTranslatedName("Raising The Dead") .setTranslatedSubtitle("Magic totems are for more than just looks") .setSortOrder(1) - .setIcon(Items.TOTEM_OF_UNDYING.asItem()) + .setIcon(Items.TOTEM_OF_UNDYING) .addBuildingRequirement(ModBuildings.GRAVEYARD_ID, 5) .addItemCost(Items.TOTEM_OF_UNDYING, 1, provider) .addEffect(USE_TOTEM, 1) @@ -750,7 +750,7 @@ public Collection getCivilResearch(Collection r) .setTranslatedName("Grave Decay I") .setTranslatedSubtitle("Dig deeper before death") .setSortOrder(2) - .setIcon(ModBlocks.blockGrave.asItem()) + .setIcon(ModBlocks.blockGrave) .addBuildingRequirement(ModBuildings.GRAVEYARD_ID, 3) .addItemCost(Items.ROTTEN_FLESH, 64, provider) .addEffect(GRAVE_DECAY_BONUS, 1) @@ -761,7 +761,7 @@ public Collection getCivilResearch(Collection r) .setTranslatedName("Grave Decay II") .setTranslatedSubtitle("I don't want to leave yet!") .setSortOrder(2) - .setIcon(ModBlocks.blockGrave.asItem()) + .setIcon(ModBlocks.blockGrave) .addBuildingRequirement(ModBuildings.GRAVEYARD_ID, 5) .addItemCost(Items.NETHER_WART_BLOCK, 8, provider) .addEffect(GRAVE_DECAY_BONUS, 2) @@ -855,7 +855,7 @@ public Collection getCombatResearch(Collection r) // Primary Research #2 final Research tacticTraining = new Research(new ResourceLocation(Constants.MOD_ID, "combat/tactictraining"), COMBAT).setTranslatedName("Tactic Training") .setSortOrder(2) - .setIcon(ModBlocks.blockHutBarracksTower.asItem()) + .setIcon(ModBlocks.blockHutBarracksTower) .addBuildingRequirement(ModBuildings.GUARD_TOWER_ID, 3) .addItemCost(Items.IRON_BLOCK, 3, provider) .addEffect(ModBuildings.barracks.get().getBuildingBlock(), 1) @@ -863,7 +863,7 @@ public Collection getCombatResearch(Collection r) final Research improvedSwords = new Research(new ResourceLocation(Constants.MOD_ID, "combat/improvedswords"), COMBAT).setParentResearch(tacticTraining) .setTranslatedName("Improved Swords") .setTranslatedSubtitle("Pointy end goes into the zombie.") - .setIcon(ModBlocks.blockHutCombatAcademy.asItem()) + .setIcon(ModBlocks.blockHutCombatAcademy) .addBuildingRequirement(ModBuildings.BARRACKS_ID, 3) .addItemCost(Items.IRON_BLOCK, 6, provider) .addEffect(ModBuildings.combatAcademy.get().getBuildingBlock(), 1) @@ -901,7 +901,7 @@ public Collection getCombatResearch(Collection r) .setTranslatedName("Improved Bows") .setTranslatedSubtitle("How far back can this bend before snapping?") .setSortOrder(2) - .setIcon(ModBlocks.blockHutArchery.asItem()) + .setIcon(ModBlocks.blockHutArchery) .addBuildingRequirement(ModBuildings.BARRACKS_ID, 3) .addItemCost(Items.IRON_BLOCK, 6, provider) .addEffect(ModBuildings.archery.get().getBuildingBlock(), 1) @@ -985,7 +985,7 @@ public Collection getCombatResearch(Collection r) .setTranslatedName("Dodge") .setTranslatedSubtitle("If you can dodge a hammer...") .setSortOrder(2) - .setIcon(ModItems.pirateBoots_2.asItem()) + .setIcon(ModItems.pirateBoots_2) .addBuildingRequirement(ModBuildings.SMELTERY_ID, 1) .addItemCost(Items.LEATHER, 16, provider) .addEffect(ARCHER_ARMOR, 1) @@ -1214,7 +1214,7 @@ public Collection getTechnologyResearch(Collection r) // Primary Research #1 final Research biodegradable = new Research(new ResourceLocation(Constants.MOD_ID, "technology/biodegradable"), TECH).setTranslatedName("Biodegradable") .setTranslatedSubtitle("Where science meets dirt.") - .setIcon(ModBlocks.blockHutComposter.asItem()) + .setIcon(ModBlocks.blockHutComposter) .addBuildingRequirement(ModBuildings.FARMER_ID, 3) .addItemCost(Items.BONE_MEAL, 64, provider) .addEffect(ModBuildings.composter.get().getBuildingBlock(), 1) @@ -1239,7 +1239,7 @@ public Collection getTechnologyResearch(Collection r) final Research flowerPower = new Research(new ResourceLocation(Constants.MOD_ID, "technology/flowerpower"), TECH).setParentResearch(biodegradable) .setTranslatedName("Flower Power") - .setIcon(ModBlocks.blockHutFlorist.asItem()) + .setIcon(ModBlocks.blockHutFlorist) .addBuildingRequirement(ModBuildings.COMPOSTER_ID, 3) .addItemCost(ModItems.compost, 64, provider) .addEffect(ModBuildings.florist.get().getBuildingBlock(), 1) @@ -1247,7 +1247,7 @@ public Collection getTechnologyResearch(Collection r) final Research rainbowHeaven = new Research(new ResourceLocation(Constants.MOD_ID, "technology/rainbowheaven"), TECH).setParentResearch(biodegradable) .setTranslatedName("Rainbow Heaven") .setTranslatedSubtitle("Now in color! And 3D!") - .setIcon(ModBlocks.blockHutComposter.asItem()) + .setIcon(ModBlocks.blockHutComposter) .addBuildingRequirement(ModBuildings.COMPOSTER_ID, 3) .addItemCost(Items.POPPY, 64, provider) .addEffect(ModBuildings.dyer.get().getBuildingBlock(), 1) @@ -1255,7 +1255,7 @@ public Collection getTechnologyResearch(Collection r) new Research(new ResourceLocation(Constants.MOD_ID, "technology/honeypot"), TECH).setParentResearch(rainbowHeaven) .setTranslatedName("Honey Pot") .setTranslatedSubtitle("Wasn't going to eat it. Just going to taste it.") - .setIcon(Items.HONEYCOMB.asItem()) + .setIcon(Items.HONEYCOMB) .addBuildingRequirement(ModBuildings.BEEKEEPER_ID, 3) .addItemCost(Items.BEEHIVE, 16, provider) .addEffect(BEEKEEP_2, 1) @@ -1265,7 +1265,7 @@ public Collection getTechnologyResearch(Collection r) .setTranslatedName("Let It Grow") .setTranslatedSubtitle("Just one tiny seed is all we really need.") .setSortOrder(2) - .setIcon(ModBlocks.blockHutPlantation.asItem()) + .setIcon(ModBlocks.blockHutPlantation) .addBuildingRequirement(ModBuildings.FARMER_ID, 3) .addItemCost(ModItems.compost, 16, provider) .addEffect(ModBuildings.plantation.get().getBuildingBlock(), 1) @@ -1356,7 +1356,7 @@ public Collection getTechnologyResearch(Collection r) .addToList(r); new Research(new ResourceLocation(Constants.MOD_ID, "technology/magiccompost"), TECH).setParentResearch(fertilizer) .setTranslatedName("Magic Compost") - .setIcon(ModBlocks.blockBarrel.asItem()) + .setIcon(ModBlocks.blockBarrel) .addItemCost(Items.WHEAT_SEEDS, 2048, provider) .addEffect(FARMING, 5) .addToList(r); @@ -1386,7 +1386,7 @@ public Collection getTechnologyResearch(Collection r) .setTranslatedName("Open the Nether") .setTranslatedSubtitle("It's a dangerous job, but it must be done!") .setSortOrder(1) - .setIcon(ModBlocks.blockHutNetherWorker.asItem()) + .setIcon(ModBlocks.blockHutNetherWorker) .addItemCost(Items.GILDED_BLACKSTONE, 3, provider) .addEffect(ModBuildings.netherWorker.get().getBuildingBlock(), 1) .addToList(r); @@ -1394,7 +1394,7 @@ public Collection getTechnologyResearch(Collection r) final Research alchemist = new Research(new ResourceLocation(Constants.MOD_ID, "technology/alchemist"), TECH).setParentResearch(netherminer) .setTranslatedName("Magic Potions") .setTranslatedSubtitle("These Romans are crazy") - .setIcon(ModBlocks.blockHutAlchemist.asItem()) + .setIcon(ModBlocks.blockHutAlchemist) .addItemCost(Items.NETHER_WART, 16, provider) .addEffect(ModBuildings.alchemist.get().getBuildingBlock(), 1) .addToList(r); @@ -1425,14 +1425,14 @@ public Collection getTechnologyResearch(Collection r) final Research stoneCake = new Research(new ResourceLocation(Constants.MOD_ID, "technology/stonecake"), TECH).setTranslatedName("Stone Cake") .setTranslatedSubtitle("Don't break a tooth!") .setSortOrder(4) - .setIcon(ModBlocks.blockHutStonemason.asItem()) + .setIcon(ModBlocks.blockHutStonemason) .addBuildingRequirement(ModBuildings.MINER_ID, 3) .addItemCost(Items.CHISELED_STONE_BRICKS, 64, provider) .addEffect(ModBuildings.stoneMason.get().getBuildingBlock(), 1) .addToList(r); final Research rockingRoll = new Research(new ResourceLocation(Constants.MOD_ID, "technology/rockingroll"), TECH).setParentResearch(stoneCake) .setTranslatedName("Rocking Roll") - .setIcon(ModBlocks.blockHutCrusher.asItem()) + .setIcon(ModBlocks.blockHutCrusher) .addBuildingRequirement("stonemason", 1) .addItemCost(Items.STONE, 64, provider) .addEffect(ModBuildings.crusher.get().getBuildingBlock(), 1) @@ -1441,7 +1441,7 @@ public Collection getTechnologyResearch(Collection r) final Research theFlintstones = new Research(new ResourceLocation(Constants.MOD_ID, "technology/theflintstones"), TECH).setParentResearch(stoneCake) .setTranslatedName("The Flintstones") .setTranslatedSubtitle("Yabba Dabba Doo!") - .setIcon(ModBlocks.blockHutStoneSmeltery.asItem()) + .setIcon(ModBlocks.blockHutStoneSmeltery) .addBuildingRequirement(ModBuildings.STONE_MASON_ID, 1) .addItemCost(Items.BRICK, 64, provider) .addEffect(ModBuildings.stoneSmelter.get().getBuildingBlock(), 1) @@ -1480,7 +1480,7 @@ public Collection getTechnologyResearch(Collection r) .setTranslatedName("Pave the Road") .setTranslatedSubtitle("Not something you want to get mixed up in.") .setSortOrder(2) - .setIcon(ModBlocks.blockHutConcreteMixer.asItem()) + .setIcon(ModBlocks.blockHutConcreteMixer) .addBuildingRequirement("crusher", 1) .addItemCost(ModTags.concreteItems, 32, provider) .addEffect(ModBuildings.concreteMixer.get().getBuildingBlock(), 1) @@ -1490,14 +1490,14 @@ public Collection getTechnologyResearch(Collection r) final Research woodwork = new Research(new ResourceLocation(Constants.MOD_ID, "technology/woodwork"), TECH).setTranslatedName("Woodwork") .setTranslatedSubtitle("Where oh where would a wood worker work if a wood worker would work wood?") .setSortOrder(5) - .setIcon(ModBlocks.blockHutSawmill.asItem()) + .setIcon(ModBlocks.blockHutSawmill) .addBuildingRequirement("lumberjack", 3) .addItemCost(ItemTags.PLANKS, 64, provider) .addEffect(ModBuildings.sawmill.get().getBuildingBlock(), 1) .addToList(r); final Research stringWork = new Research(new ResourceLocation(Constants.MOD_ID, "technology/stringwork"), TECH).setParentResearch(woodwork) .setTranslatedName("Stringwork") - .setIcon(ModBlocks.blockHutFletcher.asItem()) + .setIcon(ModBlocks.blockHutFletcher) .addBuildingRequirement(ModBuildings.SAWMILL_ID, 1) .addItemCost(Items.STRING, 16, provider) .addEffect(ModBuildings.fletcher.get().getBuildingBlock(), 1) @@ -1516,7 +1516,7 @@ public Collection getTechnologyResearch(Collection r) .setTranslatedName("Sieving") .setTranslatedSubtitle("How did that get in there?") .setSortOrder(2) - .setIcon(ModBlocks.blockHutSifter.asItem()) + .setIcon(ModBlocks.blockHutSifter) .addBuildingRequirement(ModBuildings.FISHERMAN_ID, 3) .addItemCost(Items.STRING, 64, provider) .addEffect(ModBuildings.sifter.get().getBuildingBlock(), 1) @@ -1526,7 +1526,7 @@ public Collection getTechnologyResearch(Collection r) .setTranslatedSubtitle("Antidisinterdimensionalitarianism!") .setIcon(Items.CHEST) .addBuildingRequirement(ModBuildings.MINER_ID, 3) - .addItemCost(ModBlocks.blockRack.asItem(), 16, provider) + .addItemCost(ModBlocks.blockRack, 16, provider) .addEffect(MINIMUM_STOCK, 1) .addToList(r); final Research capacity = new Research(new ResourceLocation(Constants.MOD_ID, "technology/capacity"), TECH).setParentResearch(space) @@ -1534,7 +1534,7 @@ public Collection getTechnologyResearch(Collection r) .setTranslatedSubtitle("Don't ask how we fit it all.") .setIcon(Items.CHEST_MINECART) .addBuildingRequirement(ModBuildings.MINER_ID, 4) - .addItemCost(ModBlocks.blockRack.asItem(), 32, provider) + .addItemCost(ModBlocks.blockRack, 32, provider) .addEffect(MINIMUM_STOCK, 2) .addToList(r); new Research(new ResourceLocation(Constants.MOD_ID, "technology/fullstock"), TECH).setParentResearch(capacity) @@ -1542,7 +1542,7 @@ public Collection getTechnologyResearch(Collection r) .setTranslatedSubtitle("We might be able to squeeze in one more.") .setIcon(Items.ENDER_CHEST) .addBuildingRequirement(ModBuildings.MINER_ID, 5) - .addItemCost(ModBlocks.blockRack.asItem(), 64, provider) + .addItemCost(ModBlocks.blockRack, 64, provider) .addEffect(MINIMUM_STOCK, 3) .addToList(r); @@ -1591,9 +1591,9 @@ public Collection getTechnologyResearch(Collection r) new Research(new ResourceLocation(Constants.MOD_ID, "technology/warehousemaster"), TECH).setParentResearch(memoryAid) .setTranslatedName("Warehouse Master") .setTranslatedSubtitle("So many items to choose from!") - .setIcon(ModBlocks.blockRack.asItem()) + .setIcon(ModBlocks.blockRack) .addBuildingRequirement(ModBuildings.SAWMILL_ID, 3) - .addItemCost(ModBlocks.blockRack.asItem(), 3, provider) + .addItemCost(ModBlocks.blockRack, 3, provider) .addEffect(RECIPE_MODE, 1) .setSortOrder(2) .addToList(r); @@ -1601,7 +1601,7 @@ public Collection getTechnologyResearch(Collection r) new Research(new ResourceLocation(Constants.MOD_ID, "technology/buildermodes"), TECH).setParentResearch(memoryAid) .setTranslatedName("Builder Modes") .setTranslatedSubtitle("Possibility Overload!") - .setIcon(ModBlocks.blockHutBuilder.asItem()) + .setIcon(ModBlocks.blockHutBuilder) .addBuildingRequirement(ModBuildings.BUILDER_ID, 3) .addItemCost(Items.DIAMOND_AXE, 1, provider) .addEffect(BUILDER_MODE, 1) @@ -1634,7 +1634,7 @@ public Collection getTechnologyResearch(Collection r) // Primary Research #6 final Research hot = new Research(new ResourceLocation(Constants.MOD_ID, "technology/hot"), TECH).setTranslatedName("Hot!") .setSortOrder(6) - .setIcon(ModBlocks.blockHutSmeltery.asItem()) + .setIcon(ModBlocks.blockHutSmeltery) .addBuildingRequirement(ModBuildings.MINER_ID, 2) .addItemCost(Items.LAVA_BUCKET, 4, provider) .addEffect(ModBuildings.smeltery.get().getBuildingBlock(), 1) @@ -1676,7 +1676,7 @@ public Collection getTechnologyResearch(Collection r) new Research(new ResourceLocation(Constants.MOD_ID, "technology/thoselungs"), TECH).setParentResearch(hot) .setTranslatedName("Those Lungs!") .setTranslatedSubtitle("You'll definitely be needing those in some form.") - .setIcon(ModBlocks.blockHutGlassblower.asItem()) + .setIcon(ModBlocks.blockHutGlassblower) .addBuildingRequirement(ModBuildings.SMELTERY_ID, 3) .addItemCost(Items.GLASS, 64, provider) .addEffect(ModBuildings.glassblower.get().getBuildingBlock(), 1) @@ -1686,7 +1686,7 @@ public Collection getTechnologyResearch(Collection r) final Research hittingIron = new Research(new ResourceLocation(Constants.MOD_ID, "technology/hittingiron"), TECH).setTranslatedName("Hitting Iron!") .setSortOrder(7) .setTranslatedSubtitle("We're still ironing out the details.") - .setIcon(ModBlocks.blockHutBlacksmith.asItem()) + .setIcon(ModBlocks.blockHutBlacksmith) .addBuildingRequirement(ModBuildings.MINER_ID, 3) .addItemCost(Items.ANVIL, 1, provider) .addEffect(ModBuildings.blacksmith.get().getBuildingBlock(), 1) @@ -1802,23 +1802,23 @@ public Collection getTechnologyResearch(Collection r) final Research whatYaNeed = new Research(new ResourceLocation(Constants.MOD_ID, "technology/whatyaneed"), TECH).setParentResearch(hittingIron) .setTranslatedName("What ya Need?") .setTranslatedSubtitle("It's not a rhetorical question...") - .setIcon(ModBlocks.blockHutMechanic.asItem()) + .setIcon(ModBlocks.blockHutMechanic) .addBuildingRequirement(ModBuildings.BLACKSMITH_ID, 3) .addItemCost(Items.REDSTONE, 64, provider) .addEffect(ModBuildings.mechanic.get().getBuildingBlock(), 1) .addToList(r); final Research enhanced_gates1 = new Research(new ResourceLocation(Constants.MOD_ID, "technology/enhanced_gates1"), TECH).setParentResearch(whatYaNeed) .setTranslatedName("Enhanced Gates I") - .setIcon(ModItems.woodgate) - .addItemCost(ModItems.woodgate, 64, provider) + .setIcon(ModBlocks.blockWoodenGate) + .addItemCost(ModBlocks.blockWoodenGate, 64, provider) .addItemCost(ModItems.ancientTome, 2, provider) .addItemCost(Items.IRON_BLOCK, 5, provider) .addEffect(MECHANIC_ENHANCED_GATES, 1) .addToList(r); new Research(new ResourceLocation(Constants.MOD_ID, "technology/enhanced_gates2"), TECH).setParentResearch(enhanced_gates1) .setTranslatedName("Enhanced Gates II") - .setIcon(ModItems.irongate) - .addItemCost(ModItems.irongate, 64, provider) + .setIcon(ModBlocks.blockIronGate) + .addItemCost(ModBlocks.blockIronGate, 64, provider) .addItemCost(ModItems.ancientTome, 2, provider) .addItemCost(Items.OBSIDIAN, 32, provider) .addEffect(MECHANIC_ENHANCED_GATES, 2) diff --git a/src/main/java/com/minecolonies/core/generation/defaults/DefaultSupplyLootProvider.java b/src/main/java/com/minecolonies/core/generation/defaults/DefaultSupplyLootProvider.java index 86e5a06c892..01b0beb25c5 100644 --- a/src/main/java/com/minecolonies/core/generation/defaults/DefaultSupplyLootProvider.java +++ b/src/main/java/com/minecolonies/core/generation/defaults/DefaultSupplyLootProvider.java @@ -47,7 +47,7 @@ public void generate(final BiConsumer, Builder> generator .add(LootItem.lootTableItem(ModItems.supplyCamp) .when(LootItemRandomChanceCondition.randomChance(0.1f)) .apply(SetComponentsFunction.setComponent(ModDataComponents.SUPPLY_COMPONENT.value(), new SupplyData(false, true, -1))) - .apply(SetNameFunction.setName(Component.translatableEscape("item.minecolonies.supply.free", ModItems.supplyCamp.getDescription()), SetNameFunction.Target.ITEM_NAME))) + .apply(SetNameFunction.setName(Component.translatableEscape("item.minecolonies.supply.free", ModItems.supplyCamp.get().getDescription()), SetNameFunction.Target.ITEM_NAME))) .add(LootItem.lootTableItem(ModItems.scrollBuff) .when(LootItemRandomChanceCondition.randomChance(0.2f)) .apply(SetItemCountFunction.setCount(ConstantValue.exactly(8)))) @@ -59,7 +59,7 @@ public void generate(final BiConsumer, Builder> generator .add(LootItem.lootTableItem(ModItems.supplyChest) .when(LootItemRandomChanceCondition.randomChance(0.1f)) .apply(SetComponentsFunction.setComponent(ModDataComponents.SUPPLY_COMPONENT.value(), new SupplyData(false, true, -1))) - .apply(SetNameFunction.setName(Component.translatableEscape("item.minecolonies.supply.free", ModItems.supplyChest.getDescription()), SetNameFunction.Target.ITEM_NAME))) + .apply(SetNameFunction.setName(Component.translatableEscape("item.minecolonies.supply.free", ModItems.supplyChest.get().getDescription()), SetNameFunction.Target.ITEM_NAME))) .add(LootItem.lootTableItem(ModItems.scrollBuff) .when(LootItemRandomChanceCondition.randomChance(0.2f)) .apply(SetItemCountFunction.setCount(ConstantValue.exactly(8)))) diff --git a/src/main/java/com/minecolonies/core/generation/defaults/workers/DefaultAlchemistCraftingProvider.java b/src/main/java/com/minecolonies/core/generation/defaults/workers/DefaultAlchemistCraftingProvider.java index b836d05d308..8ce2730ef1e 100644 --- a/src/main/java/com/minecolonies/core/generation/defaults/workers/DefaultAlchemistCraftingProvider.java +++ b/src/main/java/com/minecolonies/core/generation/defaults/workers/DefaultAlchemistCraftingProvider.java @@ -45,9 +45,9 @@ public String getName() protected void registerRecipes(@NotNull Consumer consumer) { recipe(ALCHEMIST, MODULE_CRAFTING, "magicpotion") - .inputs(List.of(new ItemStorage(new ItemStack(ModItems.mistletoe)), - new ItemStorage(ModItems.large_water_bottle.getDefaultInstance()))) - .result(new ItemStack(ModItems.magicpotion)) + .inputs(List.of(new ItemStorage(ModItems.mistletoe.toStack()), + new ItemStorage(ModItems.large_water_bottle.toStack()))) + .result(ModItems.magicpotion.toStack()) .minResearchId(ResearchConstants.DRUID_USE_POTIONS) .showTooltip(true) .build(consumer); diff --git a/src/main/java/com/minecolonies/core/generation/defaults/workers/DefaultBakerCraftingProvider.java b/src/main/java/com/minecolonies/core/generation/defaults/workers/DefaultBakerCraftingProvider.java index e7270d1f616..e152c39e547 100644 --- a/src/main/java/com/minecolonies/core/generation/defaults/workers/DefaultBakerCraftingProvider.java +++ b/src/main/java/com/minecolonies/core/generation/defaults/workers/DefaultBakerCraftingProvider.java @@ -54,21 +54,21 @@ protected void registerRecipes(@NotNull final Consumer cons recipe(BAKER, MODULE_CRAFTING, "bread_dough") .inputs(List.of(new ItemStorage(new ItemStack(Items.WHEAT, 3)))) - .result(new ItemStack(ModItems.breadDough)) + .result(ModItems.breadDough.toStack()) .maxBuildingLevel(2) .showTooltip(true) .build(consumer); recipe(BAKER, MODULE_CRAFTING, "bread_dough3") - .inputs(List.of(new ItemStorage(new ItemStack(Items.WHEAT)), new ItemStorage(ModItems.large_water_bottle.getDefaultInstance()))) - .result(new ItemStack(ModItems.breadDough, 2)) + .inputs(List.of(new ItemStorage(new ItemStack(Items.WHEAT)), new ItemStorage(ModItems.large_water_bottle.toStack()))) + .result(ModItems.breadDough.toStack(2)) .minBuildingLevel(3) .lootTable(DefaultRecipeLootProvider.LOOT_TABLE_LARGE_BOTTLE) .showTooltip(true) .build(consumer); recipe(BAKER, MODULE_SMELTING, "bread") - .inputs(List.of(new ItemStorage(new ItemStack(ModItems.breadDough)))) + .inputs(List.of(new ItemStorage(ModItems.breadDough.toStack()))) .result(new ItemStack(Items.BREAD)) .intermediate(Blocks.FURNACE) .build(consumer); @@ -76,7 +76,7 @@ protected void registerRecipes(@NotNull final Consumer cons recipe(BAKER, MODULE_CRAFTING, "sugary_bread") .inputs(List.of(new ItemStorage(new ItemStack(Items.WHEAT, 8)), new ItemStorage(new ItemStack(Items.HONEY_BOTTLE)))) - .result(new ItemStack(ModItems.sugaryBread, 4)) + .result(ModItems.sugaryBread.toStack(4)) .lootTable(DefaultRecipeLootProvider.LOOT_TABLE_GLASS_BOTTLE) .minBuildingLevel(3) .showTooltip(true) @@ -84,8 +84,8 @@ protected void registerRecipes(@NotNull final Consumer cons recipe(BAKER, MODULE_CRAFTING, "milky_bread") .inputs(List.of(new ItemStorage(new ItemStack(Items.WHEAT, 8)), - new ItemStorage(new ItemStack(ModItems.large_milk_bottle)))) - .result(new ItemStack(ModItems.milkyBread, 4)) + new ItemStorage(ModItems.large_milk_bottle.toStack()))) + .result(ModItems.milkyBread.toStack(4)) .lootTable(DefaultRecipeLootProvider.LOOT_TABLE_LARGE_BOTTLE) .minBuildingLevel(4) .showTooltip(true) @@ -93,8 +93,8 @@ protected void registerRecipes(@NotNull final Consumer cons recipe(BAKER, MODULE_CRAFTING, "smilky_bread") .inputs(List.of(new ItemStorage(new ItemStack(Items.WHEAT, 8)), - new ItemStorage(new ItemStack(ModItems.large_soy_milk_bottle)))) - .result(new ItemStack(ModItems.milkyBread, 4)) + new ItemStorage(ModItems.large_soy_milk_bottle.toStack()))) + .result(ModItems.milkyBread.toStack(4)) .lootTable(DefaultRecipeLootProvider.LOOT_TABLE_LARGE_BOTTLE) .minBuildingLevel(4) .showTooltip(true) @@ -103,7 +103,7 @@ protected void registerRecipes(@NotNull final Consumer cons recipe(BAKER, MODULE_CRAFTING, "golden_bread") .inputs(List.of(new ItemStorage(new ItemStack(Items.WHEAT, 8)), new ItemStorage(new ItemStack(Items.GOLD_INGOT)))) - .result(new ItemStack(ModItems.goldenBread, 4)) + .result(ModItems.goldenBread.toStack(4)) .minBuildingLevel(5) .showTooltip(true) .build(consumer); @@ -111,7 +111,7 @@ protected void registerRecipes(@NotNull final Consumer cons recipe(BAKER, MODULE_CRAFTING, "chorus_bread") .inputs(List.of(new ItemStorage(new ItemStack(Items.WHEAT, 8)), new ItemStorage(new ItemStack(Items.CHORUS_FRUIT)))) - .result(new ItemStack(ModItems.chorusBread, 4)) + .result(ModItems.chorusBread.toStack(4)) .minResearchId(ResearchConstants.THE_END) .showTooltip(true) .build(consumer); @@ -119,13 +119,13 @@ protected void registerRecipes(@NotNull final Consumer cons recipe(BAKER, MODULE_CRAFTING, "cookie_dough") .inputs(List.of(new ItemStorage(new ItemStack(Items.WHEAT, 2)), new ItemStorage(new ItemStack(Items.COCOA_BEANS, 2)))) - .result(new ItemStack(ModItems.cookieDough, 8)) + .result(ModItems.cookieDough.toStack(8)) .minBuildingLevel(2) .showTooltip(true) .build(consumer); recipe(BAKER, MODULE_SMELTING, "cookie") - .inputs(List.of(new ItemStorage(new ItemStack(ModItems.cookieDough)))) + .inputs(List.of(new ItemStorage(ModItems.cookieDough.toStack()))) .result(new ItemStack(Items.COOKIE)) .minBuildingLevel(2) .intermediate(Blocks.FURNACE) @@ -135,13 +135,13 @@ protected void registerRecipes(@NotNull final Consumer cons .inputs(List.of(new ItemStorage(new ItemStack(Items.PUMPKIN)), new ItemStorage(new ItemStack(Items.SUGAR)), new ItemStorage(new ItemStack(Items.EGG)))) - .result(new ItemStack(ModItems.rawPumpkinPie)) + .result(ModItems.rawPumpkinPie.toStack()) .minBuildingLevel(3) .showTooltip(true) .build(consumer); recipe(BAKER, MODULE_SMELTING, "pumpkin_pie") - .inputs(List.of(new ItemStorage(new ItemStack(ModItems.rawPumpkinPie)))) + .inputs(List.of(new ItemStorage(ModItems.rawPumpkinPie.toStack()))) .result(new ItemStack(Items.PUMPKIN_PIE)) .minBuildingLevel(3) .intermediate(Blocks.FURNACE) @@ -149,10 +149,10 @@ protected void registerRecipes(@NotNull final Consumer cons recipe(BAKER, MODULE_CRAFTING, "cake_batter") .inputs(List.of(new ItemStorage(new ItemStack(Items.WHEAT, 3)), - new ItemStorage(new ItemStack(ModItems.large_milk_bottle, 3)), + new ItemStorage(ModItems.large_milk_bottle.toStack(3)), new ItemStorage(new ItemStack(Items.SUGAR, 2)), new ItemStorage(new ItemStack(Items.EGG)))) - .result(new ItemStack(ModItems.cakeBatter)) + .result(ModItems.cakeBatter.toStack()) .lootTable(DefaultRecipeLootProvider.LOOT_TABLE_LARGE_BOTTLE) .minBuildingLevel(4) .showTooltip(true) @@ -160,17 +160,17 @@ protected void registerRecipes(@NotNull final Consumer cons recipe(BAKER, MODULE_CRAFTING, "scake_batter") .inputs(List.of(new ItemStorage(new ItemStack(Items.WHEAT, 3)), - new ItemStorage(new ItemStack(ModItems.large_soy_milk_bottle, 3)), + new ItemStorage(ModItems.large_soy_milk_bottle.toStack(3)), new ItemStorage(new ItemStack(Items.SUGAR, 2)), new ItemStorage(new ItemStack(Items.EGG)))) - .result(new ItemStack(ModItems.cakeBatter)) + .result(ModItems.cakeBatter.toStack()) .lootTable(DefaultRecipeLootProvider.LOOT_TABLE_LARGE_BOTTLE) .minBuildingLevel(4) .showTooltip(true) .build(consumer); recipe(BAKER, MODULE_SMELTING, "cake") - .inputs(List.of(new ItemStorage(new ItemStack(ModItems.cakeBatter)))) + .inputs(List.of(new ItemStorage(ModItems.cakeBatter.toStack()))) .result(new ItemStack(Items.CAKE)) .minBuildingLevel(4) .intermediate(Blocks.FURNACE) @@ -179,9 +179,9 @@ protected void registerRecipes(@NotNull final Consumer cons recipe(BAKER, MODULE_CRAFTING, "lembas_scone") .inputs(List.of( new ItemStorage(new ItemStack(ModBlocks.blockDurum)), - new ItemStorage(new ItemStack(ModItems.butter)), + new ItemStorage(ModItems.butter.toStack()), new ItemStorage(new ItemStack(Items.HONEY_BOTTLE)))) - .result(new ItemStack(ModItems.lembas_scone)) + .result(ModItems.lembas_scone.toStack()) .lootTable(DefaultRecipeLootProvider.LOOT_TABLE_GLASS_BOTTLE) .minBuildingLevel(1) .build(consumer); @@ -190,8 +190,8 @@ protected void registerRecipes(@NotNull final Consumer cons .inputs(List.of( new ItemStorage(new ItemStack(ModBlocks.blockDurum)), new ItemStorage(new ItemStack(ModBlocks.blockDurum)), - new ItemStorage(new ItemStack(ModItems.butter)))) - .result(new ItemStack(ModItems.manchet_dough, 2)) + new ItemStorage(ModItems.butter.toStack()))) + .result(ModItems.manchet_dough.toStack(2)) .minBuildingLevel(1) .build(consumer); @@ -199,10 +199,10 @@ protected void registerRecipes(@NotNull final Consumer cons .inputs(List.of( new ItemStorage(new ItemStack(ModBlocks.blockDurum)), new ItemStorage(new ItemStack(ModBlocks.blockDurum)), - new ItemStorage(new ItemStack(ModItems.butter)), + new ItemStorage(ModItems.butter.toStack()), new ItemStorage(new ItemStack(Items.SUGAR)), new ItemStorage(new ItemStack(Items.SWEET_BERRIES)))) - .result(new ItemStack(ModItems.muffin_dough, 2)) + .result(ModItems.muffin_dough.toStack(2)) .minBuildingLevel(1) .build(consumer); @@ -210,29 +210,29 @@ protected void registerRecipes(@NotNull final Consumer cons .inputs(List.of( new ItemStorage(new ItemStack(ModBlocks.blockDurum)), new ItemStorage(new ItemStack(ModBlocks.blockDurum)), - new ItemStorage(ModItems.large_water_bottle.getDefaultInstance()))) - .result(new ItemStack(ModItems.flatbread, 1)) + new ItemStorage(ModItems.large_water_bottle.toStack()))) + .result(ModItems.flatbread.toStack()) .lootTable(DefaultRecipeLootProvider.LOOT_TABLE_LARGE_BOTTLE) .minBuildingLevel(1) .build(consumer); recipe(BAKER, MODULE_SMELTING, "muffin") - .inputs(List.of(new ItemStorage(new ItemStack(ModItems.muffin_dough)))) - .result(new ItemStack(ModItems.muffin)) + .inputs(List.of(new ItemStorage(ModItems.muffin_dough.toStack()))) + .result(ModItems.muffin.toStack()) .minBuildingLevel(1) .intermediate(Blocks.FURNACE) .build(consumer); recipe(BAKER, MODULE_SMELTING, "manchet") - .inputs(List.of(new ItemStorage(new ItemStack(ModItems.manchet_dough)))) - .result(new ItemStack(ModItems.manchet_bread)) + .inputs(List.of(new ItemStorage(ModItems.manchet_dough.toStack()))) + .result(ModItems.manchet_bread.toStack()) .minBuildingLevel(1) .intermediate(Blocks.FURNACE) .build(consumer); recipe(BAKER, MODULE_CRAFTING, "water_jug") - .inputs(List.of(new ItemStorage(new ItemStack(ModItems.large_empty_bottle)))) - .result(ModItems.large_water_bottle.getDefaultInstance()) + .inputs(List.of(new ItemStorage(ModItems.large_empty_bottle.toStack()))) + .result(ModItems.large_water_bottle.toStack()) .build(consumer); } } diff --git a/src/main/java/com/minecolonies/core/generation/defaults/workers/DefaultChefCraftingProvider.java b/src/main/java/com/minecolonies/core/generation/defaults/workers/DefaultChefCraftingProvider.java index 81544c6cb42..2203dd12382 100644 --- a/src/main/java/com/minecolonies/core/generation/defaults/workers/DefaultChefCraftingProvider.java +++ b/src/main/java/com/minecolonies/core/generation/defaults/workers/DefaultChefCraftingProvider.java @@ -40,9 +40,9 @@ public String getName() protected void registerRecipes(@NotNull final Consumer consumer) { recipe(CHEF, MODULE_CRAFTING, "butter") - .inputs(List.of(new ItemStorage(new ItemStack(ModItems.large_milk_bottle)))) - .result(new ItemStack(ModItems.butter)) - .secondaryOutputs(List.of(new ItemStack(ModItems.large_empty_bottle))) + .inputs(List.of(new ItemStorage(ModItems.large_milk_bottle.toStack()))) + .result(ModItems.butter.toStack()) + .secondaryOutputs(List.of(ModItems.large_empty_bottle.toStack())) .minBuildingLevel(1) .build(consumer); @@ -51,25 +51,25 @@ protected void registerRecipes(@NotNull final Consumer cons new ItemStorage(new ItemStack(ModBlocks.blockOnion)), new ItemStorage(new ItemStack(ModBlocks.blockCabbage)), new ItemStorage(new ItemStack(Items.BOWL)), - new ItemStorage(new ItemStack(ModItems.manchet_bread)))) - .result(new ItemStack(ModItems.cabochis)) + new ItemStorage(ModItems.manchet_bread.toStack()))) + .result(ModItems.cabochis.toStack()) .minBuildingLevel(1) .build(consumer); recipe(CHEF, MODULE_CRAFTING, "cheddar_cheese") - .inputs(List.of(new ItemStorage(new ItemStack(ModItems.large_milk_bottle)))) - .result(new ItemStack(ModItems.cheddar_cheese)) - .secondaryOutputs(List.of(new ItemStack(ModItems.large_empty_bottle))) + .inputs(List.of(new ItemStorage(ModItems.large_milk_bottle.toStack()))) + .result(ModItems.cheddar_cheese.toStack()) + .secondaryOutputs(List.of(ModItems.large_empty_bottle.toStack())) .minBuildingLevel(1) .build(consumer); recipe(CHEF, MODULE_CRAFTING, "congee") .inputs(List.of( - new ItemStorage(new ItemStack(ModItems.cooked_rice)), + new ItemStorage(ModItems.cooked_rice.toStack()), new ItemStorage(new ItemStack(ModBlocks.blockGarlic)), new ItemStorage(new ItemStack(Items.BOWL)), new ItemStorage(new ItemStack(ModBlocks.blockCabbage)))) - .result(new ItemStack(ModItems.congee)) + .result(ModItems.congee.toStack()) .minBuildingLevel(1) .build(consumer); @@ -77,26 +77,26 @@ protected void registerRecipes(@NotNull final Consumer cons .inputs(List.of( new ItemStorage(new ItemStack(ModBlocks.blockRice)), new ItemStorage(new ItemStack(Items.BOWL)))) - .result(new ItemStack(ModItems.cooked_rice)) + .result(ModItems.cooked_rice.toStack()) .minBuildingLevel(1) .build(consumer); recipe(CHEF, MODULE_CRAFTING, "eggplant_dolma") .inputs(List.of( new ItemStorage(new ItemStack(ModBlocks.blockEggplant)), - new ItemStorage(new ItemStack(ModItems.feta_cheese)), + new ItemStorage(ModItems.feta_cheese.toStack()), new ItemStorage(new ItemStack(ModBlocks.blockGarlic)), new ItemStorage(new ItemStack(ModBlocks.blockTomato)), new ItemStorage(new ItemStack(ModBlocks.blockDurum)), new ItemStorage(new ItemStack(ModBlocks.blockOnion)))) - .result(new ItemStack(ModItems.eggplant_dolma)) + .result(ModItems.eggplant_dolma.toStack()) .minBuildingLevel(1) .build(consumer); recipe(CHEF, MODULE_CRAFTING, "feta_cheese") - .inputs(List.of(new ItemStorage(new ItemStack(ModItems.large_milk_bottle)))) - .result(new ItemStack(ModItems.feta_cheese)) - .secondaryOutputs(List.of(new ItemStack(ModItems.large_empty_bottle))) + .inputs(List.of(new ItemStorage(ModItems.large_milk_bottle.toStack()))) + .result(ModItems.feta_cheese.toStack()) + .secondaryOutputs(List.of(ModItems.large_empty_bottle.toStack())) .minBuildingLevel(1) .build(consumer); @@ -107,7 +107,7 @@ protected void registerRecipes(@NotNull final Consumer cons new ItemStorage(new ItemStack(Items.BROWN_MUSHROOM)), new ItemStorage(new ItemStack(ModBlocks.blockOnion)), new ItemStorage(new ItemStack(Items.MUTTON)))) - .result(new ItemStack(ModItems.hand_pie)) + .result(ModItems.hand_pie.toStack()) .minBuildingLevel(1) .build(consumer); @@ -122,41 +122,41 @@ protected void registerRecipes(@NotNull final Consumer cons new ItemStorage(new ItemStack(Items.BROWN_MUSHROOM)), new ItemStorage(new ItemStack(ModBlocks.blockCabbage)), new ItemStorage(new ItemStack(Items.MUTTON)))) - .result(new ItemStack(ModItems.lamb_stew)) + .result(ModItems.lamb_stew.toStack()) .minBuildingLevel(1) .build(consumer); recipe(CHEF, MODULE_CRAFTING, "pasta_plain") .inputs(List.of( - new ItemStorage(new ItemStack(ModItems.raw_noodle)), - new ItemStorage(new ItemStack(ModItems.butter)), + new ItemStorage(ModItems.raw_noodle.toStack()), + new ItemStorage(ModItems.butter.toStack()), new ItemStorage(new ItemStack(Items.BOWL)), new ItemStorage(new ItemStack(ModBlocks.blockGarlic)))) - .result(new ItemStack(ModItems.pasta_plain)) + .result(ModItems.pasta_plain.toStack()) .minBuildingLevel(1) .build(consumer); recipe(CHEF, MODULE_CRAFTING, "pasta_tomato") .inputs(List.of( - new ItemStorage(new ItemStack(ModItems.raw_noodle)), + new ItemStorage(ModItems.raw_noodle.toStack()), new ItemStorage(new ItemStack(ModBlocks.blockTomato)), new ItemStorage(new ItemStack(ModBlocks.blockTomato)), new ItemStorage(new ItemStack(ModBlocks.blockOnion)), new ItemStorage(new ItemStack(Items.BOWL)), new ItemStorage(new ItemStack(ModBlocks.blockGarlic)))) - .result(new ItemStack(ModItems.pasta_tomato)) + .result(ModItems.pasta_tomato.toStack()) .minBuildingLevel(1) .build(consumer); recipe(CHEF, MODULE_CRAFTING, "pita_hummus") .inputs(List.of( - new ItemStorage(new ItemStack(ModItems.flatbread)), + new ItemStorage(ModItems.flatbread.toStack()), new ItemStorage(new ItemStack(ModBlocks.blockChickpea)), new ItemStorage(new ItemStack(ModBlocks.blockChickpea)), new ItemStorage(new ItemStack(ModBlocks.blockEggplant)), new ItemStorage(new ItemStack(ModBlocks.blockOnion)), new ItemStorage(new ItemStack(ModBlocks.blockGarlic)))) - .result(new ItemStack(ModItems.pita_hummus)) + .result(ModItems.pita_hummus.toStack()) .minBuildingLevel(1) .build(consumer); @@ -168,74 +168,74 @@ protected void registerRecipes(@NotNull final Consumer cons new ItemStorage(new ItemStack(Items.POTATO)), new ItemStorage(new ItemStack(Items.CARROT)), new ItemStorage(new ItemStack(ModBlocks.blockGarlic)))) - .result(new ItemStack(ModItems.pottage)) + .result(ModItems.pottage.toStack()) .minBuildingLevel(1) .build(consumer); recipe(CHEF, MODULE_CRAFTING, "raw_noodle") .inputs(List.of( new ItemStorage(new ItemStack(ModBlocks.blockDurum)))) - .result(new ItemStack(ModItems.raw_noodle)) + .result(ModItems.raw_noodle.toStack()) .minBuildingLevel(1) .build(consumer); recipe(CHEF, MODULE_CRAFTING, "rice_ball") .inputs(List.of( - new ItemStorage(new ItemStack(ModItems.tofu)), + new ItemStorage(ModItems.tofu.toStack()), new ItemStorage(new ItemStack(Items.DRIED_KELP)), - new ItemStorage(new ItemStack(ModItems.cooked_rice)))) - .result(new ItemStack(ModItems.rice_ball, 2)) + new ItemStorage(ModItems.cooked_rice.toStack()))) + .result(ModItems.rice_ball.toStack(2)) .minBuildingLevel(1) .build(consumer); recipe(CHEF, MODULE_CRAFTING, "stew_trencher") .inputs(List.of( - new ItemStorage(new ItemStack(ModItems.manchet_bread)), + new ItemStorage(ModItems.manchet_bread.toStack()), new ItemStorage(new ItemStack(ModBlocks.blockTomato)), new ItemStorage(new ItemStack(ModBlocks.blockCabbage)), new ItemStorage(new ItemStack(ModBlocks.blockOnion)))) - .result(new ItemStack(ModItems.stew_trencher)) + .result(ModItems.stew_trencher.toStack()) .minBuildingLevel(1) .build(consumer); recipe(CHEF, MODULE_CRAFTING, "stuffed_pepper") .inputs(List.of( - new ItemStorage(new ItemStack(ModItems.cooked_rice)), + new ItemStorage(ModItems.cooked_rice.toStack()), new ItemStorage(new ItemStack(ModBlocks.blockBellPepper)), new ItemStorage(new ItemStack(ModBlocks.blockTomato)), new ItemStorage(new ItemStack(Items.CARROT)), new ItemStorage(new ItemStack(ModBlocks.blockGarlic)), new ItemStorage(new ItemStack(ModBlocks.blockEggplant)))) - .result(new ItemStack(ModItems.stuffed_pepper)) + .result(ModItems.stuffed_pepper.toStack()) .minBuildingLevel(1) .build(consumer); recipe(CHEF, MODULE_CRAFTING, "stuffed_pita") .inputs(List.of( - new ItemStorage(new ItemStack(ModItems.flatbread)), + new ItemStorage(ModItems.flatbread.toStack()), new ItemStorage(new ItemStack(ModBlocks.blockTomato)), new ItemStorage(new ItemStack(ModBlocks.blockOnion)), new ItemStorage(new ItemStack(ModBlocks.blockEggplant)), new ItemStorage(new ItemStack(ModBlocks.blockGarlic)))) - .result(new ItemStack(ModItems.stuffed_pita)) + .result(ModItems.stuffed_pita.toStack()) .minBuildingLevel(1) .build(consumer); recipe(CHEF, MODULE_CRAFTING, "sushi_roll") .inputs(List.of( - new ItemStorage(new ItemStack(ModItems.cooked_rice)), + new ItemStorage(ModItems.cooked_rice.toStack()), new ItemStorage(new ItemStack(Items.SALMON)), new ItemStorage(new ItemStack(ModBlocks.blockGarlic)), new ItemStorage(new ItemStack(Items.DRIED_KELP)), new ItemStorage(new ItemStack(ModBlocks.blockOnion)))) - .result(new ItemStack(ModItems.sushi_roll, 2)) + .result(ModItems.sushi_roll.toStack(2)) .minBuildingLevel(1) .build(consumer); recipe(CHEF, MODULE_CRAFTING, "tofu") .inputs(List.of( new ItemStorage(new ItemStack(ModBlocks.blockSoyBean)), new ItemStorage(new ItemStack(ModBlocks.blockSoyBean)))) - .result(new ItemStack(ModItems.tofu)) + .result(ModItems.tofu.toStack()) .minBuildingLevel(1) .build(consumer); @@ -246,17 +246,17 @@ protected void registerRecipes(@NotNull final Consumer cons new ItemStorage(new ItemStack(ModBlocks.blockGarlic)), new ItemStorage(new ItemStack(ModBlocks.blockChickpea)), new ItemStorage(new ItemStack(ModBlocks.blockChickpea)))) - .result(new ItemStack(ModItems.pepper_hummus, 2)) + .result(ModItems.pepper_hummus.toStack(2)) .minBuildingLevel(1) .build(consumer); recipe(CHEF, MODULE_CRAFTING, "soy_milk") .inputs(List.of( - new ItemStorage(new ItemStack(ModItems.large_water_bottle)), + new ItemStorage(ModItems.large_water_bottle.toStack()), new ItemStorage(new ItemStack(ModBlocks.blockSoyBean)), new ItemStorage(new ItemStack(ModBlocks.blockSoyBean)), new ItemStorage(new ItemStack(ModBlocks.blockSoyBean)))) - .result(new ItemStack(ModItems.large_soy_milk_bottle)) + .result(ModItems.large_soy_milk_bottle.toStack()) .minBuildingLevel(1) .build(consumer); } diff --git a/src/main/java/com/minecolonies/core/generation/defaults/workers/DefaultEnchanterCraftingProvider.java b/src/main/java/com/minecolonies/core/generation/defaults/workers/DefaultEnchanterCraftingProvider.java index 213d1e1e6c9..03fd0aa18cb 100644 --- a/src/main/java/com/minecolonies/core/generation/defaults/workers/DefaultEnchanterCraftingProvider.java +++ b/src/main/java/com/minecolonies/core/generation/defaults/workers/DefaultEnchanterCraftingProvider.java @@ -388,7 +388,7 @@ public String getName() protected void registerRecipes(@NotNull final Consumer consumer) { final List tome = Collections.singletonList(new ItemStorage( - new ItemStack(ModItems.ancientTome), true, true)); + ModItems.ancientTome.toStack(), true, true)); for (int buildingLevel = 1; buildingLevel <= MAX_BUILDING_LEVEL; ++buildingLevel) { @@ -404,34 +404,34 @@ protected void registerRecipes(@NotNull final Consumer cons recipe(ENCHANTER, MODULE_CUSTOM, "scroll_tp") .inputs(List.of(new ItemStorage(new ItemStack(Items.PAPER, 3)), new ItemStorage(new ItemStack(Items.COMPASS)), - new ItemStorage(new ItemStack(com.ldtteam.structurize.items.ModItems.buildTool.get())))) - .result(new ItemStack(ModItems.scrollColonyTP, 3)) + new ItemStorage(com.ldtteam.structurize.items.ModItems.buildTool.toStack()))) + .result(ModItems.scrollColonyTP.toStack(3)) .showTooltip(true) .build(consumer); recipe(ENCHANTER, MODULE_CUSTOM, "scroll_area_tp") - .inputs(List.of(new ItemStorage(new ItemStack(ModItems.scrollColonyTP, 3)))) - .result(new ItemStack(ModItems.scrollColonyAreaTP)) + .inputs(List.of(new ItemStorage(ModItems.scrollColonyTP.toStack(3)))) + .result(ModItems.scrollColonyAreaTP.toStack()) .minBuildingLevel(2) .showTooltip(true) .build(consumer); recipe(ENCHANTER, MODULE_CUSTOM, "scroll_guard_help") - .inputs(List.of(new ItemStorage(new ItemStack(ModItems.scrollColonyTP)), + .inputs(List.of(new ItemStorage(ModItems.scrollColonyTP.toStack()), new ItemStorage(new ItemStack(Items.LAPIS_LAZULI, 5)), new ItemStorage(new ItemStack(Items.ENDER_PEARL)), new ItemStorage(new ItemStack(Items.PAPER)))) - .result(new ItemStack(ModItems.scrollGuardHelp, 2)) + .result(ModItems.scrollGuardHelp.toStack(2)) .minBuildingLevel(3) .minResearchId(ResearchConstants.MORE_SCROLLS) .showTooltip(true) .build(consumer); recipe(ENCHANTER, MODULE_CUSTOM, "scroll_highlight") - .inputs(List.of(new ItemStorage(new ItemStack(ModItems.scrollColonyTP, 3)), + .inputs(List.of(new ItemStorage(ModItems.scrollColonyTP.toStack(3)), new ItemStorage(new ItemStack(Items.GLOWSTONE_DUST, 6)), new ItemStorage(new ItemStack(Items.PAPER, 2)))) - .result(new ItemStack(ModItems.scrollHighLight, 5)) + .result(ModItems.scrollHighLight.toStack(5)) .minBuildingLevel(3) .minResearchId(ResearchConstants.MORE_SCROLLS) .showTooltip(true) diff --git a/src/main/java/com/minecolonies/core/generation/defaults/workers/DefaultFarmerCraftingProvider.java b/src/main/java/com/minecolonies/core/generation/defaults/workers/DefaultFarmerCraftingProvider.java index 8ca9cb5d6a2..caeefbc6bb5 100644 --- a/src/main/java/com/minecolonies/core/generation/defaults/workers/DefaultFarmerCraftingProvider.java +++ b/src/main/java/com/minecolonies/core/generation/defaults/workers/DefaultFarmerCraftingProvider.java @@ -47,7 +47,7 @@ protected void registerRecipes(@NotNull final Consumer cons recipe(FARMER, MODULE_CRAFTING, "mud") .inputs(List.of(new ItemStorage(new ItemStack(Items.DIRT)), - new ItemStorage(ModItems.large_water_bottle.getDefaultInstance()))) + new ItemStorage(ModItems.large_water_bottle.toStack()))) .result(new ItemStack(Items.MUD)) .lootTable(DefaultRecipeLootProvider.LOOT_TABLE_LARGE_BOTTLE) .build(consumer); diff --git a/src/main/java/com/minecolonies/core/generation/defaults/workers/DefaultMechanicCraftingProvider.java b/src/main/java/com/minecolonies/core/generation/defaults/workers/DefaultMechanicCraftingProvider.java index b7b03b7f283..4db0b15afc0 100644 --- a/src/main/java/com/minecolonies/core/generation/defaults/workers/DefaultMechanicCraftingProvider.java +++ b/src/main/java/com/minecolonies/core/generation/defaults/workers/DefaultMechanicCraftingProvider.java @@ -1,5 +1,6 @@ package com.minecolonies.core.generation.defaults.workers; +import com.minecolonies.api.blocks.ModBlocks; import com.minecolonies.api.colony.jobs.ModJobs; import com.minecolonies.api.crafting.ItemStorage; import com.minecolonies.api.items.ModItems; @@ -43,13 +44,13 @@ protected void registerRecipes(@NotNull final Consumer cons { recipe(MECHANIC, MODULE_CRAFTING, "gate_wood") .inputs(List.of(new ItemStorage(new ItemStack(Items.OAK_LOG, 5)))) - .result(new ItemStack(ModItems.woodgate)) + .result(new ItemStack(ModBlocks.blockWoodenGate)) .showTooltip(true) .build(consumer); recipe(MECHANIC, MODULE_CRAFTING, "gate_iron") .inputs(List.of(new ItemStorage(new ItemStack(Items.IRON_NUGGET, 5)))) - .result(new ItemStack(ModItems.irongate)) + .result(new ItemStack(ModBlocks.blockIronGate)) .showTooltip(true) .build(consumer); diff --git a/src/main/java/com/minecolonies/core/generation/defaults/workers/DefaultNetherWorkerLootProvider.java b/src/main/java/com/minecolonies/core/generation/defaults/workers/DefaultNetherWorkerLootProvider.java index ff78aee1bad..febd8a09a9e 100644 --- a/src/main/java/com/minecolonies/core/generation/defaults/workers/DefaultNetherWorkerLootProvider.java +++ b/src/main/java/com/minecolonies/core/generation/defaults/workers/DefaultNetherWorkerLootProvider.java @@ -202,7 +202,7 @@ private LootPool.Builder createMobsPool(final int buildingLevel) private LootPoolSingletonContainer.Builder createAdventureToken(@NotNull final EntityType mob, final int damage_done, final int xp_gained) { - final ItemStack stack = new ItemStack(ModItems.adventureToken); + final ItemStack stack = ModItems.adventureToken.toStack(); new AdventureData(mob, damage_done, xp_gained).writeToItemStack(stack); return SimpleLootTableProvider.itemStack(stack); diff --git a/src/main/java/com/minecolonies/core/generation/defaults/workers/DefaultSifterCraftingProvider.java b/src/main/java/com/minecolonies/core/generation/defaults/workers/DefaultSifterCraftingProvider.java index 9808652df73..ba32704c6c4 100644 --- a/src/main/java/com/minecolonies/core/generation/defaults/workers/DefaultSifterCraftingProvider.java +++ b/src/main/java/com/minecolonies/core/generation/defaults/workers/DefaultSifterCraftingProvider.java @@ -23,6 +23,7 @@ import net.minecraft.world.level.storage.loot.entries.LootItem; import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; import net.minecraft.world.level.storage.loot.providers.number.ConstantValue; +import net.neoforged.neoforge.registries.DeferredItem; import org.jetbrains.annotations.NotNull; import java.util.*; @@ -251,10 +252,10 @@ private static class SifterMeshDetails private final int minBuildingLevel; private final LootTable.Builder lootTable; - public SifterMeshDetails(@NotNull final Item mesh, final int minBuildingLevel, @NotNull final LootTable.Builder lootTable) + public SifterMeshDetails(@NotNull final DeferredItem mesh, final int minBuildingLevel, @NotNull final LootTable.Builder lootTable) { - this.name = BuiltInRegistries.ITEM.getKey(mesh).getPath().replace("sifter_mesh_", ""); - this.mesh = mesh; + this.name = mesh.getId().getPath().replace("sifter_mesh_", ""); + this.mesh = mesh.get(); this.minBuildingLevel = minBuildingLevel; this.lootTable = lootTable; } diff --git a/src/main/java/com/minecolonies/core/items/AbstractItemMinecolonies.java b/src/main/java/com/minecolonies/core/items/AbstractItemMinecolonies.java deleted file mode 100755 index 5157f4a192a..00000000000 --- a/src/main/java/com/minecolonies/core/items/AbstractItemMinecolonies.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.minecolonies.core.items; - -import net.minecraft.world.item.Item; - -/** - * Handles simple things that all items need. - */ -public abstract class AbstractItemMinecolonies extends Item -{ - /** - * The name of the item. - */ - private final String name; - - /** - * Sets the name, creative tab, and registers the item. - * - * @param name The name of this item - * @param properties the properties. - */ - public AbstractItemMinecolonies(final String name, final Item.Properties properties) - { - super(properties); - this.name = name; - } -} diff --git a/src/main/java/com/minecolonies/core/items/AbstractItemScroll.java b/src/main/java/com/minecolonies/core/items/AbstractItemScroll.java index a393508cc43..fded76b8c18 100644 --- a/src/main/java/com/minecolonies/core/items/AbstractItemScroll.java +++ b/src/main/java/com/minecolonies/core/items/AbstractItemScroll.java @@ -8,6 +8,7 @@ import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.item.UseAnim; @@ -25,7 +26,7 @@ /** * Scroll items base class, does colony registering/checks. */ -public abstract class AbstractItemScroll extends AbstractItemMinecolonies +public abstract class AbstractItemScroll extends Item { public static final int FAIL_RESPONSES_TOTAL = 10; @@ -35,9 +36,9 @@ public abstract class AbstractItemScroll extends AbstractItemMinecolonies * @param name The name of this item * @param properties the properties. */ - public AbstractItemScroll(final String name, final Properties properties) + public AbstractItemScroll(final Properties properties) { - super(name, properties); + super(properties); } @Override diff --git a/src/main/java/com/minecolonies/core/items/ItemAdventureToken.java b/src/main/java/com/minecolonies/core/items/ItemAdventureToken.java index 6d6ff71a128..5e424e39438 100644 --- a/src/main/java/com/minecolonies/core/items/ItemAdventureToken.java +++ b/src/main/java/com/minecolonies/core/items/ItemAdventureToken.java @@ -5,6 +5,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.Style; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.TooltipFlag; import org.jetbrains.annotations.NotNull; @@ -15,7 +16,7 @@ import static com.minecolonies.api.util.constant.TranslationConstants.COM_MINECOLONIES_COREMOD_ADVENTURE_TOKEN_NAME_GUI; import static com.minecolonies.api.util.constant.TranslationConstants.COM_MINECOLONIES_COREMOD_ADVENTURE_TOKEN_TOOLTIP_GUI; -public class ItemAdventureToken extends AbstractItemMinecolonies +public class ItemAdventureToken extends Item { /** * This item is purely for matching, and carrying data in Tags @@ -23,7 +24,7 @@ public class ItemAdventureToken extends AbstractItemMinecolonies */ public ItemAdventureToken(Properties properties) { - super("adventure_token", properties); + super(properties); } @Override diff --git a/src/main/java/com/minecolonies/core/items/ItemAncientTome.java b/src/main/java/com/minecolonies/core/items/ItemAncientTome.java index bd6f766f7b2..61ded888578 100644 --- a/src/main/java/com/minecolonies/core/items/ItemAncientTome.java +++ b/src/main/java/com/minecolonies/core/items/ItemAncientTome.java @@ -4,6 +4,7 @@ import com.minecolonies.api.colony.IColonyManager; import net.minecraft.core.component.DataComponents; import net.minecraft.world.entity.Entity; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; @@ -12,7 +13,7 @@ /** * Class describing the Ancient Tome item. */ -public class ItemAncientTome extends AbstractItemMinecolonies +public class ItemAncientTome extends Item { /** * Sets the name, creative tab, and registers the Ancient Tome item. @@ -21,7 +22,7 @@ public class ItemAncientTome extends AbstractItemMinecolonies */ public ItemAncientTome(final Properties properties) { - super("ancienttome", properties.stacksTo(STACKSIZE).component(DataComponents.ENCHANTMENT_GLINT_OVERRIDE, false)); + super(properties.stacksTo(STACKSIZE).component(DataComponents.ENCHANTMENT_GLINT_OVERRIDE, false)); } @Override diff --git a/src/main/java/com/minecolonies/core/items/ItemBannerRallyGuards.java b/src/main/java/com/minecolonies/core/items/ItemBannerRallyGuards.java index 69561f2e716..0c55e949dda 100644 --- a/src/main/java/com/minecolonies/core/items/ItemBannerRallyGuards.java +++ b/src/main/java/com/minecolonies/core/items/ItemBannerRallyGuards.java @@ -21,6 +21,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.InteractionResultHolder; @@ -43,7 +44,7 @@ /** * Rally Guards Banner Item class. Used to give tasks to guards. */ -public class ItemBannerRallyGuards extends AbstractItemMinecolonies +public class ItemBannerRallyGuards extends Item { /** * Rally Guards Banner constructor. Sets max stack to 1, like other tools. @@ -52,7 +53,7 @@ public class ItemBannerRallyGuards extends AbstractItemMinecolonies */ public ItemBannerRallyGuards(final Properties properties) { - super("banner_rally_guards", properties.stacksTo(1).durability(0)); + super(properties.stacksTo(1).durability(0)); } @NotNull @@ -96,7 +97,7 @@ public InteractionResult useOn(final UseOnContext context) } } } - else if (context.getLevel().getBlockState(context.getClickedPos()).getBlock().equals(ModBlocks.blockColonyBanner)) + else if (context.getLevel().getBlockState(context.getClickedPos()).getBlock().equals(ModBlocks.blockColonyBanner.get())) { if (context.getLevel().isClientSide()) { diff --git a/src/main/java/com/minecolonies/core/items/ItemBreadDough.java b/src/main/java/com/minecolonies/core/items/ItemBreadDough.java index 2a6651d2a75..0ccb699ab78 100755 --- a/src/main/java/com/minecolonies/core/items/ItemBreadDough.java +++ b/src/main/java/com/minecolonies/core/items/ItemBreadDough.java @@ -1,11 +1,13 @@ package com.minecolonies.core.items; +import net.minecraft.world.item.Item; + import static com.minecolonies.api.util.constant.Constants.STACKSIZE; /** * Class handling Bread Dough. */ -public class ItemBreadDough extends AbstractItemMinecolonies +public class ItemBreadDough extends Item { /** * Sets the name, creative tab, and registers the Bread Dough item. @@ -14,6 +16,6 @@ public class ItemBreadDough extends AbstractItemMinecolonies */ public ItemBreadDough(final Properties properties) { - super("bread_dough", properties.stacksTo(STACKSIZE)); + super(properties.stacksTo(STACKSIZE)); } } diff --git a/src/main/java/com/minecolonies/core/items/ItemBuildGoggles.java b/src/main/java/com/minecolonies/core/items/ItemBuildGoggles.java index e0226fd5ed3..cadecae00b1 100644 --- a/src/main/java/com/minecolonies/core/items/ItemBuildGoggles.java +++ b/src/main/java/com/minecolonies/core/items/ItemBuildGoggles.java @@ -1,5 +1,6 @@ package com.minecolonies.core.items; +import com.minecolonies.api.items.ModArmorMaterials; import com.minecolonies.core.client.render.worldevent.ColonyBlueprintRenderer; import net.minecraft.ChatFormatting; import net.minecraft.network.chat.Component; @@ -9,8 +10,6 @@ import java.util.List; -import static com.minecolonies.apiimp.initializer.ModItemsInitializer.GOGGLES; - public class ItemBuildGoggles extends ArmorItem { /** @@ -19,11 +18,9 @@ public class ItemBuildGoggles extends ArmorItem * @param name the name. * @param properties the item properties. */ - public ItemBuildGoggles( - @NotNull final String name, - final Item.Properties properties) + public ItemBuildGoggles(final Item.Properties properties) { - super(GOGGLES, Type.HELMET, properties.setNoRepair().rarity(Rarity.UNCOMMON)); + super(ModArmorMaterials.GOGGLES, Type.HELMET, properties.setNoRepair().rarity(Rarity.UNCOMMON)); } @Override diff --git a/src/main/java/com/minecolonies/core/items/ItemCakeBatter.java b/src/main/java/com/minecolonies/core/items/ItemCakeBatter.java index 21355614c7a..782d674ae8d 100755 --- a/src/main/java/com/minecolonies/core/items/ItemCakeBatter.java +++ b/src/main/java/com/minecolonies/core/items/ItemCakeBatter.java @@ -1,11 +1,13 @@ package com.minecolonies.core.items; +import net.minecraft.world.item.Item; + import static com.minecolonies.api.util.constant.Constants.STACKSIZE; /** * Class handling Cake Batter. */ -public class ItemCakeBatter extends AbstractItemMinecolonies +public class ItemCakeBatter extends Item { /** * Sets the name, creative tab, and registers the Cake Batter item. @@ -14,6 +16,6 @@ public class ItemCakeBatter extends AbstractItemMinecolonies */ public ItemCakeBatter(final Properties properties) { - super("cake_batter", properties.stacksTo(STACKSIZE)); + super(properties.stacksTo(STACKSIZE)); } } diff --git a/src/main/java/com/minecolonies/core/items/ItemChorusBread.java b/src/main/java/com/minecolonies/core/items/ItemChorusBread.java index a473f89d006..10a625b115a 100755 --- a/src/main/java/com/minecolonies/core/items/ItemChorusBread.java +++ b/src/main/java/com/minecolonies/core/items/ItemChorusBread.java @@ -8,6 +8,7 @@ import net.minecraft.world.entity.LivingEntity; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.food.FoodProperties; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.Style; @@ -23,7 +24,7 @@ /** * Chorus Bread, made by the baker. Teleports user to surface. */ -public class ItemChorusBread extends AbstractItemMinecolonies +public class ItemChorusBread extends Item { /** @@ -42,7 +43,7 @@ public class ItemChorusBread extends AbstractItemMinecolonies */ public ItemChorusBread(final Properties properties) { - super("chorus_bread", properties.stacksTo(STACKSIZE).food(chorusBread)); + super(properties.stacksTo(STACKSIZE).food(chorusBread)); } /** diff --git a/src/main/java/com/minecolonies/core/items/ItemClipboard.java b/src/main/java/com/minecolonies/core/items/ItemClipboard.java index 2c940e0b4f0..f304d857a4d 100644 --- a/src/main/java/com/minecolonies/core/items/ItemClipboard.java +++ b/src/main/java/com/minecolonies/core/items/ItemClipboard.java @@ -24,7 +24,7 @@ /** * Class describing the clipboard item. */ -public class ItemClipboard extends AbstractItemMinecolonies +public class ItemClipboard extends Item { /** * Tag of the colony. @@ -38,7 +38,7 @@ public class ItemClipboard extends AbstractItemMinecolonies */ public ItemClipboard(final Item.Properties properties) { - super("clipboard", properties.stacksTo(1)); + super(properties.stacksTo(1)); } @Override diff --git a/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java b/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java index 3e3e32e1827..41f45e77b37 100644 --- a/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java +++ b/src/main/java/com/minecolonies/core/items/ItemColonyFlagBanner.java @@ -1,6 +1,5 @@ package com.minecolonies.core.items; -import com.minecolonies.api.blocks.ModBlocks; import com.minecolonies.core.tileentities.TileEntityColonyFlag; import net.minecraft.core.component.DataComponents; import net.minecraft.world.level.block.Block; @@ -24,11 +23,6 @@ */ public class ItemColonyFlagBanner extends BannerItem { - public ItemColonyFlagBanner(String name, Properties properties) - { - this(ModBlocks.blockColonyBanner, ModBlocks.blockColonyWallBanner, properties.stacksTo(1)); - } - public ItemColonyFlagBanner(Block standingBanner, Block wallBanner, Properties builder) { super(standingBanner, wallBanner, builder); diff --git a/src/main/java/com/minecolonies/core/items/ItemCompost.java b/src/main/java/com/minecolonies/core/items/ItemCompost.java index 2bb8727b511..111258938ca 100755 --- a/src/main/java/com/minecolonies/core/items/ItemCompost.java +++ b/src/main/java/com/minecolonies/core/items/ItemCompost.java @@ -19,7 +19,7 @@ /** * Class used to handle the compost item. */ -public class ItemCompost extends AbstractItemMinecolonies +public class ItemCompost extends Item { /*** @@ -28,7 +28,7 @@ public class ItemCompost extends AbstractItemMinecolonies */ public ItemCompost(final Item.Properties properties) { - super("compost", properties.stacksTo(Constants.STACKSIZE)); + super(properties.stacksTo(Constants.STACKSIZE)); } /** diff --git a/src/main/java/com/minecolonies/core/items/ItemCookieDough.java b/src/main/java/com/minecolonies/core/items/ItemCookieDough.java index 6fd44ca02a7..22eeaca7228 100755 --- a/src/main/java/com/minecolonies/core/items/ItemCookieDough.java +++ b/src/main/java/com/minecolonies/core/items/ItemCookieDough.java @@ -1,11 +1,13 @@ package com.minecolonies.core.items; +import net.minecraft.world.item.Item; + import static com.minecolonies.api.util.constant.Constants.STACKSIZE; /** * Class handling Cookie Dough. */ -public class ItemCookieDough extends AbstractItemMinecolonies +public class ItemCookieDough extends Item { /** * Sets the name, creative tab, and registers the Cookie Dough item. @@ -14,6 +16,6 @@ public class ItemCookieDough extends AbstractItemMinecolonies */ public ItemCookieDough(final Properties properties) { - super("cookie_dough", properties.stacksTo(STACKSIZE)); + super(properties.stacksTo(STACKSIZE)); } } diff --git a/src/main/java/com/minecolonies/core/items/ItemGate.java b/src/main/java/com/minecolonies/core/items/ItemGate.java index 16ce4340c7c..41f7722cadf 100644 --- a/src/main/java/com/minecolonies/core/items/ItemGate.java +++ b/src/main/java/com/minecolonies/core/items/ItemGate.java @@ -10,7 +10,6 @@ import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.Style; import net.minecraft.ChatFormatting; -import net.minecraft.world.level.Level; import org.jetbrains.annotations.NotNull; import javax.annotation.Nullable; @@ -22,7 +21,6 @@ public class ItemGate extends BlockItem { public ItemGate( - @NotNull final String name, final Block block, final Properties properties) { diff --git a/src/main/java/com/minecolonies/core/items/ItemGoldenBread.java b/src/main/java/com/minecolonies/core/items/ItemGoldenBread.java index 85cc3e398f7..52ac90e6ecc 100755 --- a/src/main/java/com/minecolonies/core/items/ItemGoldenBread.java +++ b/src/main/java/com/minecolonies/core/items/ItemGoldenBread.java @@ -5,6 +5,7 @@ import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.food.FoodProperties; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.Style; @@ -20,7 +21,7 @@ /** * Golden Bread, made by the Baker. Heals 2 hearts */ -public class ItemGoldenBread extends AbstractItemMinecolonies +public class ItemGoldenBread extends Item { /** @@ -38,7 +39,7 @@ public class ItemGoldenBread extends AbstractItemMinecolonies */ public ItemGoldenBread(final Properties properties) { - super("golden_bread", properties.stacksTo(STACKSIZE).food(goldenBread)); + super(properties.stacksTo(STACKSIZE).food(goldenBread)); } /** diff --git a/src/main/java/com/minecolonies/core/items/ItemLargeBottle.java b/src/main/java/com/minecolonies/core/items/ItemLargeBottle.java index ee6641b7a56..1ee8f127e0d 100644 --- a/src/main/java/com/minecolonies/core/items/ItemLargeBottle.java +++ b/src/main/java/com/minecolonies/core/items/ItemLargeBottle.java @@ -43,7 +43,7 @@ public InteractionResult interactLivingEntity(@NotNull final ItemStack stack, @N if (entity instanceof Cow && !entity.isBaby()) { player.playSound(SoundEvents.COW_MILK, 1.0F, 1.0F); - InventoryUtils.addItemStackToItemHandler(new InvWrapper(player.getInventory()), ModItems.large_milk_bottle.getDefaultInstance()); + InventoryUtils.addItemStackToItemHandler(new InvWrapper(player.getInventory()), ModItems.large_milk_bottle.toStack()); stack.shrink(1); return InteractionResult.SUCCESS; } @@ -69,7 +69,7 @@ public InteractionResultHolder use(@NotNull final Level level, final if (level.getFluidState(blockpos).is(FluidTags.WATER)) { level.playSound(player, player.getX(), player.getY(), player.getZ(), SoundEvents.BOTTLE_FILL, SoundSource.NEUTRAL, 1.0F, 1.0F); - InventoryUtils.addItemStackToItemHandler(new InvWrapper(player.getInventory()), ModItems.large_water_bottle.getDefaultInstance()); + InventoryUtils.addItemStackToItemHandler(new InvWrapper(player.getInventory()), ModItems.large_water_bottle.toStack()); itemstack.shrink(1); return InteractionResultHolder.success(itemstack); } diff --git a/src/main/java/com/minecolonies/core/items/ItemMagicPotion.java b/src/main/java/com/minecolonies/core/items/ItemMagicPotion.java index 7eb28221c22..f2e6cb03648 100644 --- a/src/main/java/com/minecolonies/core/items/ItemMagicPotion.java +++ b/src/main/java/com/minecolonies/core/items/ItemMagicPotion.java @@ -1,17 +1,19 @@ package com.minecolonies.core.items; +import net.minecraft.world.item.Item; + /** * Class describing the magic potion item. */ -public class ItemMagicPotion extends AbstractItemMinecolonies +public class ItemMagicPotion extends Item { /** * Sets the name, creative tab, and registers the magic potion item. * * @param properties the properties. */ - public ItemMagicPotion(String name, Properties properties) + public ItemMagicPotion(Properties properties) { - super(name, properties.stacksTo(16)); + super(properties.stacksTo(16)); } } diff --git a/src/main/java/com/minecolonies/core/items/ItemMilkyBread.java b/src/main/java/com/minecolonies/core/items/ItemMilkyBread.java index 758dca4fc67..a11eb7d7a55 100755 --- a/src/main/java/com/minecolonies/core/items/ItemMilkyBread.java +++ b/src/main/java/com/minecolonies/core/items/ItemMilkyBread.java @@ -5,6 +5,7 @@ import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.food.FoodProperties; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.Style; @@ -21,7 +22,7 @@ /** * Milk Bread item, made by the baker, with milk bucket effect */ -public class ItemMilkyBread extends AbstractItemMinecolonies +public class ItemMilkyBread extends Item { /** @@ -39,7 +40,7 @@ public class ItemMilkyBread extends AbstractItemMinecolonies */ public ItemMilkyBread(final Properties properties) { - super("milky_bread", properties.stacksTo(STACKSIZE).food(milkBread)); + super(properties.stacksTo(STACKSIZE).food(milkBread)); } /** diff --git a/src/main/java/com/minecolonies/core/items/ItemMistletoe.java b/src/main/java/com/minecolonies/core/items/ItemMistletoe.java index 4ff4c074125..a7282511b19 100644 --- a/src/main/java/com/minecolonies/core/items/ItemMistletoe.java +++ b/src/main/java/com/minecolonies/core/items/ItemMistletoe.java @@ -1,11 +1,13 @@ package com.minecolonies.core.items; +import net.minecraft.world.item.Item; + import static com.minecolonies.api.util.constant.Constants.STACKSIZE; /** * Class describing the Ancient Tome item. */ -public class ItemMistletoe extends AbstractItemMinecolonies +public class ItemMistletoe extends Item { /** * Sets the name, creative tab, and registers the Ancient Tome item. @@ -14,6 +16,6 @@ public class ItemMistletoe extends AbstractItemMinecolonies */ public ItemMistletoe(final Properties properties) { - super("mistletoe", properties.stacksTo(STACKSIZE)); + super(properties.stacksTo(STACKSIZE)); } } diff --git a/src/main/java/com/minecolonies/core/items/ItemPharaoScepter.java b/src/main/java/com/minecolonies/core/items/ItemPharaoScepter.java index 32d0c462bf0..cc41145d4e7 100755 --- a/src/main/java/com/minecolonies/core/items/ItemPharaoScepter.java +++ b/src/main/java/com/minecolonies/core/items/ItemPharaoScepter.java @@ -10,7 +10,6 @@ import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.projectile.AbstractArrow; -import net.minecraft.world.item.ArrowItem; import net.minecraft.world.item.BowItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.Level; @@ -106,7 +105,7 @@ public AbstractArrow customArrow(final AbstractArrow arrow, final ItemStack proj return arrow; } - AbstractArrow entity = ((ArrowItem) ModItems.firearrow).createArrow(arrow.level(), new ItemStack(ModItems.firearrow, 1), (LivingEntity) arrow.getOwner(), weaponStack); + AbstractArrow entity = ModItems.firearrow.get().createArrow(arrow.level(), ModItems.firearrow.toStack(), (LivingEntity) arrow.getOwner(), weaponStack); entity.pickup = AbstractArrow.Pickup.DISALLOWED; entity.setRemainingFireTicks(3 * TICKS_PER_SECOND); diff --git a/src/main/java/com/minecolonies/core/items/ItemPirateGear.java b/src/main/java/com/minecolonies/core/items/ItemPirateGear.java index 70aed3dc2c7..9273dadc51b 100755 --- a/src/main/java/com/minecolonies/core/items/ItemPirateGear.java +++ b/src/main/java/com/minecolonies/core/items/ItemPirateGear.java @@ -18,7 +18,6 @@ public class ItemPirateGear extends ArmorItem * @param name the name. */ public ItemPirateGear( - @NotNull final String name, @NotNull final Holder materialIn, @NotNull final Type equipmentSlotIn, final Item.Properties properties) diff --git a/src/main/java/com/minecolonies/core/items/ItemPlateArmor.java b/src/main/java/com/minecolonies/core/items/ItemPlateArmor.java index 03f1d39730a..a43676e1e50 100644 --- a/src/main/java/com/minecolonies/core/items/ItemPlateArmor.java +++ b/src/main/java/com/minecolonies/core/items/ItemPlateArmor.java @@ -19,7 +19,6 @@ public class ItemPlateArmor extends ArmorItem * @param name the name. */ public ItemPlateArmor( - @NotNull final String name, @NotNull final Holder materialIn, @NotNull final ArmorItem.Type equipmentSlotIn, final Properties properties) diff --git a/src/main/java/com/minecolonies/core/items/ItemQuestLog.java b/src/main/java/com/minecolonies/core/items/ItemQuestLog.java index e32d09d16ac..eb3d7cc5bcf 100644 --- a/src/main/java/com/minecolonies/core/items/ItemQuestLog.java +++ b/src/main/java/com/minecolonies/core/items/ItemQuestLog.java @@ -25,7 +25,7 @@ /** * Class describing the quest log item. */ -public class ItemQuestLog extends AbstractItemMinecolonies +public class ItemQuestLog extends Item { /** * Tag of the colony. @@ -39,7 +39,7 @@ public class ItemQuestLog extends AbstractItemMinecolonies */ public ItemQuestLog(final Item.Properties properties) { - super("questlog", properties.stacksTo(STACKSIZE)); + super(properties.stacksTo(STACKSIZE)); } @Override diff --git a/src/main/java/com/minecolonies/core/items/ItemRawPumpkinPie.java b/src/main/java/com/minecolonies/core/items/ItemRawPumpkinPie.java index 2d3a0814627..d5555a2cc4d 100755 --- a/src/main/java/com/minecolonies/core/items/ItemRawPumpkinPie.java +++ b/src/main/java/com/minecolonies/core/items/ItemRawPumpkinPie.java @@ -1,11 +1,13 @@ package com.minecolonies.core.items; +import net.minecraft.world.item.Item; + import static com.minecolonies.api.util.constant.Constants.STACKSIZE; /** * Class handling Raw Pumpkin Pie. */ -public class ItemRawPumpkinPie extends AbstractItemMinecolonies +public class ItemRawPumpkinPie extends Item { /** * Sets the name, creative tab, and registers the Raw Pumpkin Pie item. @@ -14,6 +16,6 @@ public class ItemRawPumpkinPie extends AbstractItemMinecolonies */ public ItemRawPumpkinPie(final Properties properties) { - super("raw_pumpkin_pie", properties.stacksTo(STACKSIZE)); + super(properties.stacksTo(STACKSIZE)); } } diff --git a/src/main/java/com/minecolonies/core/items/ItemResourceScroll.java b/src/main/java/com/minecolonies/core/items/ItemResourceScroll.java index cd748e7b1fc..af99098affd 100644 --- a/src/main/java/com/minecolonies/core/items/ItemResourceScroll.java +++ b/src/main/java/com/minecolonies/core/items/ItemResourceScroll.java @@ -42,7 +42,7 @@ /** * Class describing the resource scroll item. */ -public class ItemResourceScroll extends AbstractItemMinecolonies +public class ItemResourceScroll extends Item { /** * Sets the name, creative tab, and registers the resource scroll item. @@ -51,7 +51,7 @@ public class ItemResourceScroll extends AbstractItemMinecolonies */ public ItemResourceScroll(final Item.Properties properties) { - super("resourcescroll", properties.stacksTo(1)); + super(properties.stacksTo(1)); } /** diff --git a/src/main/java/com/minecolonies/core/items/ItemSantaHead.java b/src/main/java/com/minecolonies/core/items/ItemSantaHead.java index 3a49fbb2faf..cd9832b3dc9 100755 --- a/src/main/java/com/minecolonies/core/items/ItemSantaHead.java +++ b/src/main/java/com/minecolonies/core/items/ItemSantaHead.java @@ -20,7 +20,6 @@ public class ItemSantaHead extends ArmorItem * @param properties the item properties. */ public ItemSantaHead( - @NotNull final String name, @NotNull final Holder materialIn, @NotNull final Type equipmentSlotIn, final Item.Properties properties) diff --git a/src/main/java/com/minecolonies/core/items/ItemScanAnalyzer.java b/src/main/java/com/minecolonies/core/items/ItemScanAnalyzer.java index bf50e873729..6c805d01676 100644 --- a/src/main/java/com/minecolonies/core/items/ItemScanAnalyzer.java +++ b/src/main/java/com/minecolonies/core/items/ItemScanAnalyzer.java @@ -23,7 +23,6 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.AABB; -import org.jetbrains.annotations.NotNull; import java.util.Optional; @@ -51,9 +50,7 @@ public class ItemScanAnalyzer extends AbstractItemWithPosSelector private static BlockPos lastPos2 = BlockPos.ZERO; public static Blueprint blueprint = null; - public ItemScanAnalyzer( - @NotNull final String name, - final Item.Properties properties) + public ItemScanAnalyzer(final Item.Properties properties) { super(properties.durability(0) .setNoRepair() @@ -61,16 +58,6 @@ public ItemScanAnalyzer( .component(ModDataComponents.POS_SELECTION, PosSelection.EMPTY)); } - /** - * MC constructor. - * - * @param properties properties - */ - public ItemScanAnalyzer(final Properties properties) - { - super(properties); - } - /** * Structurize: Prevent block breaking server side. * {@inheritDoc} @@ -122,7 +109,7 @@ public InteractionResult onAirRightClick(final BlockPos start, final BlockPos en @Override public AbstractItemWithPosSelector getRegisteredItemInstance() { - return (AbstractItemWithPosSelector) ModItems.scanAnalyzer; + return ModItems.scanAnalyzer.get(); } /** diff --git a/src/main/java/com/minecolonies/core/items/ItemScepterBeekeeper.java b/src/main/java/com/minecolonies/core/items/ItemScepterBeekeeper.java index 692efdfff04..710bcb6da12 100644 --- a/src/main/java/com/minecolonies/core/items/ItemScepterBeekeeper.java +++ b/src/main/java/com/minecolonies/core/items/ItemScepterBeekeeper.java @@ -11,6 +11,7 @@ import net.minecraft.sounds.SoundEvents; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.level.Level; @@ -27,7 +28,7 @@ /** * Beekeeper Scepter Item class. Used to give tasks to Beekeeper. */ -public class ItemScepterBeekeeper extends AbstractItemMinecolonies implements IBlockOverlayItem +public class ItemScepterBeekeeper extends Item implements IBlockOverlayItem { private static final int RED_OVERLAY = 0xFFFF0000; private static final int YELLOW_OVERLAY = 0xFFFFFF00; @@ -39,7 +40,7 @@ public class ItemScepterBeekeeper extends AbstractItemMinecolonies implements IB */ public ItemScepterBeekeeper(final Properties properties) { - super("scepterbeekeeper", properties.stacksTo(1)); + super(properties.stacksTo(1)); } @Override diff --git a/src/main/java/com/minecolonies/core/items/ItemScepterGuard.java b/src/main/java/com/minecolonies/core/items/ItemScepterGuard.java index 2f65ec4eb8e..756d089fffb 100644 --- a/src/main/java/com/minecolonies/core/items/ItemScepterGuard.java +++ b/src/main/java/com/minecolonies/core/items/ItemScepterGuard.java @@ -22,7 +22,7 @@ /** * Guard Scepter Item class. Used to give tasks to guards. */ -public class ItemScepterGuard extends AbstractItemMinecolonies +public class ItemScepterGuard extends Item { /** * GuardScepter constructor. Sets max stack to 1, like other tools. @@ -31,7 +31,7 @@ public class ItemScepterGuard extends AbstractItemMinecolonies */ public ItemScepterGuard(final Item.Properties properties) { - super("scepterguard", properties.stacksTo(1).durability(2).component(ModDataComponents.PATROL_TARGET, PatrolTarget.EMPTY)); + super(properties.stacksTo(1).durability(2).component(ModDataComponents.PATROL_TARGET, PatrolTarget.EMPTY)); } @NotNull diff --git a/src/main/java/com/minecolonies/core/items/ItemScepterLumberjack.java b/src/main/java/com/minecolonies/core/items/ItemScepterLumberjack.java index f10cecae24e..a0b1ac07942 100644 --- a/src/main/java/com/minecolonies/core/items/ItemScepterLumberjack.java +++ b/src/main/java/com/minecolonies/core/items/ItemScepterLumberjack.java @@ -11,6 +11,7 @@ import net.minecraft.core.BlockPos; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.level.Level; @@ -28,7 +29,7 @@ /** * Lumberjack Scepter Item class. Used to give tasks to Lumberjacks. */ -public class ItemScepterLumberjack extends AbstractItemMinecolonies implements IBlockOverlayItem +public class ItemScepterLumberjack extends Item implements IBlockOverlayItem { private static final int RED_OVERLAY = 0xFFFF0000; private static final int GREEN_OVERLAY = 0xFF00FF00; @@ -40,7 +41,7 @@ public class ItemScepterLumberjack extends AbstractItemMinecolonies implements I */ public ItemScepterLumberjack(final Properties properties) { - super("scepterlumberjack", properties.stacksTo(1).component(ModDataComponents.POS_SELECTION, PosSelection.EMPTY)); + super(properties.stacksTo(1).component(ModDataComponents.POS_SELECTION, PosSelection.EMPTY)); } @NotNull diff --git a/src/main/java/com/minecolonies/core/items/ItemScepterPermission.java b/src/main/java/com/minecolonies/core/items/ItemScepterPermission.java index 6bf04b05bda..843cf324fdc 100644 --- a/src/main/java/com/minecolonies/core/items/ItemScepterPermission.java +++ b/src/main/java/com/minecolonies/core/items/ItemScepterPermission.java @@ -37,7 +37,7 @@ /** * Permission scepter. used to add free to interact blocks or positions to the colonies permission list */ -public class ItemScepterPermission extends AbstractItemMinecolonies implements IBlockOverlayItem +public class ItemScepterPermission extends Item implements IBlockOverlayItem { private static final int GREEN_OVERLAY = 0xFF00FF00; private static final int BLOCK_OVERLAY_RANGE_XZ = 32; @@ -52,7 +52,7 @@ public class ItemScepterPermission extends AbstractItemMinecolonies implements I */ public ItemScepterPermission(final Item.Properties properties) { - super("scepterpermission", properties.stacksTo(1).durability(2).component(ModDataComponents.PERMISSION_MODE, PermissionMode.EMPTY)); + super(properties.stacksTo(1).durability(2).component(ModDataComponents.PERMISSION_MODE, PermissionMode.EMPTY)); } @NotNull diff --git a/src/main/java/com/minecolonies/core/items/ItemScrollBuff.java b/src/main/java/com/minecolonies/core/items/ItemScrollBuff.java index 3636a5e09f0..a19a570c66b 100644 --- a/src/main/java/com/minecolonies/core/items/ItemScrollBuff.java +++ b/src/main/java/com/minecolonies/core/items/ItemScrollBuff.java @@ -38,7 +38,7 @@ public class ItemScrollBuff extends AbstractItemScroll */ public ItemScrollBuff(final Properties properties) { - super("scroll_buff", properties); + super(properties); } @Override diff --git a/src/main/java/com/minecolonies/core/items/ItemScrollColonyAreaTP.java b/src/main/java/com/minecolonies/core/items/ItemScrollColonyAreaTP.java index 804e9834168..1fd728c5201 100644 --- a/src/main/java/com/minecolonies/core/items/ItemScrollColonyAreaTP.java +++ b/src/main/java/com/minecolonies/core/items/ItemScrollColonyAreaTP.java @@ -39,7 +39,7 @@ public class ItemScrollColonyAreaTP extends AbstractItemScroll */ public ItemScrollColonyAreaTP(final Properties properties) { - super("scroll_area_tp", properties); + super(properties); } @Override diff --git a/src/main/java/com/minecolonies/core/items/ItemScrollColonyTP.java b/src/main/java/com/minecolonies/core/items/ItemScrollColonyTP.java index 2475d5ecaa6..148efdb7ce3 100644 --- a/src/main/java/com/minecolonies/core/items/ItemScrollColonyTP.java +++ b/src/main/java/com/minecolonies/core/items/ItemScrollColonyTP.java @@ -44,7 +44,7 @@ public class ItemScrollColonyTP extends AbstractItemScroll */ public ItemScrollColonyTP(final Properties properties) { - super("scroll_tp", properties); + super(properties); } @Override diff --git a/src/main/java/com/minecolonies/core/items/ItemScrollGuardHelp.java b/src/main/java/com/minecolonies/core/items/ItemScrollGuardHelp.java index 4ec68d786f1..8543af6cc6e 100644 --- a/src/main/java/com/minecolonies/core/items/ItemScrollGuardHelp.java +++ b/src/main/java/com/minecolonies/core/items/ItemScrollGuardHelp.java @@ -55,7 +55,7 @@ public class ItemScrollGuardHelp extends AbstractItemScroll */ public ItemScrollGuardHelp(final Properties properties) { - super("scroll_guard_help", properties); + super(properties); } @Override diff --git a/src/main/java/com/minecolonies/core/items/ItemScrollHighlight.java b/src/main/java/com/minecolonies/core/items/ItemScrollHighlight.java index 3d4a75ff376..493482210e4 100644 --- a/src/main/java/com/minecolonies/core/items/ItemScrollHighlight.java +++ b/src/main/java/com/minecolonies/core/items/ItemScrollHighlight.java @@ -40,7 +40,7 @@ public class ItemScrollHighlight extends AbstractItemScroll */ public ItemScrollHighlight(final Properties properties) { - super("scroll_highlight", properties); + super(properties); } @Override diff --git a/src/main/java/com/minecolonies/core/items/ItemSifterMesh.java b/src/main/java/com/minecolonies/core/items/ItemSifterMesh.java index 4269f13bef2..cf8a959eb3a 100755 --- a/src/main/java/com/minecolonies/core/items/ItemSifterMesh.java +++ b/src/main/java/com/minecolonies/core/items/ItemSifterMesh.java @@ -1,11 +1,11 @@ package com.minecolonies.core.items; -import org.jetbrains.annotations.NotNull; +import net.minecraft.world.item.Item; /** * Class handling Sifter Mesh. */ -public class ItemSifterMesh extends AbstractItemMinecolonies +public class ItemSifterMesh extends Item { /** * Sets the name, creative tab, and registers the Sifter Mesh item. @@ -13,9 +13,8 @@ public class ItemSifterMesh extends AbstractItemMinecolonies * @param properties the properties. */ public ItemSifterMesh( - @NotNull final String name, final Properties properties) { - super(name, properties); + super(properties); } } diff --git a/src/main/java/com/minecolonies/core/items/ItemSugaryBread.java b/src/main/java/com/minecolonies/core/items/ItemSugaryBread.java index 3f7ff74f2b4..cf8478a0835 100755 --- a/src/main/java/com/minecolonies/core/items/ItemSugaryBread.java +++ b/src/main/java/com/minecolonies/core/items/ItemSugaryBread.java @@ -5,6 +5,7 @@ import net.minecraft.world.item.TooltipFlag; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.food.FoodProperties; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; @@ -22,7 +23,7 @@ /** * Sweet Bread, made by the baker. Adds speed, removes poison */ -public class ItemSugaryBread extends AbstractItemMinecolonies +public class ItemSugaryBread extends Item { /** @@ -41,7 +42,7 @@ public class ItemSugaryBread extends AbstractItemMinecolonies */ public ItemSugaryBread(final Properties properties) { - super("sugary_bread", properties.stacksTo(STACKSIZE).food(sweetBread)); + super(properties.stacksTo(STACKSIZE).food(sweetBread)); } /** diff --git a/src/main/java/com/minecolonies/core/items/ItemSupplyCampDeployer.java b/src/main/java/com/minecolonies/core/items/ItemSupplyCampDeployer.java index fd28550bfbc..aec67410286 100644 --- a/src/main/java/com/minecolonies/core/items/ItemSupplyCampDeployer.java +++ b/src/main/java/com/minecolonies/core/items/ItemSupplyCampDeployer.java @@ -37,7 +37,7 @@ /** * Class to handle the placement of the supplychest and with it the supplycamp. */ -public class ItemSupplyCampDeployer extends AbstractItemMinecolonies implements ISupplyItem +public class ItemSupplyCampDeployer extends Item implements ISupplyItem { /** * Creates a new supplycamp deployer. The item is not stackable. @@ -46,7 +46,7 @@ public class ItemSupplyCampDeployer extends AbstractItemMinecolonies implements */ public ItemSupplyCampDeployer(final Item.Properties properties) { - super("supplycampdeployer", properties.stacksTo(1)); + super(properties.stacksTo(1)); } @NotNull diff --git a/src/main/java/com/minecolonies/core/items/ItemSupplyChestDeployer.java b/src/main/java/com/minecolonies/core/items/ItemSupplyChestDeployer.java index 4c652b992ab..37aec90e5aa 100644 --- a/src/main/java/com/minecolonies/core/items/ItemSupplyChestDeployer.java +++ b/src/main/java/com/minecolonies/core/items/ItemSupplyChestDeployer.java @@ -39,7 +39,7 @@ /** * Class to handle the placement of the supplychest and with it the supplyship. */ -public class ItemSupplyChestDeployer extends AbstractItemMinecolonies implements ISupplyItem +public class ItemSupplyChestDeployer extends Item implements ISupplyItem { /** * StructureIterator name and location. @@ -68,7 +68,7 @@ public class ItemSupplyChestDeployer extends AbstractItemMinecolonies implements */ public ItemSupplyChestDeployer(final Item.Properties properties) { - super("supplychestdeployer", properties.stacksTo(1)); + super(properties.stacksTo(1)); } @NotNull diff --git a/src/main/java/com/minecolonies/core/network/messages/server/DirectPlaceMessage.java b/src/main/java/com/minecolonies/core/network/messages/server/DirectPlaceMessage.java index 12e3c93ca03..7d6b0fb2921 100644 --- a/src/main/java/com/minecolonies/core/network/messages/server/DirectPlaceMessage.java +++ b/src/main/java/com/minecolonies/core/network/messages/server/DirectPlaceMessage.java @@ -99,7 +99,7 @@ protected void onExecute(final IPayloadContext ctxIn, final ServerPlayer player) final IColony colony = IColonyManager.getInstance().getColonyByPosFromWorld(world, pos); InventoryUtils.reduceStackInItemHandler(new InvWrapper(player.getInventory()), stack); - if ((colony == null && state.getBlock() == ModBlocks.blockHutTownHall) || (colony != null && colony.getPermissions().hasPermission(player, Action.MANAGE_HUTS))) + if ((colony == null && state.getBlock() == ModBlocks.blockHutTownHall.get()) || (colony != null && colony.getPermissions().hasPermission(player, Action.MANAGE_HUTS))) { final ColonyId colonyId = ColonyId.readFromItemStack(stack); if (colony != null && colonyId.hasColonyId() && colony.getID() != colonyId.id()) diff --git a/src/main/java/com/minecolonies/core/network/messages/server/SwitchBuildingWithToolMessage.java b/src/main/java/com/minecolonies/core/network/messages/server/SwitchBuildingWithToolMessage.java index 32ebb3228ef..ded5d65bdf2 100644 --- a/src/main/java/com/minecolonies/core/network/messages/server/SwitchBuildingWithToolMessage.java +++ b/src/main/java/com/minecolonies/core/network/messages/server/SwitchBuildingWithToolMessage.java @@ -67,7 +67,7 @@ protected void onExecute(final IPayloadContext ctxIn, final ServerPlayer player) { stackSlot = i; } - else if (player.getInventory().getItem(i).getItem() == ModItems.buildTool.get()) + else if (player.getInventory().getItem(i).is(ModItems.buildTool)) { buildToolSlot = i; } @@ -75,7 +75,7 @@ else if (player.getInventory().getItem(i).getItem() == ModItems.buildTool.get()) for (int i = 9; i < player.getInventory().getContainerSize(); i++) { - if (player.getInventory().getItem(i).getItem() == ModItems.buildTool.get()) + if (player.getInventory().getItem(i).is(ModItems.buildTool)) { buildToolSlot = i; } @@ -84,7 +84,7 @@ else if (player.getInventory().getItem(i).getItem() == ModItems.buildTool.get()) if (stackSlot != -1 && buildToolSlot != -1) { player.getInventory().setItem(buildToolSlot, player.getInventory().getItem(stackSlot).copy()); - player.getInventory().setItem(stackSlot, new ItemStack(ModItems.buildTool.get(), 1)); + player.getInventory().setItem(stackSlot, ModItems.buildTool.toStack()); } } } diff --git a/src/main/java/com/minecolonies/core/placementhandlers/BarracksTowerHandler.java b/src/main/java/com/minecolonies/core/placementhandlers/BarracksTowerHandler.java index c543f81bcd8..b401f60a9b6 100644 --- a/src/main/java/com/minecolonies/core/placementhandlers/BarracksTowerHandler.java +++ b/src/main/java/com/minecolonies/core/placementhandlers/BarracksTowerHandler.java @@ -28,7 +28,7 @@ public class BarracksTowerHandler implements IPlacementHandler @Override public boolean canHandle(@NotNull final Level world, @NotNull final BlockPos pos, @NotNull final BlockState blockState) { - return blockState.getBlock() == ModBlocks.blockHutBarracksTower; + return blockState.getBlock() == ModBlocks.blockHutBarracksTower.get(); } @Override diff --git a/src/main/java/com/minecolonies/core/placementhandlers/DoBlockPlacementHandler.java b/src/main/java/com/minecolonies/core/placementhandlers/DoBlockPlacementHandler.java index ec9bc71181a..2ce60017450 100644 --- a/src/main/java/com/minecolonies/core/placementhandlers/DoBlockPlacementHandler.java +++ b/src/main/java/com/minecolonies/core/placementhandlers/DoBlockPlacementHandler.java @@ -46,7 +46,7 @@ public class DoBlockPlacementHandler implements IPlacementHandler @Override public boolean canHandle(@NotNull final Level world, @NotNull final BlockPos pos, @NotNull final BlockState blockState) { - return blockState.getBlock() instanceof IMateriallyTexturedBlock && blockState.getBlock() != ModBlocks.blockRack; + return blockState.getBlock() instanceof IMateriallyTexturedBlock && blockState.getBlock() != ModBlocks.blockRack.get(); } @Override diff --git a/src/main/java/com/minecolonies/core/placementhandlers/FieldPlacementHandler.java b/src/main/java/com/minecolonies/core/placementhandlers/FieldPlacementHandler.java index 4bcb883d7c2..070165a4fc7 100644 --- a/src/main/java/com/minecolonies/core/placementhandlers/FieldPlacementHandler.java +++ b/src/main/java/com/minecolonies/core/placementhandlers/FieldPlacementHandler.java @@ -39,7 +39,7 @@ public ActionProcessingResult handle( BlockPos centerPos, final RotationMirror settings) { - if (world.getBlockState(pos).getBlock() == ModBlocks.blockScarecrow) + if (world.getBlockState(pos).getBlock() == ModBlocks.blockScarecrow.get()) { return ActionProcessingResult.SUCCESS; } diff --git a/src/main/java/com/minecolonies/core/placementhandlers/GravePlacementHandler.java b/src/main/java/com/minecolonies/core/placementhandlers/GravePlacementHandler.java index f6ab45eb4d1..ab6f4dde7d8 100644 --- a/src/main/java/com/minecolonies/core/placementhandlers/GravePlacementHandler.java +++ b/src/main/java/com/minecolonies/core/placementhandlers/GravePlacementHandler.java @@ -41,7 +41,7 @@ public ActionProcessingResult handle( final BlockPos centerPos, final RotationMirror settings) { - if (world.getBlockState(pos).getBlock() == ModBlocks.blockGrave) + if (world.getBlockState(pos).getBlock() == ModBlocks.blockGrave.get()) { return ActionProcessingResult.SUCCESS; } diff --git a/src/main/java/com/minecolonies/core/placementhandlers/HutPlacementHandler.java b/src/main/java/com/minecolonies/core/placementhandlers/HutPlacementHandler.java index d28fd55feb2..68a5a9a0806 100644 --- a/src/main/java/com/minecolonies/core/placementhandlers/HutPlacementHandler.java +++ b/src/main/java/com/minecolonies/core/placementhandlers/HutPlacementHandler.java @@ -120,7 +120,7 @@ public List getRequiredItems( final boolean complete) { final List itemList = new ArrayList<>(); - if (blockState.getBlock() != ModBlocks.blockHutBarracksTower) + if (blockState.getBlock() != ModBlocks.blockHutBarracksTower.get()) { itemList.add(BlockUtils.getItemStackFromBlockState(blockState)); } diff --git a/src/main/java/com/minecolonies/core/placementhandlers/NamedGravePlacementHandler.java b/src/main/java/com/minecolonies/core/placementhandlers/NamedGravePlacementHandler.java index 5f41f9a7591..e0461525435 100644 --- a/src/main/java/com/minecolonies/core/placementhandlers/NamedGravePlacementHandler.java +++ b/src/main/java/com/minecolonies/core/placementhandlers/NamedGravePlacementHandler.java @@ -34,7 +34,7 @@ public ActionProcessingResult handle( final BlockPos centerPos, final RotationMirror settings) { - if (world.getBlockState(pos).getBlock() == ModBlocks.blockNamedGrave) + if (world.getBlockState(pos).getBlock() == ModBlocks.blockNamedGrave.get()) { return ActionProcessingResult.SUCCESS; } diff --git a/src/main/java/com/minecolonies/core/placementhandlers/RackPlacementHandler.java b/src/main/java/com/minecolonies/core/placementhandlers/RackPlacementHandler.java index b189dd4923b..4cca6a11d1e 100644 --- a/src/main/java/com/minecolonies/core/placementhandlers/RackPlacementHandler.java +++ b/src/main/java/com/minecolonies/core/placementhandlers/RackPlacementHandler.java @@ -40,7 +40,7 @@ public ActionProcessingResult handle( final BlockPos centerPos, final RotationMirror settings) { - if (world.getBlockState(pos).getBlock() == ModBlocks.blockRack) + if (world.getBlockState(pos).getBlock() == ModBlocks.blockRack.get()) { return ActionProcessingResult.SUCCESS; } @@ -62,7 +62,7 @@ public List getRequiredItems( final boolean complete) { final List itemList = new ArrayList<>(); - if (world.getBlockState(pos).getBlock() == ModBlocks.blockRack && !complete) + if (world.getBlockState(pos).getBlock() == ModBlocks.blockRack.get() && !complete) { return itemList; } diff --git a/src/main/java/com/minecolonies/core/placementhandlers/main/SuppliesHandler.java b/src/main/java/com/minecolonies/core/placementhandlers/main/SuppliesHandler.java index 2da763d93f2..2e0be3ebaf8 100644 --- a/src/main/java/com/minecolonies/core/placementhandlers/main/SuppliesHandler.java +++ b/src/main/java/com/minecolonies/core/placementhandlers/main/SuppliesHandler.java @@ -76,7 +76,7 @@ public void handle( blueprint.setRotationMirror(rotMir, world); - if (player.getStats().getValue(Stats.ITEM_USED.get(ModItems.supplyChest)) > 0 && !MineColonies.getConfig().getServer().allowInfiniteSupplyChests.get() + if (player.getStats().getValue(Stats.ITEM_USED.get(ModItems.supplyChest.get())) > 0 && !MineColonies.getConfig().getServer().allowInfiniteSupplyChests.get() && !isFreeInstantPlacementMH(player) && !player.isCreative()) { MessageUtils.format(WARNING_SUPPLY_CHEST_ALREADY_PLACED).sendTo(player); @@ -87,11 +87,11 @@ public void handle( Predicate searchPredicate = stack -> !stack.isEmpty(); if (blueprintPath.contains("supplyship")) { - searchPredicate = searchPredicate.and(stack -> ItemStackUtils.compareItemStacksIgnoreStackSize(stack, new ItemStack(ModItems.supplyChest), true, false)); + searchPredicate = searchPredicate.and(stack -> ItemStackUtils.compareItemStacksIgnoreStackSize(stack, ModItems.supplyChest.toStack(), true, false)); } if (blueprintPath.contains("supplycamp")) { - searchPredicate = searchPredicate.and(stack -> ItemStackUtils.compareItemStacksIgnoreStackSize(stack, new ItemStack(ModItems.supplyCamp), true, false)); + searchPredicate = searchPredicate.and(stack -> ItemStackUtils.compareItemStacksIgnoreStackSize(stack, ModItems.supplyCamp.toStack(), true, false)); } if (isFreeInstantPlacementMH(player)) @@ -103,10 +103,10 @@ public void handle( if (slot != -1 && !ItemStackUtils.isEmpty(player.getInventory().removeItemNoUpdate(slot))) { - if (player.getStats().getValue(Stats.ITEM_USED.get(ModItems.supplyChest)) < 1) + if (player.getStats().getValue(Stats.ITEM_USED.get(ModItems.supplyChest.get())) < 1) { MessageUtils.format(PROGRESS_SUPPLY_CHEST_PLACED).sendTo(player); - player.awardStat(Stats.ITEM_USED.get(ModItems.supplyChest), 1); + player.awardStat(Stats.ITEM_USED.get(ModItems.supplyChest.get()), 1); AdvancementTriggers.PLACE_SUPPLY.get().trigger(player); } diff --git a/src/main/java/com/minecolonies/core/tileentities/TileEntityBarrel.java b/src/main/java/com/minecolonies/core/tileentities/TileEntityBarrel.java index 57b88cf7e4b..821da45cdf4 100755 --- a/src/main/java/com/minecolonies/core/tileentities/TileEntityBarrel.java +++ b/src/main/java/com/minecolonies/core/tileentities/TileEntityBarrel.java @@ -122,7 +122,7 @@ public boolean useBarrel(final Player playerIn, final ItemStack itemstack, @Null { if (done) { - ItemStack compostStack = new ItemStack(ModItems.compost, 6); + ItemStack compostStack = ModItems.compost.toStack(6); if (hitFace != null) // Spawn all as ItemEntity { playerIn.level().addFreshEntity(new ItemEntity(playerIn.level(), worldPosition.getX() + 0.5, worldPosition.getY() + 1.75, worldPosition.getZ() + 0.5, compostStack, hitFace.getStepX() / 5f, hitFace.getStepY() / 5f + 0.2f, hitFace.getStepZ() / 5f)); @@ -194,7 +194,7 @@ private static RecipeHolder findCompostRecipe(final ItemStack ite public void updateBlock(final Level worldIn) { final BlockState barrel = level.getBlockState(worldPosition); - if (barrel.getBlock() == ModBlocks.blockBarrel) + if (barrel.getBlock() == ModBlocks.blockBarrel.get()) { worldIn.setBlockAndUpdate(worldPosition, AbstractBlockBarrel.changeStateOverFullness(this, barrel)); setChanged(); @@ -321,7 +321,7 @@ public ItemStack retrieveCompost(final double multiplier) { this.done = false; this.updateBlock(this.level); - return new ItemStack(ModItems.compost, (int) (6 * multiplier)); + return ModItems.compost.toStack((int) (6 * multiplier)); } return ItemStack.EMPTY; } diff --git a/src/main/java/com/minecolonies/core/tileentities/TileEntityRack.java b/src/main/java/com/minecolonies/core/tileentities/TileEntityRack.java index 17d15e3d95d..24bb490c5db 100755 --- a/src/main/java/com/minecolonies/core/tileentities/TileEntityRack.java +++ b/src/main/java/com/minecolonies/core/tileentities/TileEntityRack.java @@ -292,7 +292,7 @@ public void updateItemStorage() { final boolean beforeEmpty = content.isEmpty(); updateContent(); - if (getBlockState().getBlock() == ModBlocks.blockRack) + if (getBlockState().getBlock() == ModBlocks.blockRack.get()) { boolean afterEmpty = content.isEmpty(); @Nullable final BlockEntity potentialNeighbor = getOtherChest(); @@ -351,7 +351,7 @@ private void updateContent() @Override public AbstractTileEntityRack getOtherChest() { - if (getBlockState().getBlock() != ModBlocks.blockRack) + if (getBlockState().getBlock() != ModBlocks.blockRack.get()) { return null; } @@ -480,7 +480,7 @@ public IItemHandler getItemHandlerCap(Direction direction) return lastItemHandlerCap; } - if (getBlockState().getBlock() != ModBlocks.blockRack) + if (getBlockState().getBlock() != ModBlocks.blockRack.get()) { lastItemHandlerCap = new CombinedItemHandler(RACK, getInventory()); return lastItemHandlerCap;