Rebrand, Remove Trap and Dirt Chests, Remove Cat AI, Update language files, Update model files, Update to the latest forge 1.18 version
This commit is contained in:
parent
9b215c5d3e
commit
684efc54fa
16
build.gradle
16
build.gradle
|
@ -21,7 +21,7 @@ repositories {
|
|||
}
|
||||
}
|
||||
|
||||
group = "com.progwml6.ironchest"
|
||||
group = "dev.ubujira.ironbarrels"
|
||||
|
||||
// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||
|
@ -190,13 +190,13 @@ processResources {
|
|||
jar {
|
||||
manifest {
|
||||
attributes([
|
||||
"Specification-Title" : "Iron Chests",
|
||||
"Specification-Vendor" : "Progwml6",
|
||||
"Specification-Version" : "1", // We are version 1 of ourselves
|
||||
"Implementation-Title" : project.name,
|
||||
"Implementation-Version" : "${version}",
|
||||
"Implementation-Vendor" : "Progwml6",
|
||||
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||
"Specification-Title" : "Iron Barrels",
|
||||
"Specification-Vendor" : "Progwml6, Ubujira",
|
||||
"Specification-Version" : "1", // We are version 1 of ourselves
|
||||
"Implementation-Title" : project.name,
|
||||
"Implementation-Version" : "${version}",
|
||||
"Implementation-Vendor" : "Progwml6, Ubujira",
|
||||
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||
])
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,21 +2,16 @@
|
|||
# This is required to provide enough memory for the Minecraft decompilation process.
|
||||
org.gradle.jvmargs=-Xmx3G
|
||||
org.gradle.daemon=false
|
||||
|
||||
# Mod Version Information
|
||||
mod_version=13.0
|
||||
|
||||
# Minecraft Version Information
|
||||
minecraft_version=1.18
|
||||
minecraft_range=[1.18,1.19)
|
||||
|
||||
# Forge Version Information
|
||||
loader_range=[38,)
|
||||
forge_version=38.0.10
|
||||
forge_range=[38.0.10,)
|
||||
|
||||
forge_version=38.0.17
|
||||
forge_range=[38.0.17,)
|
||||
# Mappings Information
|
||||
mappings_version=1.18
|
||||
|
||||
# Build dependencies
|
||||
jei_version=1.16.4:7.6.1.65
|
||||
|
|
|
@ -16,4 +16,4 @@ include 'api'
|
|||
include 'services:webservice'
|
||||
*/
|
||||
|
||||
rootProject.name = 'ironchest'
|
||||
rootProject.name = 'ironbarrels'
|
||||
|
|
|
@ -1,80 +0,0 @@
|
|||
package com.progwml6.ironchest.client.model;
|
||||
|
||||
import com.progwml6.ironchest.IronChests;
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import net.minecraft.client.renderer.Sheets;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = IronChests.MOD_ID, value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
public class IronChestsModels {
|
||||
|
||||
public static final ResourceLocation IRON_CHEST_LOCATION = new ResourceLocation(IronChests.MOD_ID, "model/iron_chest");
|
||||
public static final ResourceLocation GOLD_CHEST_LOCATION = new ResourceLocation(IronChests.MOD_ID, "model/gold_chest");
|
||||
public static final ResourceLocation DIAMOND_CHEST_LOCATION = new ResourceLocation(IronChests.MOD_ID, "model/diamond_chest");
|
||||
public static final ResourceLocation COPPER_CHEST_LOCATION = new ResourceLocation(IronChests.MOD_ID, "model/copper_chest");
|
||||
public static final ResourceLocation CRYSTAL_CHEST_LOCATION = new ResourceLocation(IronChests.MOD_ID, "model/crystal_chest");
|
||||
public static final ResourceLocation OBSIDIAN_CHEST_LOCATION = new ResourceLocation(IronChests.MOD_ID, "model/obsidian_chest");
|
||||
public static final ResourceLocation DIRT_CHEST_LOCATION = new ResourceLocation(IronChests.MOD_ID, "model/dirt_chest");
|
||||
public static final ResourceLocation VANILLA_CHEST_LOCATION = new ResourceLocation("entity/chest/normal");
|
||||
|
||||
public static final ResourceLocation TRAPPED_IRON_CHEST_LOCATION = new ResourceLocation(IronChests.MOD_ID, "model/trapped_iron_chest");
|
||||
public static final ResourceLocation TRAPPED_GOLD_CHEST_LOCATION = new ResourceLocation(IronChests.MOD_ID, "model/trapped_gold_chest");
|
||||
public static final ResourceLocation TRAPPED_DIAMOND_CHEST_LOCATION = new ResourceLocation(IronChests.MOD_ID, "model/trapped_diamond_chest");
|
||||
public static final ResourceLocation TRAPPED_COPPER_CHEST_LOCATION = new ResourceLocation(IronChests.MOD_ID, "model/trapped_copper_chest");
|
||||
public static final ResourceLocation TRAPPED_CRYSTAL_CHEST_LOCATION = new ResourceLocation(IronChests.MOD_ID, "model/trapped_crystal_chest");
|
||||
public static final ResourceLocation TRAPPED_OBSIDIAN_CHEST_LOCATION = new ResourceLocation(IronChests.MOD_ID, "model/trapped_obsidian_chest");
|
||||
public static final ResourceLocation TRAPPED_DIRT_CHEST_LOCATION = new ResourceLocation(IronChests.MOD_ID, "model/trapped_dirt_chest");
|
||||
public static final ResourceLocation TRAPPED_VANILLA_CHEST_LOCATION = new ResourceLocation("entity/chest/trapped");
|
||||
|
||||
public static ResourceLocation chooseChestTexture(IronChestsTypes type, boolean trapped) {
|
||||
if (trapped)
|
||||
return switch (type) {
|
||||
case IRON -> TRAPPED_IRON_CHEST_LOCATION;
|
||||
case GOLD -> TRAPPED_GOLD_CHEST_LOCATION;
|
||||
case DIAMOND -> TRAPPED_DIAMOND_CHEST_LOCATION;
|
||||
case COPPER -> TRAPPED_COPPER_CHEST_LOCATION;
|
||||
case CRYSTAL -> TRAPPED_CRYSTAL_CHEST_LOCATION;
|
||||
case OBSIDIAN -> TRAPPED_OBSIDIAN_CHEST_LOCATION;
|
||||
case DIRT -> TRAPPED_DIRT_CHEST_LOCATION;
|
||||
default -> TRAPPED_VANILLA_CHEST_LOCATION;
|
||||
};
|
||||
else
|
||||
return switch (type) {
|
||||
case IRON -> IRON_CHEST_LOCATION;
|
||||
case GOLD -> GOLD_CHEST_LOCATION;
|
||||
case DIAMOND -> DIAMOND_CHEST_LOCATION;
|
||||
case COPPER -> COPPER_CHEST_LOCATION;
|
||||
case CRYSTAL -> CRYSTAL_CHEST_LOCATION;
|
||||
case OBSIDIAN -> OBSIDIAN_CHEST_LOCATION;
|
||||
case DIRT -> DIRT_CHEST_LOCATION;
|
||||
default -> VANILLA_CHEST_LOCATION;
|
||||
};
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onStitch(TextureStitchEvent.Pre event) {
|
||||
if (!event.getAtlas().location().equals(Sheets.CHEST_SHEET)) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.addSprite(IRON_CHEST_LOCATION);
|
||||
event.addSprite(GOLD_CHEST_LOCATION);
|
||||
event.addSprite(DIAMOND_CHEST_LOCATION);
|
||||
event.addSprite(COPPER_CHEST_LOCATION);
|
||||
event.addSprite(CRYSTAL_CHEST_LOCATION);
|
||||
event.addSprite(OBSIDIAN_CHEST_LOCATION);
|
||||
event.addSprite(DIRT_CHEST_LOCATION);
|
||||
|
||||
event.addSprite(TRAPPED_IRON_CHEST_LOCATION);
|
||||
event.addSprite(TRAPPED_GOLD_CHEST_LOCATION);
|
||||
event.addSprite(TRAPPED_DIAMOND_CHEST_LOCATION);
|
||||
event.addSprite(TRAPPED_COPPER_CHEST_LOCATION);
|
||||
event.addSprite(TRAPPED_CRYSTAL_CHEST_LOCATION);
|
||||
event.addSprite(TRAPPED_OBSIDIAN_CHEST_LOCATION);
|
||||
event.addSprite(TRAPPED_DIRT_CHEST_LOCATION);
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
package com.progwml6.ironchest.common.ai;
|
||||
|
||||
import com.progwml6.ironchest.IronChests;
|
||||
import net.minecraft.world.entity.ai.goal.CatSitOnBlockGoal;
|
||||
import net.minecraft.world.entity.ai.goal.WrappedGoal;
|
||||
import net.minecraft.world.entity.animal.Cat;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = IronChests.MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE)
|
||||
public class CatsSitOnChestsHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
static void changeSittingTaskForOcelots(final LivingEvent.LivingUpdateEvent evt) {
|
||||
if (evt.getEntityLiving().tickCount < 5 && evt.getEntityLiving() instanceof Cat cat) {
|
||||
HashSet<WrappedGoal> goals = new HashSet<>();
|
||||
|
||||
for (WrappedGoal goal : cat.goalSelector.availableGoals) {
|
||||
if (goal.getGoal().getClass() == CatSitOnBlockGoal.class) {
|
||||
goals.add(goal);
|
||||
}
|
||||
}
|
||||
|
||||
for (WrappedGoal goal : goals) {
|
||||
cat.goalSelector.removeGoal(goal.getGoal());
|
||||
cat.goalSelector.addGoal(goal.getPriority(), new IronChestCatSitOnBlockGoal(cat, 0.4F));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
package com.progwml6.ironchest.common.ai;
|
||||
|
||||
import com.progwml6.ironchest.common.block.regular.AbstractIronChestBlock;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.AbstractIronChestBlockEntity;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.entity.ai.goal.CatSitOnBlockGoal;
|
||||
import net.minecraft.world.entity.animal.Cat;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.LevelReader;
|
||||
|
||||
public class IronChestCatSitOnBlockGoal extends CatSitOnBlockGoal {
|
||||
|
||||
public IronChestCatSitOnBlockGoal(Cat cat, double speedModifier) {
|
||||
super(cat, speedModifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isValidTarget(LevelReader worldIn, BlockPos pos) {
|
||||
if (!worldIn.isEmptyBlock(pos.above())) {
|
||||
return false;
|
||||
} else {
|
||||
BlockState blockstate = worldIn.getBlockState(pos);
|
||||
Block block = blockstate.getBlock();
|
||||
|
||||
if (block instanceof AbstractIronChestBlock) {
|
||||
return AbstractIronChestBlockEntity.getOpenCount(worldIn, pos) < 1;
|
||||
}
|
||||
|
||||
return super.isValidTarget(worldIn, pos);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,113 +0,0 @@
|
|||
package com.progwml6.ironchest.common.block;
|
||||
|
||||
import com.progwml6.ironchest.IronChests;
|
||||
import com.progwml6.ironchest.common.block.regular.CopperChestBlock;
|
||||
import com.progwml6.ironchest.common.block.regular.CrystalChestBlock;
|
||||
import com.progwml6.ironchest.common.block.regular.DiamondChestBlock;
|
||||
import com.progwml6.ironchest.common.block.regular.DirtChestBlock;
|
||||
import com.progwml6.ironchest.common.block.regular.GoldChestBlock;
|
||||
import com.progwml6.ironchest.common.block.regular.IronChestBlock;
|
||||
import com.progwml6.ironchest.common.block.regular.ObsidianChestBlock;
|
||||
import com.progwml6.ironchest.common.block.trapped.TrappedCopperChestBlock;
|
||||
import com.progwml6.ironchest.common.block.trapped.TrappedCrystalChestBlock;
|
||||
import com.progwml6.ironchest.common.block.trapped.TrappedDiamondChestBlock;
|
||||
import com.progwml6.ironchest.common.block.trapped.TrappedDirtChestBlock;
|
||||
import com.progwml6.ironchest.common.block.trapped.TrappedGoldChestBlock;
|
||||
import com.progwml6.ironchest.common.block.trapped.TrappedIronChestBlock;
|
||||
import com.progwml6.ironchest.common.block.trapped.TrappedObsidianChestBlock;
|
||||
import com.progwml6.ironchest.common.item.IronChestBlockItem;
|
||||
import com.progwml6.ironchest.common.item.IronChestsItems;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class IronChestsBlocks {
|
||||
|
||||
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, IronChests.MOD_ID);
|
||||
public static final DeferredRegister<Item> ITEMS = IronChestsItems.ITEMS;
|
||||
|
||||
public static final RegistryObject<IronChestBlock> IRON_CHEST = register(
|
||||
"iron_chest", () -> new IronChestBlock(Block.Properties.of(Material.METAL).strength(3.0F)),
|
||||
IronChestsTypes.IRON, false);
|
||||
|
||||
public static final RegistryObject<GoldChestBlock> GOLD_CHEST = register(
|
||||
"gold_chest", () -> new GoldChestBlock(Block.Properties.of(Material.METAL).strength(3.0F)),
|
||||
IronChestsTypes.GOLD, false);
|
||||
|
||||
public static final RegistryObject<DiamondChestBlock> DIAMOND_CHEST = register(
|
||||
"diamond_chest", () -> new DiamondChestBlock(Block.Properties.of(Material.METAL).strength(3.0F)),
|
||||
IronChestsTypes.DIAMOND, false);
|
||||
|
||||
public static final RegistryObject<CopperChestBlock> COPPER_CHEST = register(
|
||||
"copper_chest", () -> new CopperChestBlock(Block.Properties.of(Material.METAL).strength(3.0F)),
|
||||
IronChestsTypes.COPPER, false);
|
||||
|
||||
public static final RegistryObject<CrystalChestBlock> CRYSTAL_CHEST = register(
|
||||
"crystal_chest", () -> new CrystalChestBlock(Block.Properties.of(Material.METAL).strength(3.0F)),
|
||||
IronChestsTypes.CRYSTAL, false);
|
||||
|
||||
public static final RegistryObject<ObsidianChestBlock> OBSIDIAN_CHEST = register(
|
||||
"obsidian_chest", () -> new ObsidianChestBlock(Block.Properties.of(Material.METAL).strength(3.0F)),
|
||||
IronChestsTypes.OBSIDIAN, false);
|
||||
|
||||
public static final RegistryObject<DirtChestBlock> DIRT_CHEST = register(
|
||||
"dirt_chest", () -> new DirtChestBlock(Block.Properties.of(Material.METAL).strength(3.0F)),
|
||||
IronChestsTypes.DIRT, false);
|
||||
|
||||
// Trapped Chests
|
||||
public static final RegistryObject<TrappedIronChestBlock> TRAPPED_IRON_CHEST = register(
|
||||
"trapped_iron_chest", () -> new TrappedIronChestBlock(Block.Properties.of(Material.METAL).strength(3.0F)),
|
||||
IronChestsTypes.IRON, true);
|
||||
|
||||
public static final RegistryObject<TrappedGoldChestBlock> TRAPPED_GOLD_CHEST = register(
|
||||
"trapped_gold_chest", () -> new TrappedGoldChestBlock(Block.Properties.of(Material.METAL).strength(3.0F)),
|
||||
IronChestsTypes.GOLD, true);
|
||||
|
||||
public static final RegistryObject<TrappedDiamondChestBlock> TRAPPED_DIAMOND_CHEST = register(
|
||||
"trapped_diamond_chest", () -> new TrappedDiamondChestBlock(Block.Properties.of(Material.METAL).strength(3.0F)),
|
||||
IronChestsTypes.DIAMOND, true);
|
||||
|
||||
public static final RegistryObject<TrappedCopperChestBlock> TRAPPED_COPPER_CHEST = register(
|
||||
"trapped_copper_chest", () -> new TrappedCopperChestBlock(Block.Properties.of(Material.METAL).strength(3.0F)),
|
||||
IronChestsTypes.COPPER, true);
|
||||
|
||||
public static final RegistryObject<TrappedCrystalChestBlock> TRAPPED_CRYSTAL_CHEST = register(
|
||||
"trapped_crystal_chest", () -> new TrappedCrystalChestBlock(Block.Properties.of(Material.METAL).strength(3.0F)),
|
||||
IronChestsTypes.CRYSTAL, true);
|
||||
|
||||
public static final RegistryObject<TrappedObsidianChestBlock> TRAPPED_OBSIDIAN_CHEST = register(
|
||||
"trapped_obsidian_chest", () -> new TrappedObsidianChestBlock(Block.Properties.of(Material.METAL).strength(3.0F)),
|
||||
IronChestsTypes.OBSIDIAN, true);
|
||||
|
||||
public static final RegistryObject<TrappedDirtChestBlock> TRAPPED_DIRT_CHEST = register(
|
||||
"trapped_dirt_chest", () -> new TrappedDirtChestBlock(Block.Properties.of(Material.METAL).strength(3.0F)),
|
||||
IronChestsTypes.DIRT, true);
|
||||
|
||||
//HELPERS
|
||||
|
||||
private static <T extends Block> RegistryObject<T> register(String name, Supplier<? extends T> sup, IronChestsTypes chestType, boolean trapped) {
|
||||
return register(name, sup, block -> item(block, () -> () -> chestType, () -> () -> trapped));
|
||||
}
|
||||
|
||||
private static <T extends Block> RegistryObject<T> register(String name, Supplier<? extends T> sup, Function<RegistryObject<T>, Supplier<? extends Item>> itemCreator) {
|
||||
RegistryObject<T> ret = registerNoItem(name, sup);
|
||||
ITEMS.register(name, itemCreator.apply(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static <T extends Block> RegistryObject<T> registerNoItem(String name, Supplier<? extends T> sup) {
|
||||
return BLOCKS.register(name, sup);
|
||||
}
|
||||
|
||||
private static Supplier<BlockItem> item(final RegistryObject<? extends Block> block, Supplier<Callable<IronChestsTypes>> chestType, Supplier<Callable<Boolean>> trapped) {
|
||||
return () -> new IronChestBlockItem(block.get(), new Item.Properties().tab(IronChests.IRONCHESTS_ITEM_GROUP), chestType, trapped);
|
||||
}
|
||||
}
|
|
@ -1,126 +0,0 @@
|
|||
package com.progwml6.ironchest.common.block;
|
||||
|
||||
import com.progwml6.ironchest.common.Util;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.AbstractIronChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.CopperChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.CrystalChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.DiamondChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.DirtChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.GoldChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.IronChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.ObsidianChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.trapped.entity.TrappedCopperChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.trapped.entity.TrappedCrystalChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.trapped.entity.TrappedDiamondChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.trapped.entity.TrappedDirtChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.trapped.entity.TrappedGoldChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.trapped.entity.TrappedIronChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.trapped.entity.TrappedObsidianChestBlockEntity;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.util.StringRepresentable;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public enum IronChestsTypes implements StringRepresentable {
|
||||
|
||||
IRON(54, 9, 184, 222, new ResourceLocation("ironchest", "textures/gui/iron_container.png"), 256, 256),
|
||||
GOLD(81, 9, 184, 276, new ResourceLocation("ironchest", "textures/gui/gold_container.png"), 256, 276),
|
||||
DIAMOND(108, 12, 238, 276, new ResourceLocation("ironchest", "textures/gui/diamond_container.png"), 256, 276),
|
||||
COPPER(45, 9, 184, 204, new ResourceLocation("ironchest", "textures/gui/copper_container.png"), 256, 256),
|
||||
CRYSTAL(108, 12, 238, 276, new ResourceLocation("ironchest", "textures/gui/diamond_container.png"), 256, 276),
|
||||
OBSIDIAN(108, 12, 238, 276, new ResourceLocation("ironchest", "textures/gui/diamond_container.png"), 256, 276),
|
||||
DIRT(1, 1, 184, 184, new ResourceLocation("ironchest", "textures/gui/dirt_container.png"), 256, 256),
|
||||
WOOD(0, 0, 0, 0, null, 0, 0);
|
||||
|
||||
private final String name;
|
||||
public final int size;
|
||||
public final int rowLength;
|
||||
public final int xSize;
|
||||
public final int ySize;
|
||||
public final ResourceLocation guiTexture;
|
||||
public final int textureXSize;
|
||||
public final int textureYSize;
|
||||
|
||||
IronChestsTypes(int size, int rowLength, int xSize, int ySize, ResourceLocation guiTexture, int textureXSize, int textureYSize) {
|
||||
this(null, size, rowLength, xSize, ySize, guiTexture, textureXSize, textureYSize);
|
||||
}
|
||||
|
||||
IronChestsTypes(@Nullable String name, int size, int rowLength, int xSize, int ySize, ResourceLocation guiTexture, int textureXSize, int textureYSize) {
|
||||
this.name = name == null ? Util.toEnglishName(this.name()) : name;
|
||||
this.size = size;
|
||||
this.rowLength = rowLength;
|
||||
this.xSize = xSize;
|
||||
this.ySize = ySize;
|
||||
this.guiTexture = guiTexture;
|
||||
this.textureXSize = textureXSize;
|
||||
this.textureYSize = textureYSize;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return this.name().toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
public String getEnglishName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSerializedName() {
|
||||
return this.getEnglishName();
|
||||
}
|
||||
|
||||
public int getRowCount() {
|
||||
return this.size / this.rowLength;
|
||||
}
|
||||
|
||||
public boolean isTransparent() {
|
||||
return this == CRYSTAL;
|
||||
}
|
||||
|
||||
public static List<Block> get(IronChestsTypes type) {
|
||||
return switch (type) {
|
||||
case IRON -> Arrays.asList(IronChestsBlocks.IRON_CHEST.get(), IronChestsBlocks.TRAPPED_IRON_CHEST.get());
|
||||
case GOLD -> Arrays.asList(IronChestsBlocks.GOLD_CHEST.get(), IronChestsBlocks.TRAPPED_GOLD_CHEST.get());
|
||||
case DIAMOND -> Arrays.asList(IronChestsBlocks.DIAMOND_CHEST.get(), IronChestsBlocks.TRAPPED_DIAMOND_CHEST.get());
|
||||
case COPPER -> Arrays.asList(IronChestsBlocks.COPPER_CHEST.get(), IronChestsBlocks.TRAPPED_COPPER_CHEST.get());
|
||||
case CRYSTAL -> Arrays.asList(IronChestsBlocks.CRYSTAL_CHEST.get(), IronChestsBlocks.TRAPPED_CRYSTAL_CHEST.get());
|
||||
case OBSIDIAN -> Arrays.asList(IronChestsBlocks.OBSIDIAN_CHEST.get(), IronChestsBlocks.TRAPPED_OBSIDIAN_CHEST.get());
|
||||
case DIRT -> Arrays.asList(IronChestsBlocks.DIRT_CHEST.get(), IronChestsBlocks.TRAPPED_DIRT_CHEST.get());
|
||||
default -> List.of(Blocks.CHEST);
|
||||
};
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public AbstractIronChestBlockEntity makeEntity(BlockPos blockPos, BlockState blockState, boolean trapped) {
|
||||
if(trapped) {
|
||||
return switch (this) {
|
||||
case IRON -> new TrappedIronChestBlockEntity(blockPos, blockState);
|
||||
case GOLD -> new TrappedGoldChestBlockEntity(blockPos, blockState);
|
||||
case DIAMOND -> new TrappedDiamondChestBlockEntity(blockPos, blockState);
|
||||
case COPPER -> new TrappedCopperChestBlockEntity(blockPos, blockState);
|
||||
case CRYSTAL -> new TrappedCrystalChestBlockEntity(blockPos, blockState);
|
||||
case OBSIDIAN -> new TrappedObsidianChestBlockEntity(blockPos, blockState);
|
||||
case DIRT -> new TrappedDirtChestBlockEntity(blockPos, blockState);
|
||||
default -> null;
|
||||
};
|
||||
} else {
|
||||
return switch (this) {
|
||||
case IRON -> new IronChestBlockEntity(blockPos, blockState);
|
||||
case GOLD -> new GoldChestBlockEntity(blockPos, blockState);
|
||||
case DIAMOND -> new DiamondChestBlockEntity(blockPos, blockState);
|
||||
case COPPER -> new CopperChestBlockEntity(blockPos, blockState);
|
||||
case CRYSTAL -> new CrystalChestBlockEntity(blockPos, blockState);
|
||||
case OBSIDIAN -> new ObsidianChestBlockEntity(blockPos, blockState);
|
||||
case DIRT -> new DirtChestBlockEntity(blockPos, blockState);
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,71 +0,0 @@
|
|||
package com.progwml6.ironchest.common.block.entity;
|
||||
|
||||
import com.progwml6.ironchest.IronChests;
|
||||
import com.progwml6.ironchest.common.block.IronChestsBlocks;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.CopperChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.CrystalChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.DiamondChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.DirtChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.GoldChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.IronChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.ObsidianChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.trapped.entity.TrappedCopperChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.trapped.entity.TrappedCrystalChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.trapped.entity.TrappedDiamondChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.trapped.entity.TrappedDirtChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.trapped.entity.TrappedGoldChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.trapped.entity.TrappedIronChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.trapped.entity.TrappedObsidianChestBlockEntity;
|
||||
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
|
||||
public class IronChestsBlockEntityTypes {
|
||||
public static final DeferredRegister<BlockEntityType<?>> BLOCK_ENTITIES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITIES, IronChests.MOD_ID);
|
||||
|
||||
public static final RegistryObject<BlockEntityType<IronChestBlockEntity>> IRON_CHEST = BLOCK_ENTITIES.register(
|
||||
"iron_chest", () -> BlockEntityType.Builder.of(IronChestBlockEntity::new, IronChestsBlocks.IRON_CHEST.get()).build(null));
|
||||
|
||||
public static final RegistryObject<BlockEntityType<GoldChestBlockEntity>> GOLD_CHEST = BLOCK_ENTITIES.register(
|
||||
"gold_chest", () -> BlockEntityType.Builder.of(GoldChestBlockEntity::new, IronChestsBlocks.GOLD_CHEST.get()).build(null));
|
||||
|
||||
public static final RegistryObject<BlockEntityType<DiamondChestBlockEntity>> DIAMOND_CHEST = BLOCK_ENTITIES.register(
|
||||
"diamond_chest", () -> BlockEntityType.Builder.of(DiamondChestBlockEntity::new, IronChestsBlocks.DIAMOND_CHEST.get()).build(null));
|
||||
|
||||
public static final RegistryObject<BlockEntityType<CopperChestBlockEntity>> COPPER_CHEST = BLOCK_ENTITIES.register(
|
||||
"copper_chest", () -> BlockEntityType.Builder.of(CopperChestBlockEntity::new, IronChestsBlocks.COPPER_CHEST.get()).build(null));
|
||||
|
||||
public static final RegistryObject<BlockEntityType<CrystalChestBlockEntity>> CRYSTAL_CHEST = BLOCK_ENTITIES.register(
|
||||
"crystal_chest", () -> BlockEntityType.Builder.of(CrystalChestBlockEntity::new, IronChestsBlocks.CRYSTAL_CHEST.get()).build(null));
|
||||
|
||||
public static final RegistryObject<BlockEntityType<ObsidianChestBlockEntity>> OBSIDIAN_CHEST = BLOCK_ENTITIES.register(
|
||||
"obsidian_chest", () -> BlockEntityType.Builder.of(ObsidianChestBlockEntity::new, IronChestsBlocks.OBSIDIAN_CHEST.get()).build(null));
|
||||
|
||||
public static final RegistryObject<BlockEntityType<DirtChestBlockEntity>> DIRT_CHEST = BLOCK_ENTITIES.register(
|
||||
"dirt_chest", () -> BlockEntityType.Builder.of(DirtChestBlockEntity::new, IronChestsBlocks.DIRT_CHEST.get()).build(null));
|
||||
|
||||
// Trapped Chests
|
||||
|
||||
public static final RegistryObject<BlockEntityType<TrappedIronChestBlockEntity>> TRAPPED_IRON_CHEST = BLOCK_ENTITIES.register(
|
||||
"trapped_iron_chest", () -> BlockEntityType.Builder.of(TrappedIronChestBlockEntity::new, IronChestsBlocks.TRAPPED_IRON_CHEST.get()).build(null));
|
||||
|
||||
public static final RegistryObject<BlockEntityType<TrappedGoldChestBlockEntity>> TRAPPED_GOLD_CHEST = BLOCK_ENTITIES.register(
|
||||
"trapped_gold_chest", () -> BlockEntityType.Builder.of(TrappedGoldChestBlockEntity::new, IronChestsBlocks.TRAPPED_GOLD_CHEST.get()).build(null));
|
||||
|
||||
public static final RegistryObject<BlockEntityType<TrappedDiamondChestBlockEntity>> TRAPPED_DIAMOND_CHEST = BLOCK_ENTITIES.register(
|
||||
"trapped_diamond_chest", () -> BlockEntityType.Builder.of(TrappedDiamondChestBlockEntity::new, IronChestsBlocks.TRAPPED_DIAMOND_CHEST.get()).build(null));
|
||||
|
||||
public static final RegistryObject<BlockEntityType<TrappedCopperChestBlockEntity>> TRAPPED_COPPER_CHEST = BLOCK_ENTITIES.register(
|
||||
"trapped_copper_chest", () -> BlockEntityType.Builder.of(TrappedCopperChestBlockEntity::new, IronChestsBlocks.TRAPPED_COPPER_CHEST.get()).build(null));
|
||||
|
||||
public static final RegistryObject<BlockEntityType<TrappedCrystalChestBlockEntity>> TRAPPED_CRYSTAL_CHEST = BLOCK_ENTITIES.register(
|
||||
"trapped_crystal_chest", () -> BlockEntityType.Builder.of(TrappedCrystalChestBlockEntity::new, IronChestsBlocks.TRAPPED_CRYSTAL_CHEST.get()).build(null));
|
||||
|
||||
public static final RegistryObject<BlockEntityType<TrappedObsidianChestBlockEntity>> TRAPPED_OBSIDIAN_CHEST = BLOCK_ENTITIES.register(
|
||||
"trapped_obsidian_chest", () -> BlockEntityType.Builder.of(TrappedObsidianChestBlockEntity::new, IronChestsBlocks.TRAPPED_OBSIDIAN_CHEST.get()).build(null));
|
||||
|
||||
public static final RegistryObject<BlockEntityType<TrappedDirtChestBlockEntity>> TRAPPED_DIRT_CHEST = BLOCK_ENTITIES.register(
|
||||
"trapped_dirt_chest", () -> BlockEntityType.Builder.of(TrappedDirtChestBlockEntity::new, IronChestsBlocks.TRAPPED_DIRT_CHEST.get()).build(null));
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package com.progwml6.ironchest.common.block.entity;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -1,7 +0,0 @@
|
|||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package com.progwml6.ironchest.common.block;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -1,23 +0,0 @@
|
|||
package com.progwml6.ironchest.common.block.regular;
|
||||
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.DirtChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class DirtChestBlock extends AbstractIronChestBlock {
|
||||
|
||||
public DirtChestBlock(Properties properties) {
|
||||
super(properties, IronChestsBlockEntityTypes.DIRT_CHEST::get, IronChestsTypes.DIRT);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) {
|
||||
return new DirtChestBlockEntity(blockPos, blockState);
|
||||
}
|
||||
}
|
|
@ -1,73 +0,0 @@
|
|||
package com.progwml6.ironchest.common.block.regular.entity;
|
||||
|
||||
import com.progwml6.ironchest.common.block.IronChestsBlocks;
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import com.progwml6.ironchest.common.inventory.IronChestMenu;
|
||||
import net.minecraft.client.resources.language.I18n;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.nbt.StringTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Objects;
|
||||
|
||||
public class DirtChestBlockEntity extends AbstractIronChestBlockEntity {
|
||||
|
||||
private static ItemStack DIRT_CHEST_BOOK = new ItemStack(Items.WRITTEN_BOOK);
|
||||
|
||||
private static boolean bookDataCreated = false;
|
||||
|
||||
public DirtChestBlockEntity(BlockPos blockPos, BlockState blockState) {
|
||||
super(IronChestsBlockEntityTypes.DIRT_CHEST.get(), blockPos, blockState, IronChestsTypes.DIRT, IronChestsBlocks.DIRT_CHEST::get);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractContainerMenu createMenu(int containerId, Inventory playerInventory) {
|
||||
return IronChestMenu.createDirtContainer(containerId, playerInventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wasPlaced(@Nullable LivingEntity livingEntity, ItemStack itemStack) {
|
||||
if (!(itemStack.hasTag() && Objects.requireNonNull(itemStack.getTag()).getBoolean("been_placed"))) {
|
||||
//TODO FIX BOOK
|
||||
//this.setInventorySlotContents(0, DIRT_CHEST_BOOK.copy());
|
||||
}
|
||||
|
||||
if (!bookDataCreated) {
|
||||
//createBookData();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAdornments() {
|
||||
if (!this.getItems().get(0).isEmpty() && this.getItems().get(0).sameItem(DIRT_CHEST_BOOK)) {
|
||||
this.getItems().set(0, ItemStack.EMPTY);
|
||||
}
|
||||
}
|
||||
|
||||
private static void createBookData() {
|
||||
DIRT_CHEST_BOOK.addTagElement("author", StringTag.valueOf("cpw"));
|
||||
|
||||
DIRT_CHEST_BOOK.addTagElement("title", StringTag.valueOf(I18n.get("book.ironchest.dirtchest9000.title")));
|
||||
|
||||
ListTag pages = new ListTag();
|
||||
pages.add(StringTag.valueOf(Component.Serializer.toJson(new TranslatableComponent("book.ironchest.dirtchest9000.page1"))));
|
||||
pages.add(StringTag.valueOf(Component.Serializer.toJson(new TranslatableComponent("book.ironchest.dirtchest9000.page2"))));
|
||||
pages.add(StringTag.valueOf(Component.Serializer.toJson(new TranslatableComponent("book.ironchest.dirtchest9000.page3"))));
|
||||
pages.add(StringTag.valueOf(Component.Serializer.toJson(new TranslatableComponent("book.ironchest.dirtchest9000.page4"))));
|
||||
pages.add(StringTag.valueOf(Component.Serializer.toJson(new TranslatableComponent("book.ironchest.dirtchest9000.page5"))));
|
||||
|
||||
DIRT_CHEST_BOOK.addTagElement("pages", pages);
|
||||
|
||||
bookDataCreated = true;
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package com.progwml6.ironchest.common.block.regular.entity;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -1,7 +0,0 @@
|
|||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package com.progwml6.ironchest.common.block.regular;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -1,44 +0,0 @@
|
|||
package com.progwml6.ironchest.common.block.trapped;
|
||||
|
||||
import com.progwml6.ironchest.common.block.regular.AbstractIronChestBlock;
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.AbstractIronChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.trapped.entity.AbstractTrappedIronChestBlockEntity;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.stats.Stat;
|
||||
import net.minecraft.stats.Stats;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public abstract class AbstractTrappedIronChestBlock extends AbstractIronChestBlock {
|
||||
|
||||
public AbstractTrappedIronChestBlock(Properties properties, Supplier<BlockEntityType<? extends AbstractIronChestBlockEntity>> blockEntityType, IronChestsTypes type) {
|
||||
super(properties, blockEntityType, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Stat<ResourceLocation> getOpenChestStat() {
|
||||
return Stats.CUSTOM.get(Stats.TRIGGER_TRAPPED_CHEST);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSignalSource(BlockState blockState) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSignal(BlockState blockState, BlockGetter blockGetter, BlockPos blockPos, Direction direction) {
|
||||
return Mth.clamp(AbstractTrappedIronChestBlockEntity.getOpenCount(blockGetter, blockPos), 0, 15);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDirectSignal(BlockState blockState, BlockGetter blockGetter, BlockPos blockPos, Direction direction) {
|
||||
return direction == Direction.UP ? blockState.getSignal(blockGetter, blockPos, direction) : 0;
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
package com.progwml6.ironchest.common.block.trapped;
|
||||
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import com.progwml6.ironchest.common.block.trapped.entity.TrappedCopperChestBlockEntity;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class TrappedCopperChestBlock extends AbstractTrappedIronChestBlock {
|
||||
|
||||
public TrappedCopperChestBlock(Properties properties) {
|
||||
super(properties, IronChestsBlockEntityTypes.TRAPPED_COPPER_CHEST::get, IronChestsTypes.COPPER);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) {
|
||||
return new TrappedCopperChestBlockEntity(blockPos, blockState);
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
package com.progwml6.ironchest.common.block.trapped;
|
||||
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.AbstractIronChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.trapped.entity.TrappedCrystalChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityTicker;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class TrappedCrystalChestBlock extends AbstractTrappedIronChestBlock {
|
||||
|
||||
public TrappedCrystalChestBlock(Properties properties) {
|
||||
super(properties, IronChestsBlockEntityTypes.TRAPPED_CRYSTAL_CHEST::get, IronChestsTypes.CRYSTAL);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) {
|
||||
return new TrappedCrystalChestBlockEntity(blockPos, blockState);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState blockState, BlockEntityType<T> blockEntityType) {
|
||||
return level.isClientSide ? createTickerHelper(blockEntityType, this.blockEntityType(), AbstractIronChestBlockEntity::lidAnimateTick) : createTickerHelper(blockEntityType, this.blockEntityType(), TrappedCrystalChestBlockEntity::tick);
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
package com.progwml6.ironchest.common.block.trapped;
|
||||
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import com.progwml6.ironchest.common.block.trapped.entity.TrappedDiamondChestBlockEntity;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class TrappedDiamondChestBlock extends AbstractTrappedIronChestBlock {
|
||||
|
||||
public TrappedDiamondChestBlock(Properties properties) {
|
||||
super(properties, IronChestsBlockEntityTypes.TRAPPED_DIAMOND_CHEST::get, IronChestsTypes.DIAMOND);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) {
|
||||
return new TrappedDiamondChestBlockEntity(blockPos, blockState);
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
package com.progwml6.ironchest.common.block.trapped;
|
||||
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import com.progwml6.ironchest.common.block.trapped.entity.TrappedDirtChestBlockEntity;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class TrappedDirtChestBlock extends AbstractTrappedIronChestBlock {
|
||||
|
||||
public TrappedDirtChestBlock(Properties properties) {
|
||||
super(properties, IronChestsBlockEntityTypes.TRAPPED_DIRT_CHEST::get, IronChestsTypes.DIRT);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) {
|
||||
return new TrappedDirtChestBlockEntity(blockPos, blockState);
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
package com.progwml6.ironchest.common.block.trapped;
|
||||
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import com.progwml6.ironchest.common.block.trapped.entity.TrappedGoldChestBlockEntity;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class TrappedGoldChestBlock extends AbstractTrappedIronChestBlock {
|
||||
|
||||
public TrappedGoldChestBlock(Properties properties) {
|
||||
super(properties, IronChestsBlockEntityTypes.TRAPPED_GOLD_CHEST::get, IronChestsTypes.GOLD);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) {
|
||||
return new TrappedGoldChestBlockEntity(blockPos, blockState);
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
package com.progwml6.ironchest.common.block.trapped;
|
||||
|
||||
import com.progwml6.ironchest.common.block.regular.AbstractIronChestBlock;
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.IronChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import com.progwml6.ironchest.common.block.trapped.entity.TrappedIronChestBlockEntity;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class TrappedIronChestBlock extends AbstractTrappedIronChestBlock {
|
||||
|
||||
public TrappedIronChestBlock(Properties properties) {
|
||||
super(properties, IronChestsBlockEntityTypes.TRAPPED_IRON_CHEST::get, IronChestsTypes.IRON);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) {
|
||||
return new TrappedIronChestBlockEntity(blockPos, blockState);
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
package com.progwml6.ironchest.common.block.trapped;
|
||||
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import com.progwml6.ironchest.common.block.trapped.entity.TrappedObsidianChestBlockEntity;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class TrappedObsidianChestBlock extends AbstractTrappedIronChestBlock {
|
||||
|
||||
public TrappedObsidianChestBlock(Properties properties) {
|
||||
super(properties, IronChestsBlockEntityTypes.TRAPPED_OBSIDIAN_CHEST::get, IronChestsTypes.OBSIDIAN);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) {
|
||||
return new TrappedObsidianChestBlockEntity(blockPos, blockState);
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
package com.progwml6.ironchest.common.block.trapped.entity;
|
||||
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.AbstractIronChestBlockEntity;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public abstract class AbstractTrappedIronChestBlockEntity extends AbstractIronChestBlockEntity {
|
||||
|
||||
protected AbstractTrappedIronChestBlockEntity(BlockEntityType<?> blockEntityType, BlockPos blockPos, BlockState blockState, IronChestsTypes chestTypeIn, Supplier<Block> blockToUseIn) {
|
||||
super(blockEntityType, blockPos, blockState, chestTypeIn, blockToUseIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void signalOpenCount(Level level, BlockPos blockPos, BlockState blockState, int previousCount, int newCount) {
|
||||
super.signalOpenCount(level, blockPos, blockState, previousCount, newCount);
|
||||
|
||||
if (previousCount != newCount) {
|
||||
Block block = blockState.getBlock();
|
||||
|
||||
level.updateNeighborsAt(blockPos, block);
|
||||
level.updateNeighborsAt(blockPos.below(), block);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
package com.progwml6.ironchest.common.block.trapped.entity;
|
||||
|
||||
import com.progwml6.ironchest.common.block.IronChestsBlocks;
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import com.progwml6.ironchest.common.inventory.IronChestMenu;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public class TrappedCopperChestBlockEntity extends AbstractTrappedIronChestBlockEntity {
|
||||
|
||||
public TrappedCopperChestBlockEntity(BlockPos blockPos, BlockState blockState) {
|
||||
super(IronChestsBlockEntityTypes.TRAPPED_COPPER_CHEST.get(), blockPos, blockState, IronChestsTypes.COPPER, IronChestsBlocks.TRAPPED_COPPER_CHEST::get);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractContainerMenu createMenu(int containerId, Inventory playerInventory) {
|
||||
return IronChestMenu.createCopperContainer(containerId, playerInventory, this);
|
||||
}
|
||||
}
|
|
@ -1,92 +0,0 @@
|
|||
package com.progwml6.ironchest.common.block.trapped.entity;
|
||||
|
||||
import com.progwml6.ironchest.common.block.IronChestsBlocks;
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.AbstractIronChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.entity.ICrystalChest;
|
||||
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import com.progwml6.ironchest.common.inventory.IronChestMenu;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public class TrappedCrystalChestBlockEntity extends AbstractTrappedIronChestBlockEntity implements ICrystalChest {
|
||||
|
||||
private NonNullList<ItemStack> topStacks;
|
||||
private boolean inventoryTouched;
|
||||
private boolean hadStuff;
|
||||
|
||||
public TrappedCrystalChestBlockEntity(BlockPos blockPos, BlockState blockState) {
|
||||
super(IronChestsBlockEntityTypes.TRAPPED_CRYSTAL_CHEST.get(), blockPos, blockState, IronChestsTypes.CRYSTAL, IronChestsBlocks.TRAPPED_CRYSTAL_CHEST::get);
|
||||
|
||||
this.topStacks = NonNullList.withSize(8, ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractContainerMenu createMenu(int containerId, Inventory playerInventory) {
|
||||
return IronChestMenu.createCrystalContainer(containerId, playerInventory, this);
|
||||
}
|
||||
|
||||
public static void tick(Level level, BlockPos blockPos, BlockState blockState, AbstractIronChestBlockEntity chestBlockEntity) {
|
||||
if (chestBlockEntity instanceof TrappedCrystalChestBlockEntity crystalChest) {
|
||||
if (!level.isClientSide && crystalChest.inventoryTouched) {
|
||||
crystalChest.inventoryTouched = false;
|
||||
|
||||
crystalChest.sortTopStacks();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setItems(NonNullList<ItemStack> contents) {
|
||||
super.setItems(contents);
|
||||
|
||||
this.inventoryTouched = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItem(int index) {
|
||||
this.inventoryTouched = true;
|
||||
|
||||
return super.getItem(index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NonNullList<ItemStack> getTopItems() {
|
||||
return this.topStacks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Level getChestLevel() {
|
||||
return this.level;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockPos getChestWorldPosition() {
|
||||
return this.worldPosition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveMessageFromServer(NonNullList<ItemStack> topStacks) {
|
||||
this.topStacks = topStacks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NonNullList<ItemStack> getCurrentItems() {
|
||||
return this.getItems();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHadStuff(boolean hadStuff) {
|
||||
this.hadStuff = hadStuff;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getHadStuff() {
|
||||
return this.hadStuff;
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
package com.progwml6.ironchest.common.block.trapped.entity;
|
||||
|
||||
import com.progwml6.ironchest.common.block.IronChestsBlocks;
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.AbstractIronChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.inventory.IronChestMenu;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public class TrappedDiamondChestBlockEntity extends AbstractTrappedIronChestBlockEntity {
|
||||
|
||||
public TrappedDiamondChestBlockEntity(BlockPos blockPos, BlockState blockState) {
|
||||
super(IronChestsBlockEntityTypes.TRAPPED_DIAMOND_CHEST.get(), blockPos, blockState, IronChestsTypes.DIAMOND, IronChestsBlocks.TRAPPED_DIAMOND_CHEST::get);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractContainerMenu createMenu(int containerId, Inventory playerInventory) {
|
||||
return IronChestMenu.createDiamondContainer(containerId, playerInventory, this);
|
||||
}
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
package com.progwml6.ironchest.common.block.trapped.entity;
|
||||
|
||||
import com.progwml6.ironchest.common.block.IronChestsBlocks;
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.AbstractIronChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.inventory.IronChestMenu;
|
||||
import net.minecraft.client.resources.language.I18n;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.nbt.StringTag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Objects;
|
||||
|
||||
public class TrappedDirtChestBlockEntity extends AbstractTrappedIronChestBlockEntity {
|
||||
|
||||
private static ItemStack DIRT_CHEST_BOOK = new ItemStack(Items.WRITTEN_BOOK);
|
||||
|
||||
private static boolean bookDataCreated = false;
|
||||
|
||||
public TrappedDirtChestBlockEntity(BlockPos blockPos, BlockState blockState) {
|
||||
super(IronChestsBlockEntityTypes.TRAPPED_DIRT_CHEST.get(), blockPos, blockState, IronChestsTypes.DIRT, IronChestsBlocks.TRAPPED_DIRT_CHEST::get);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractContainerMenu createMenu(int containerId, Inventory playerInventory) {
|
||||
return IronChestMenu.createDirtContainer(containerId, playerInventory, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void wasPlaced(@Nullable LivingEntity livingEntity, ItemStack itemStack) {
|
||||
if (!(itemStack.hasTag() && Objects.requireNonNull(itemStack.getTag()).getBoolean("been_placed"))) {
|
||||
//TODO FIX BOOK
|
||||
//this.setInventorySlotContents(0, DIRT_CHEST_BOOK.copy());
|
||||
}
|
||||
|
||||
if (!bookDataCreated) {
|
||||
//createBookData();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAdornments() {
|
||||
if (!this.getItems().get(0).isEmpty() && this.getItems().get(0).sameItem(DIRT_CHEST_BOOK)) {
|
||||
this.getItems().set(0, ItemStack.EMPTY);
|
||||
}
|
||||
}
|
||||
|
||||
private static void createBookData() {
|
||||
DIRT_CHEST_BOOK.addTagElement("author", StringTag.valueOf("cpw"));
|
||||
|
||||
DIRT_CHEST_BOOK.addTagElement("title", StringTag.valueOf(I18n.get("book.ironchest.dirtchest9000.title")));
|
||||
|
||||
ListTag pages = new ListTag();
|
||||
pages.add(StringTag.valueOf(Component.Serializer.toJson(new TranslatableComponent("book.ironchest.dirtchest9000.page1"))));
|
||||
pages.add(StringTag.valueOf(Component.Serializer.toJson(new TranslatableComponent("book.ironchest.dirtchest9000.page2"))));
|
||||
pages.add(StringTag.valueOf(Component.Serializer.toJson(new TranslatableComponent("book.ironchest.dirtchest9000.page3"))));
|
||||
pages.add(StringTag.valueOf(Component.Serializer.toJson(new TranslatableComponent("book.ironchest.dirtchest9000.page4"))));
|
||||
pages.add(StringTag.valueOf(Component.Serializer.toJson(new TranslatableComponent("book.ironchest.dirtchest9000.page5"))));
|
||||
|
||||
DIRT_CHEST_BOOK.addTagElement("pages", pages);
|
||||
|
||||
bookDataCreated = true;
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
package com.progwml6.ironchest.common.block.trapped.entity;
|
||||
|
||||
import com.progwml6.ironchest.common.block.IronChestsBlocks;
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.AbstractIronChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.inventory.IronChestMenu;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public class TrappedGoldChestBlockEntity extends AbstractTrappedIronChestBlockEntity {
|
||||
|
||||
public TrappedGoldChestBlockEntity(BlockPos blockPos, BlockState blockState) {
|
||||
super(IronChestsBlockEntityTypes.TRAPPED_GOLD_CHEST.get(), blockPos, blockState, IronChestsTypes.GOLD, IronChestsBlocks.TRAPPED_GOLD_CHEST::get);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractContainerMenu createMenu(int containerId, Inventory playerInventory) {
|
||||
return IronChestMenu.createGoldContainer(containerId, playerInventory, this);
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
package com.progwml6.ironchest.common.block.trapped.entity;
|
||||
|
||||
import com.progwml6.ironchest.common.block.IronChestsBlocks;
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import com.progwml6.ironchest.common.inventory.IronChestMenu;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public class TrappedIronChestBlockEntity extends AbstractTrappedIronChestBlockEntity {
|
||||
|
||||
public TrappedIronChestBlockEntity(BlockPos blockPos, BlockState blockState) {
|
||||
super(IronChestsBlockEntityTypes.TRAPPED_IRON_CHEST.get(), blockPos, blockState, IronChestsTypes.IRON, IronChestsBlocks.TRAPPED_IRON_CHEST::get);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractContainerMenu createMenu(int containerId, Inventory playerInventory) {
|
||||
return IronChestMenu.createIronContainer(containerId, playerInventory, this);
|
||||
}
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
package com.progwml6.ironchest.common.block.trapped.entity;
|
||||
|
||||
import com.progwml6.ironchest.common.block.IronChestsBlocks;
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.AbstractIronChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.inventory.IronChestMenu;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public class TrappedObsidianChestBlockEntity extends AbstractTrappedIronChestBlockEntity {
|
||||
|
||||
public TrappedObsidianChestBlockEntity(BlockPos blockPos, BlockState blockState) {
|
||||
super(IronChestsBlockEntityTypes.TRAPPED_OBSIDIAN_CHEST.get(), blockPos, blockState, IronChestsTypes.OBSIDIAN, IronChestsBlocks.TRAPPED_OBSIDIAN_CHEST::get);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractContainerMenu createMenu(int containerId, Inventory playerInventory) {
|
||||
return IronChestMenu.createObsidianContainer(containerId, playerInventory, this);
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package com.progwml6.ironchest.common.block.trapped.entity;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -1,7 +0,0 @@
|
|||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package com.progwml6.ironchest.common.block.trapped;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -1,7 +0,0 @@
|
|||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package com.progwml6.ironchest.common.data;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -1,19 +0,0 @@
|
|||
package com.progwml6.ironchest.common.inventory;
|
||||
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.Container;
|
||||
import net.minecraft.world.inventory.Slot;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
public class DirtChestSlot extends Slot {
|
||||
|
||||
public DirtChestSlot(Container inventoryIn, int slotIndex, int xPosition, int yPosition) {
|
||||
super(inventoryIn, slotIndex, xPosition, yPosition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mayPlace(ItemStack stack) {
|
||||
return stack.isEmpty() || stack.getItem() == Item.byBlock(Blocks.DIRT);
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package com.progwml6.ironchest.common.inventory;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -1,85 +0,0 @@
|
|||
package com.progwml6.ironchest.common.item;
|
||||
|
||||
import com.progwml6.ironchest.client.model.inventory.IronChestItemStackRenderer;
|
||||
import com.progwml6.ironchest.common.block.IronChestsBlocks;
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.CopperChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.CrystalChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.DiamondChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.DirtChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.GoldChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.IronChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.ObsidianChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.trapped.entity.TrappedCopperChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.trapped.entity.TrappedCrystalChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.trapped.entity.TrappedDiamondChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.trapped.entity.TrappedDirtChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.trapped.entity.TrappedGoldChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.trapped.entity.TrappedIronChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.trapped.entity.TrappedObsidianChestBlockEntity;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.IItemRenderProperties;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class IronChestBlockItem extends BlockItem {
|
||||
|
||||
protected Supplier<IronChestsTypes> type;
|
||||
|
||||
protected Supplier<Boolean> trapped;
|
||||
|
||||
public IronChestBlockItem(Block block, Properties properties, Supplier<Callable<IronChestsTypes>> type, Supplier<Callable<Boolean>> trapped) {
|
||||
super(block, properties);
|
||||
|
||||
IronChestsTypes tempType = DistExecutor.callWhenOn(Dist.CLIENT, type);
|
||||
Boolean tempTrapped = DistExecutor.callWhenOn(Dist.CLIENT, trapped);
|
||||
|
||||
this.type = tempType == null ? null : () -> tempType;
|
||||
this.trapped = tempTrapped == null ? null : () -> tempTrapped;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializeClient(Consumer<IItemRenderProperties> consumer) {
|
||||
super.initializeClient(consumer);
|
||||
|
||||
consumer.accept(new IItemRenderProperties() {
|
||||
@Override
|
||||
public BlockEntityWithoutLevelRenderer getItemStackRenderer() {
|
||||
Supplier<BlockEntity> modelToUse;
|
||||
|
||||
if (trapped.get()) {
|
||||
switch (type.get()) {
|
||||
case GOLD -> modelToUse = () -> new TrappedGoldChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.TRAPPED_GOLD_CHEST.get().defaultBlockState());
|
||||
case DIAMOND -> modelToUse = () -> new TrappedDiamondChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.TRAPPED_DIAMOND_CHEST.get().defaultBlockState());
|
||||
case COPPER -> modelToUse = () -> new TrappedCopperChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.TRAPPED_COPPER_CHEST.get().defaultBlockState());
|
||||
case CRYSTAL -> modelToUse = () -> new TrappedCrystalChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.TRAPPED_CRYSTAL_CHEST.get().defaultBlockState());
|
||||
case OBSIDIAN -> modelToUse = () -> new TrappedObsidianChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.TRAPPED_OBSIDIAN_CHEST.get().defaultBlockState());
|
||||
case DIRT -> modelToUse = () -> new TrappedDirtChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.TRAPPED_DIRT_CHEST.get().defaultBlockState());
|
||||
default -> modelToUse = () -> new TrappedIronChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.TRAPPED_IRON_CHEST.get().defaultBlockState());
|
||||
}
|
||||
} else {
|
||||
switch (type.get()) {
|
||||
case GOLD -> modelToUse = () -> new GoldChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.GOLD_CHEST.get().defaultBlockState());
|
||||
case DIAMOND -> modelToUse = () -> new DiamondChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.DIAMOND_CHEST.get().defaultBlockState());
|
||||
case COPPER -> modelToUse = () -> new CopperChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.COPPER_CHEST.get().defaultBlockState());
|
||||
case CRYSTAL -> modelToUse = () -> new CrystalChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.CRYSTAL_CHEST.get().defaultBlockState());
|
||||
case OBSIDIAN -> modelToUse = () -> new ObsidianChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.OBSIDIAN_CHEST.get().defaultBlockState());
|
||||
case DIRT -> modelToUse = () -> new DirtChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.DIRT_CHEST.get().defaultBlockState());
|
||||
default -> modelToUse = () -> new IronChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.IRON_CHEST.get().defaultBlockState());
|
||||
}
|
||||
}
|
||||
|
||||
return new IronChestItemStackRenderer(Minecraft.getInstance().getBlockEntityRenderDispatcher(), Minecraft.getInstance().getEntityModels(), modelToUse);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
package com.progwml6.ironchest.common.item;
|
||||
|
||||
import com.progwml6.ironchest.common.Util;
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
|
||||
import static com.progwml6.ironchest.common.block.IronChestsTypes.COPPER;
|
||||
import static com.progwml6.ironchest.common.block.IronChestsTypes.CRYSTAL;
|
||||
import static com.progwml6.ironchest.common.block.IronChestsTypes.DIAMOND;
|
||||
import static com.progwml6.ironchest.common.block.IronChestsTypes.GOLD;
|
||||
import static com.progwml6.ironchest.common.block.IronChestsTypes.IRON;
|
||||
import static com.progwml6.ironchest.common.block.IronChestsTypes.OBSIDIAN;
|
||||
import static com.progwml6.ironchest.common.block.IronChestsTypes.WOOD;
|
||||
|
||||
public enum IronChestsUpgradeType {
|
||||
|
||||
IRON_TO_GOLD(IRON, GOLD),
|
||||
GOLD_TO_DIAMOND(GOLD, DIAMOND),
|
||||
COPPER_TO_IRON(COPPER, IRON),
|
||||
DIAMOND_TO_CRYSTAL(DIAMOND, CRYSTAL),
|
||||
WOOD_TO_IRON(WOOD, IRON),
|
||||
WOOD_TO_COPPER(WOOD, COPPER),
|
||||
DIAMOND_TO_OBSIDIAN(DIAMOND, OBSIDIAN);
|
||||
|
||||
public final String name;
|
||||
public final IronChestsTypes source;
|
||||
public final IronChestsTypes target;
|
||||
|
||||
IronChestsUpgradeType(IronChestsTypes source, IronChestsTypes target) {
|
||||
this.name = Util.toEnglishName(this.name());
|
||||
this.source = source;
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
public boolean canUpgrade(IronChestsTypes from) {
|
||||
return from == this.source;
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package com.progwml6.ironchest.common.item;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -1,7 +0,0 @@
|
|||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package com.progwml6.ironchest.common.network.helper;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -1,7 +0,0 @@
|
|||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package com.progwml6.ironchest.common.network;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -1,13 +1,13 @@
|
|||
package com.progwml6.ironchest;
|
||||
package dev.ubujira.ironbarrels;
|
||||
|
||||
import com.progwml6.ironchest.client.screen.IronChestScreen;
|
||||
import com.progwml6.ironchest.client.render.IronChestRenderer;
|
||||
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import com.progwml6.ironchest.common.block.IronChestsBlocks;
|
||||
import com.progwml6.ironchest.common.data.IronChestsRecipeProvider;
|
||||
import com.progwml6.ironchest.common.inventory.IronChestsContainerTypes;
|
||||
import com.progwml6.ironchest.common.item.IronChestsItems;
|
||||
import com.progwml6.ironchest.common.network.IronChestNetwork;
|
||||
import dev.ubujira.ironbarrels.client.render.IronChestRenderer;
|
||||
import dev.ubujira.ironbarrels.client.screen.IronChestScreen;
|
||||
import dev.ubujira.ironbarrels.common.block.IronChestsBlocks;
|
||||
import dev.ubujira.ironbarrels.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import dev.ubujira.ironbarrels.common.data.IronChestsRecipeProvider;
|
||||
import dev.ubujira.ironbarrels.common.inventory.IronChestsContainerTypes;
|
||||
import dev.ubujira.ironbarrels.common.item.IronChestsItems;
|
||||
import dev.ubujira.ironbarrels.common.network.IronChestNetwork;
|
||||
import net.minecraft.client.gui.screens.MenuScreens;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
|
@ -26,9 +26,9 @@ import net.minecraftforge.forge.event.lifecycle.GatherDataEvent;
|
|||
@Mod(IronChests.MOD_ID)
|
||||
public class IronChests {
|
||||
|
||||
public static final String MOD_ID = "ironchest";
|
||||
public static final String MOD_ID = "ironbarrels";
|
||||
|
||||
public static final CreativeModeTab IRONCHESTS_ITEM_GROUP = (new CreativeModeTab("ironchest") {
|
||||
public static final CreativeModeTab IRONCHESTS_ITEM_GROUP = (new CreativeModeTab("ironbarrels") {
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public ItemStack makeIcon() {
|
||||
|
@ -65,7 +65,6 @@ public class IronChests {
|
|||
MenuScreens.register(IronChestsContainerTypes.CRYSTAL_CHEST.get(), IronChestScreen::new);
|
||||
MenuScreens.register(IronChestsContainerTypes.COPPER_CHEST.get(), IronChestScreen::new);
|
||||
MenuScreens.register(IronChestsContainerTypes.OBSIDIAN_CHEST.get(), IronChestScreen::new);
|
||||
MenuScreens.register(IronChestsContainerTypes.DIRT_CHEST.get(), IronChestScreen::new);
|
||||
|
||||
BlockEntityRenderers.register(IronChestsBlockEntityTypes.IRON_CHEST.get(), IronChestRenderer::new);
|
||||
BlockEntityRenderers.register(IronChestsBlockEntityTypes.GOLD_CHEST.get(), IronChestRenderer::new);
|
||||
|
@ -73,15 +72,6 @@ public class IronChests {
|
|||
BlockEntityRenderers.register(IronChestsBlockEntityTypes.COPPER_CHEST.get(), IronChestRenderer::new);
|
||||
BlockEntityRenderers.register(IronChestsBlockEntityTypes.CRYSTAL_CHEST.get(), IronChestRenderer::new);
|
||||
BlockEntityRenderers.register(IronChestsBlockEntityTypes.OBSIDIAN_CHEST.get(), IronChestRenderer::new);
|
||||
BlockEntityRenderers.register(IronChestsBlockEntityTypes.DIRT_CHEST.get(), IronChestRenderer::new);
|
||||
|
||||
BlockEntityRenderers.register(IronChestsBlockEntityTypes.TRAPPED_IRON_CHEST.get(), IronChestRenderer::new);
|
||||
BlockEntityRenderers.register(IronChestsBlockEntityTypes.TRAPPED_GOLD_CHEST.get(), IronChestRenderer::new);
|
||||
BlockEntityRenderers.register(IronChestsBlockEntityTypes.TRAPPED_DIAMOND_CHEST.get(), IronChestRenderer::new);
|
||||
BlockEntityRenderers.register(IronChestsBlockEntityTypes.TRAPPED_COPPER_CHEST.get(), IronChestRenderer::new);
|
||||
BlockEntityRenderers.register(IronChestsBlockEntityTypes.TRAPPED_CRYSTAL_CHEST.get(), IronChestRenderer::new);
|
||||
BlockEntityRenderers.register(IronChestsBlockEntityTypes.TRAPPED_OBSIDIAN_CHEST.get(), IronChestRenderer::new);
|
||||
BlockEntityRenderers.register(IronChestsBlockEntityTypes.TRAPPED_DIRT_CHEST.get(), IronChestRenderer::new);
|
||||
}
|
||||
|
||||
private void setup(final FMLCommonSetupEvent event) {
|
|
@ -1,6 +1,6 @@
|
|||
package com.progwml6.ironchest;
|
||||
package dev.ubujira.ironbarrels;
|
||||
|
||||
import com.progwml6.ironchest.client.render.IronChestRenderer;
|
||||
import dev.ubujira.ironbarrels.client.render.IronChestRenderer;
|
||||
import net.minecraft.client.model.geom.ModelLayerLocation;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
|
@ -0,0 +1,48 @@
|
|||
package dev.ubujira.ironbarrels.client.model;
|
||||
|
||||
import dev.ubujira.ironbarrels.IronChests;
|
||||
import dev.ubujira.ironbarrels.common.block.IronChestsTypes;
|
||||
import net.minecraft.client.renderer.Sheets;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = IronChests.MOD_ID, value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
public class IronChestsModels {
|
||||
|
||||
public static final ResourceLocation IRON_CHEST_LOCATION = new ResourceLocation(IronChests.MOD_ID, "model/iron_chest");
|
||||
public static final ResourceLocation GOLD_CHEST_LOCATION = new ResourceLocation(IronChests.MOD_ID, "model/gold_chest");
|
||||
public static final ResourceLocation DIAMOND_CHEST_LOCATION = new ResourceLocation(IronChests.MOD_ID, "model/diamond_chest");
|
||||
public static final ResourceLocation COPPER_CHEST_LOCATION = new ResourceLocation(IronChests.MOD_ID, "model/copper_chest");
|
||||
public static final ResourceLocation CRYSTAL_CHEST_LOCATION = new ResourceLocation(IronChests.MOD_ID, "model/crystal_chest");
|
||||
public static final ResourceLocation OBSIDIAN_CHEST_LOCATION = new ResourceLocation(IronChests.MOD_ID, "model/obsidian_chest");
|
||||
public static final ResourceLocation VANILLA_CHEST_LOCATION = new ResourceLocation("entity/chest/normal");
|
||||
|
||||
public static ResourceLocation chooseChestTexture(IronChestsTypes type) {
|
||||
return switch (type) {
|
||||
case IRON -> IRON_CHEST_LOCATION;
|
||||
case GOLD -> GOLD_CHEST_LOCATION;
|
||||
case DIAMOND -> DIAMOND_CHEST_LOCATION;
|
||||
case COPPER -> COPPER_CHEST_LOCATION;
|
||||
case CRYSTAL -> CRYSTAL_CHEST_LOCATION;
|
||||
case OBSIDIAN -> OBSIDIAN_CHEST_LOCATION;
|
||||
default -> VANILLA_CHEST_LOCATION;
|
||||
};
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onStitch(TextureStitchEvent.Pre event) {
|
||||
if (!event.getAtlas().location().equals(Sheets.CHEST_SHEET)) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.addSprite(IRON_CHEST_LOCATION);
|
||||
event.addSprite(GOLD_CHEST_LOCATION);
|
||||
event.addSprite(DIAMOND_CHEST_LOCATION);
|
||||
event.addSprite(COPPER_CHEST_LOCATION);
|
||||
event.addSprite(CRYSTAL_CHEST_LOCATION);
|
||||
event.addSprite(OBSIDIAN_CHEST_LOCATION);
|
||||
}
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
package com.progwml6.ironchest.client.model.inventory;
|
||||
package dev.ubujira.ironbarrels.client.model.inventory;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.model.geom.EntityModelSet;
|
||||
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.block.model.ItemTransforms;
|
||||
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
|
@ -1,4 +1,4 @@
|
|||
package com.progwml6.ironchest.client.model.inventory;
|
||||
package dev.ubujira.ironbarrels.client.model.inventory;
|
||||
|
||||
import com.mojang.math.Vector3f;
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package dev.ubujira.ironbarrels.client.model.inventory;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -1,6 +1,6 @@
|
|||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package com.progwml6.ironchest.client.screen;
|
||||
package dev.ubujira.ironbarrels.client.model;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package com.progwml6.ironchest.common;
|
||||
package dev.ubujira.ironbarrels.client;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
|
|
@ -1,44 +1,41 @@
|
|||
package com.progwml6.ironchest.client.render;
|
||||
package dev.ubujira.ironbarrels.client.render;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.progwml6.ironchest.IronChestsClientEvents;
|
||||
import com.progwml6.ironchest.client.model.IronChestsModels;
|
||||
import com.progwml6.ironchest.client.model.inventory.ModelItem;
|
||||
import com.progwml6.ironchest.common.block.regular.AbstractIronChestBlock;
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.AbstractIronChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.entity.ICrystalChest;
|
||||
import com.progwml6.ironchest.common.block.trapped.entity.AbstractTrappedIronChestBlockEntity;
|
||||
import it.unimi.dsi.fastutil.floats.Float2FloatFunction;
|
||||
import it.unimi.dsi.fastutil.ints.Int2IntFunction;
|
||||
import com.mojang.math.Vector3f;
|
||||
import dev.ubujira.ironbarrels.IronChestsClientEvents;
|
||||
import dev.ubujira.ironbarrels.client.model.IronChestsModels;
|
||||
import dev.ubujira.ironbarrels.client.model.inventory.ModelItem;
|
||||
import dev.ubujira.ironbarrels.common.block.IronChestsTypes;
|
||||
import dev.ubujira.ironbarrels.common.block.entity.ICrystalChest;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.AbstractIronChestBlock;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.entity.AbstractIronChestBlockEntity;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.model.geom.ModelPart;
|
||||
import net.minecraft.client.model.geom.PartPose;
|
||||
import net.minecraft.client.model.geom.builders.CubeListBuilder;
|
||||
import net.minecraft.client.model.geom.builders.LayerDefinition;
|
||||
import net.minecraft.client.model.geom.builders.MeshDefinition;
|
||||
import net.minecraft.client.model.geom.builders.PartDefinition;
|
||||
import net.minecraft.client.renderer.block.model.ItemTransforms;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.Sheets;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.model.geom.ModelPart;
|
||||
import net.minecraft.client.resources.model.Material;
|
||||
import net.minecraft.client.renderer.blockentity.BrightnessCombiner;
|
||||
import net.minecraft.client.renderer.Sheets;
|
||||
import net.minecraft.client.renderer.block.model.ItemTransforms;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.entity.LidBlockEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.DoubleBlockCombiner;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
import net.minecraft.client.renderer.blockentity.BrightnessCombiner;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.client.resources.model.Material;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import com.mojang.math.Vector3f;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.DoubleBlockCombiner;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.entity.LidBlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
@ -93,7 +90,7 @@ public class IronChestRenderer<T extends BlockEntity & LidBlockEntity> implement
|
|||
Level level = tileEntity.getLevel();
|
||||
boolean useTileEntityBlockState = level != null;
|
||||
|
||||
BlockState blockState = useTileEntityBlockState ? tileEntity.getBlockState() : (BlockState) tileEntity.getBlockToUse().defaultBlockState().setValue(AbstractIronChestBlock.FACING, Direction.SOUTH);
|
||||
BlockState blockState = useTileEntityBlockState ? tileEntity.getBlockState() : tileEntity.getBlockToUse().defaultBlockState().setValue(AbstractIronChestBlock.FACING, Direction.SOUTH);
|
||||
Block block = blockState.getBlock();
|
||||
IronChestsTypes chestType = IronChestsTypes.IRON;
|
||||
IronChestsTypes actualType = AbstractIronChestBlock.getTypeFromBlock(block);
|
||||
|
@ -119,15 +116,13 @@ public class IronChestRenderer<T extends BlockEntity & LidBlockEntity> implement
|
|||
neighborCombineResult = DoubleBlockCombiner.Combiner::acceptNone;
|
||||
}
|
||||
|
||||
float openness = neighborCombineResult.<Float2FloatFunction>apply(AbstractIronChestBlock.opennessCombiner(tileEntity)).get(partialTicks);
|
||||
float openness = neighborCombineResult.apply(AbstractIronChestBlock.opennessCombiner(tileEntity)).get(partialTicks);
|
||||
openness = 1.0F - openness;
|
||||
openness = 1.0F - openness * openness * openness;
|
||||
|
||||
int brightness = neighborCombineResult.<Int2IntFunction>apply(new BrightnessCombiner<>()).applyAsInt(combinedLightIn);
|
||||
int brightness = neighborCombineResult.apply(new BrightnessCombiner<>()).applyAsInt(combinedLightIn);
|
||||
|
||||
boolean trapped = tileEntityIn instanceof AbstractTrappedIronChestBlockEntity;
|
||||
|
||||
Material material = new Material(Sheets.CHEST_SHEET, IronChestsModels.chooseChestTexture(chestType, trapped));
|
||||
Material material = new Material(Sheets.CHEST_SHEET, IronChestsModels.chooseChestTexture(chestType));
|
||||
|
||||
VertexConsumer vertexConsumer = material.buffer(bufferSource, RenderType::entityCutout);
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package dev.ubujira.ironbarrels.client.render;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -1,14 +1,14 @@
|
|||
package com.progwml6.ironchest.client.screen;
|
||||
package dev.ubujira.ironbarrels.client.screen;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.inventory.IronChestMenu;
|
||||
import net.minecraft.client.gui.screens.inventory.MenuAccess;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import dev.ubujira.ironbarrels.common.block.IronChestsTypes;
|
||||
import dev.ubujira.ironbarrels.common.inventory.IronChestMenu;
|
||||
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
|
||||
import net.minecraft.client.gui.screens.inventory.MenuAccess;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package dev.ubujira.ironbarrels.client.screen;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -1,4 +1,4 @@
|
|||
package com.progwml6.ironchest.common;
|
||||
package dev.ubujira.ironbarrels.common;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
package dev.ubujira.ironbarrels.common.block;
|
||||
|
||||
import dev.ubujira.ironbarrels.IronChests;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.CopperChestBlock;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.CrystalChestBlock;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.DiamondChestBlock;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.GoldChestBlock;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.IronChestBlock;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.ObsidianChestBlock;
|
||||
import dev.ubujira.ironbarrels.common.item.IronChestBlockItem;
|
||||
import dev.ubujira.ironbarrels.common.item.IronChestsItems;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.material.Material;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class IronChestsBlocks {
|
||||
|
||||
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, IronChests.MOD_ID);
|
||||
public static final DeferredRegister<Item> ITEMS = IronChestsItems.ITEMS;
|
||||
|
||||
public static final RegistryObject<IronChestBlock> IRON_CHEST = register(
|
||||
"iron_chest", () -> new IronChestBlock(Block.Properties.of(Material.METAL).strength(3.0F)),
|
||||
IronChestsTypes.IRON);
|
||||
|
||||
public static final RegistryObject<GoldChestBlock> GOLD_CHEST = register(
|
||||
"gold_chest", () -> new GoldChestBlock(Block.Properties.of(Material.METAL).strength(3.0F)),
|
||||
IronChestsTypes.GOLD);
|
||||
|
||||
public static final RegistryObject<DiamondChestBlock> DIAMOND_CHEST = register(
|
||||
"diamond_chest", () -> new DiamondChestBlock(Block.Properties.of(Material.METAL).strength(3.0F)),
|
||||
IronChestsTypes.DIAMOND);
|
||||
|
||||
public static final RegistryObject<CopperChestBlock> COPPER_CHEST = register(
|
||||
"copper_chest", () -> new CopperChestBlock(Block.Properties.of(Material.METAL).strength(3.0F)),
|
||||
IronChestsTypes.COPPER);
|
||||
|
||||
public static final RegistryObject<CrystalChestBlock> CRYSTAL_CHEST = register(
|
||||
"crystal_chest", () -> new CrystalChestBlock(Block.Properties.of(Material.METAL).strength(3.0F)),
|
||||
IronChestsTypes.CRYSTAL);
|
||||
|
||||
public static final RegistryObject<ObsidianChestBlock> OBSIDIAN_CHEST = register(
|
||||
"obsidian_chest", () -> new ObsidianChestBlock(Block.Properties.of(Material.METAL).strength(3.0F)),
|
||||
IronChestsTypes.OBSIDIAN);
|
||||
|
||||
//HELPERS
|
||||
|
||||
private static <T extends Block> RegistryObject<T> register(String name, Supplier<? extends T> sup, IronChestsTypes chestType) {
|
||||
return register(name, sup, block -> item(block, () -> () -> chestType));
|
||||
}
|
||||
|
||||
private static <T extends Block> RegistryObject<T> register(String name, Supplier<? extends T> sup, Function<RegistryObject<T>, Supplier<? extends Item>> itemCreator) {
|
||||
RegistryObject<T> ret = registerNoItem(name, sup);
|
||||
ITEMS.register(name, itemCreator.apply(ret));
|
||||
return ret;
|
||||
}
|
||||
|
||||
private static <T extends Block> RegistryObject<T> registerNoItem(String name, Supplier<? extends T> sup) {
|
||||
return BLOCKS.register(name, sup);
|
||||
}
|
||||
|
||||
private static Supplier<BlockItem> item(final RegistryObject<? extends Block> block, Supplier<Callable<IronChestsTypes>> chestType) {
|
||||
return () -> new IronChestBlockItem(block.get(), new Item.Properties().tab(IronChests.IRONCHESTS_ITEM_GROUP), chestType);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
package dev.ubujira.ironbarrels.common.block;
|
||||
|
||||
import dev.ubujira.ironbarrels.IronChests;
|
||||
import dev.ubujira.ironbarrels.common.Util;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.entity.AbstractIronChestBlockEntity;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.entity.CopperChestBlockEntity;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.entity.CrystalChestBlockEntity;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.entity.DiamondChestBlockEntity;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.entity.GoldChestBlockEntity;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.entity.IronChestBlockEntity;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.entity.ObsidianChestBlockEntity;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.StringRepresentable;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public enum IronChestsTypes implements StringRepresentable {
|
||||
|
||||
IRON(54, 9, 184, 222, new ResourceLocation(IronChests.MOD_ID, "textures/gui/iron_container.png"), 256, 256),
|
||||
GOLD(81, 9, 184, 276, new ResourceLocation(IronChests.MOD_ID, "textures/gui/gold_container.png"), 256, 276),
|
||||
DIAMOND(108, 12, 238, 276, new ResourceLocation(IronChests.MOD_ID, "textures/gui/diamond_container.png"), 256, 276),
|
||||
COPPER(45, 9, 184, 204, new ResourceLocation(IronChests.MOD_ID, "textures/gui/copper_container.png"), 256, 256),
|
||||
CRYSTAL(108, 12, 238, 276, new ResourceLocation(IronChests.MOD_ID, "textures/gui/diamond_container.png"), 256, 276),
|
||||
OBSIDIAN(108, 12, 238, 276, new ResourceLocation(IronChests.MOD_ID, "textures/gui/diamond_container.png"), 256, 276),
|
||||
WOOD(0, 0, 0, 0, null, 0, 0);
|
||||
|
||||
private final String name;
|
||||
public final int size;
|
||||
public final int rowLength;
|
||||
public final int xSize;
|
||||
public final int ySize;
|
||||
public final ResourceLocation guiTexture;
|
||||
public final int textureXSize;
|
||||
public final int textureYSize;
|
||||
|
||||
IronChestsTypes(int size, int rowLength, int xSize, int ySize, ResourceLocation guiTexture, int textureXSize, int textureYSize) {
|
||||
this(null, size, rowLength, xSize, ySize, guiTexture, textureXSize, textureYSize);
|
||||
}
|
||||
|
||||
IronChestsTypes(@Nullable String name, int size, int rowLength, int xSize, int ySize, ResourceLocation guiTexture, int textureXSize, int textureYSize) {
|
||||
this.name = name == null ? Util.toEnglishName(this.name()) : name;
|
||||
this.size = size;
|
||||
this.rowLength = rowLength;
|
||||
this.xSize = xSize;
|
||||
this.ySize = ySize;
|
||||
this.guiTexture = guiTexture;
|
||||
this.textureXSize = textureXSize;
|
||||
this.textureYSize = textureYSize;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return this.name().toLowerCase(Locale.ROOT);
|
||||
}
|
||||
|
||||
public String getEnglishName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSerializedName() {
|
||||
return this.getEnglishName();
|
||||
}
|
||||
|
||||
public int getRowCount() {
|
||||
return this.size / this.rowLength;
|
||||
}
|
||||
|
||||
public boolean isTransparent() {
|
||||
return this == CRYSTAL;
|
||||
}
|
||||
|
||||
public static List<Block> get(IronChestsTypes type) {
|
||||
return switch (type) {
|
||||
case IRON -> List.of(IronChestsBlocks.IRON_CHEST.get());
|
||||
case GOLD -> List.of(IronChestsBlocks.GOLD_CHEST.get());
|
||||
case DIAMOND -> List.of(IronChestsBlocks.DIAMOND_CHEST.get());
|
||||
case COPPER -> List.of(IronChestsBlocks.COPPER_CHEST.get());
|
||||
case CRYSTAL -> List.of(IronChestsBlocks.CRYSTAL_CHEST.get());
|
||||
case OBSIDIAN -> List.of(IronChestsBlocks.OBSIDIAN_CHEST.get());
|
||||
default -> List.of(Blocks.CHEST);
|
||||
};
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public AbstractIronChestBlockEntity makeEntity(BlockPos blockPos, BlockState blockState) {
|
||||
return switch (this) {
|
||||
case IRON -> new IronChestBlockEntity(blockPos, blockState);
|
||||
case GOLD -> new GoldChestBlockEntity(blockPos, blockState);
|
||||
case DIAMOND -> new DiamondChestBlockEntity(blockPos, blockState);
|
||||
case COPPER -> new CopperChestBlockEntity(blockPos, blockState);
|
||||
case CRYSTAL -> new CrystalChestBlockEntity(blockPos, blockState);
|
||||
case OBSIDIAN -> new ObsidianChestBlockEntity(blockPos, blockState);
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
package com.progwml6.ironchest.common.block.entity;
|
||||
package dev.ubujira.ironbarrels.common.block.entity;
|
||||
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.network.InventoryTopStacksSyncPacket;
|
||||
import com.progwml6.ironchest.common.network.IronChestNetwork;
|
||||
import dev.ubujira.ironbarrels.common.block.IronChestsTypes;
|
||||
import dev.ubujira.ironbarrels.common.network.InventoryTopStacksSyncPacket;
|
||||
import dev.ubujira.ironbarrels.common.network.IronChestNetwork;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.server.level.ServerLevel;
|
|
@ -0,0 +1,38 @@
|
|||
package dev.ubujira.ironbarrels.common.block.entity;
|
||||
|
||||
import dev.ubujira.ironbarrels.IronChests;
|
||||
import dev.ubujira.ironbarrels.common.block.IronChestsBlocks;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.entity.CopperChestBlockEntity;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.entity.CrystalChestBlockEntity;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.entity.DiamondChestBlockEntity;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.entity.GoldChestBlockEntity;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.entity.IronChestBlockEntity;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.entity.ObsidianChestBlockEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
|
||||
public class IronChestsBlockEntityTypes {
|
||||
|
||||
public static final DeferredRegister<BlockEntityType<?>> BLOCK_ENTITIES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITIES, IronChests.MOD_ID);
|
||||
|
||||
public static final RegistryObject<BlockEntityType<IronChestBlockEntity>> IRON_CHEST = BLOCK_ENTITIES.register(
|
||||
"iron_chest", () -> BlockEntityType.Builder.of(IronChestBlockEntity::new, IronChestsBlocks.IRON_CHEST.get()).build(null));
|
||||
|
||||
public static final RegistryObject<BlockEntityType<GoldChestBlockEntity>> GOLD_CHEST = BLOCK_ENTITIES.register(
|
||||
"gold_chest", () -> BlockEntityType.Builder.of(GoldChestBlockEntity::new, IronChestsBlocks.GOLD_CHEST.get()).build(null));
|
||||
|
||||
public static final RegistryObject<BlockEntityType<DiamondChestBlockEntity>> DIAMOND_CHEST = BLOCK_ENTITIES.register(
|
||||
"diamond_chest", () -> BlockEntityType.Builder.of(DiamondChestBlockEntity::new, IronChestsBlocks.DIAMOND_CHEST.get()).build(null));
|
||||
|
||||
public static final RegistryObject<BlockEntityType<CopperChestBlockEntity>> COPPER_CHEST = BLOCK_ENTITIES.register(
|
||||
"copper_chest", () -> BlockEntityType.Builder.of(CopperChestBlockEntity::new, IronChestsBlocks.COPPER_CHEST.get()).build(null));
|
||||
|
||||
public static final RegistryObject<BlockEntityType<CrystalChestBlockEntity>> CRYSTAL_CHEST = BLOCK_ENTITIES.register(
|
||||
"crystal_chest", () -> BlockEntityType.Builder.of(CrystalChestBlockEntity::new, IronChestsBlocks.CRYSTAL_CHEST.get()).build(null));
|
||||
|
||||
public static final RegistryObject<BlockEntityType<ObsidianChestBlockEntity>> OBSIDIAN_CHEST = BLOCK_ENTITIES.register(
|
||||
"obsidian_chest", () -> BlockEntityType.Builder.of(ObsidianChestBlockEntity::new, IronChestsBlocks.OBSIDIAN_CHEST.get()).build(null));
|
||||
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package dev.ubujira.ironbarrels.common.block.entity;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -1,6 +1,6 @@
|
|||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package com.progwml6.ironchest.client.render;
|
||||
package dev.ubujira.ironbarrels.common.block;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package com.progwml6.ironchest.common.block.regular;
|
||||
package dev.ubujira.ironbarrels.common.block.regular;
|
||||
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.AbstractIronChestBlockEntity;
|
||||
import dev.ubujira.ironbarrels.common.block.IronChestsTypes;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.entity.AbstractIronChestBlockEntity;
|
||||
import it.unimi.dsi.fastutil.floats.Float2FloatFunction;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
|
@ -210,16 +210,14 @@ public abstract class AbstractIronChestBlock extends BaseEntityBlock implements
|
|||
|
||||
@Nullable
|
||||
public static Container getContainer(AbstractIronChestBlock chestBlock, BlockState blockState, Level level, BlockPos blockPos, boolean ignoreBlockedChest) {
|
||||
return chestBlock.combine(blockState, level, blockPos, ignoreBlockedChest).<Optional<Container>>apply(CHEST_COMBINER).orElse((Container) null);
|
||||
return chestBlock.combine(blockState, level, blockPos, ignoreBlockedChest).apply(CHEST_COMBINER).orElse(null);
|
||||
}
|
||||
|
||||
public DoubleBlockCombiner.NeighborCombineResult<? extends AbstractIronChestBlockEntity> combine(BlockState blockState, Level level, BlockPos blockPos, boolean ignoreBlockedChest) {
|
||||
BiPredicate<LevelAccessor, BlockPos> biPredicate;
|
||||
|
||||
if (ignoreBlockedChest) {
|
||||
biPredicate = (levelAccessor, blockPos1) -> {
|
||||
return false;
|
||||
};
|
||||
biPredicate = (levelAccessor, blockPos1) -> false;
|
||||
} else {
|
||||
biPredicate = AbstractIronChestBlock::isChestBlockedAt;
|
||||
}
|
||||
|
@ -229,7 +227,7 @@ public abstract class AbstractIronChestBlock extends BaseEntityBlock implements
|
|||
|
||||
@Nullable
|
||||
public MenuProvider getMenuProvider(BlockState blockState, Level level, BlockPos blockPos) {
|
||||
return this.combine(blockState, level, blockPos, false).<Optional<MenuProvider>>apply(MENU_PROVIDER_COMBINER).orElse((MenuProvider) null);
|
||||
return this.combine(blockState, level, blockPos, false).apply(MENU_PROVIDER_COMBINER).orElse(null);
|
||||
}
|
||||
|
||||
public static DoubleBlockCombiner.Combiner<AbstractIronChestBlockEntity, Float2FloatFunction> opennessCombiner(final LidBlockEntity lidBlockEntity) {
|
||||
|
@ -265,7 +263,7 @@ public abstract class AbstractIronChestBlock extends BaseEntityBlock implements
|
|||
}
|
||||
|
||||
private static boolean isCatSittingOnChest(LevelAccessor levelAccessor, BlockPos blockPos) {
|
||||
List<Cat> list = levelAccessor.getEntitiesOfClass(Cat.class, new AABB((double) blockPos.getX(), (double) (blockPos.getY() + 1), (double) blockPos.getZ(), (double) (blockPos.getX() + 1), (double) (blockPos.getY() + 2), (double) (blockPos.getZ() + 1)));
|
||||
List<Cat> list = levelAccessor.getEntitiesOfClass(Cat.class, new AABB(blockPos.getX(), blockPos.getY() + 1, blockPos.getZ(), blockPos.getX() + 1, blockPos.getY() + 2, blockPos.getZ() + 1));
|
||||
|
||||
if (!list.isEmpty()) {
|
||||
for (Cat cat : list) {
|
|
@ -1,8 +1,8 @@
|
|||
package com.progwml6.ironchest.common.block.regular;
|
||||
package dev.ubujira.ironbarrels.common.block.regular;
|
||||
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.CopperChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import dev.ubujira.ironbarrels.common.block.IronChestsTypes;
|
||||
import dev.ubujira.ironbarrels.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.entity.CopperChestBlockEntity;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
|
@ -1,9 +1,9 @@
|
|||
package com.progwml6.ironchest.common.block.regular;
|
||||
package dev.ubujira.ironbarrels.common.block.regular;
|
||||
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.AbstractIronChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.CrystalChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import dev.ubujira.ironbarrels.common.block.IronChestsTypes;
|
||||
import dev.ubujira.ironbarrels.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.entity.AbstractIronChestBlockEntity;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.entity.CrystalChestBlockEntity;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
|
@ -1,8 +1,8 @@
|
|||
package com.progwml6.ironchest.common.block.regular;
|
||||
package dev.ubujira.ironbarrels.common.block.regular;
|
||||
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.DiamondChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import dev.ubujira.ironbarrels.common.block.IronChestsTypes;
|
||||
import dev.ubujira.ironbarrels.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.entity.DiamondChestBlockEntity;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
|
@ -1,8 +1,8 @@
|
|||
package com.progwml6.ironchest.common.block.regular;
|
||||
package dev.ubujira.ironbarrels.common.block.regular;
|
||||
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.GoldChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import dev.ubujira.ironbarrels.common.block.IronChestsTypes;
|
||||
import dev.ubujira.ironbarrels.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.entity.GoldChestBlockEntity;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
|
@ -1,8 +1,8 @@
|
|||
package com.progwml6.ironchest.common.block.regular;
|
||||
package dev.ubujira.ironbarrels.common.block.regular;
|
||||
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.IronChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import dev.ubujira.ironbarrels.common.block.IronChestsTypes;
|
||||
import dev.ubujira.ironbarrels.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.entity.IronChestBlockEntity;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
|
@ -1,8 +1,8 @@
|
|||
package com.progwml6.ironchest.common.block.regular;
|
||||
package dev.ubujira.ironbarrels.common.block.regular;
|
||||
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.ObsidianChestBlockEntity;
|
||||
import dev.ubujira.ironbarrels.common.block.IronChestsTypes;
|
||||
import dev.ubujira.ironbarrels.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.entity.ObsidianChestBlockEntity;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockBehaviour;
|
|
@ -1,9 +1,9 @@
|
|||
package com.progwml6.ironchest.common.block.regular.entity;
|
||||
package dev.ubujira.ironbarrels.common.block.regular.entity;
|
||||
|
||||
import com.progwml6.ironchest.IronChests;
|
||||
import com.progwml6.ironchest.common.block.regular.AbstractIronChestBlock;
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.inventory.IronChestMenu;
|
||||
import dev.ubujira.ironbarrels.IronChests;
|
||||
import dev.ubujira.ironbarrels.common.block.IronChestsTypes;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.AbstractIronChestBlock;
|
||||
import dev.ubujira.ironbarrels.common.inventory.IronChestMenu;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
@ -68,7 +68,7 @@ public abstract class AbstractIronChestBlockEntity extends RandomizableContainer
|
|||
protected AbstractIronChestBlockEntity(BlockEntityType<?> blockEntityType, BlockPos blockPos, BlockState blockState, IronChestsTypes chestTypeIn, Supplier<Block> blockToUseIn) {
|
||||
super(blockEntityType, blockPos, blockState);
|
||||
|
||||
this.items = NonNullList.<ItemStack>withSize(chestTypeIn.size, ItemStack.EMPTY);
|
||||
this.items = NonNullList.withSize(chestTypeIn.size, ItemStack.EMPTY);
|
||||
this.chestType = chestTypeIn;
|
||||
this.blockToUse = blockToUseIn;
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ public abstract class AbstractIronChestBlockEntity extends RandomizableContainer
|
|||
double d1 = (double) blockPos.getY() + 0.5D;
|
||||
double d2 = (double) blockPos.getZ() + 0.5D;
|
||||
|
||||
level.playSound((Player) null, d0, d1, d2, soundEvent, SoundSource.BLOCKS, 0.5F, level.random.nextFloat() * 0.1F + 0.9F);
|
||||
level.playSound(null, d0, d1, d2, soundEvent, SoundSource.BLOCKS, 0.5F, level.random.nextFloat() * 0.1F + 0.9F);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -146,7 +146,7 @@ public abstract class AbstractIronChestBlockEntity extends RandomizableContainer
|
|||
|
||||
@Override
|
||||
public void setItems(NonNullList<ItemStack> itemsIn) {
|
||||
this.items = NonNullList.<ItemStack>withSize(this.getChestType().size, ItemStack.EMPTY);
|
||||
this.items = NonNullList.withSize(this.getChestType().size, ItemStack.EMPTY);
|
||||
|
||||
for (int i = 0; i < itemsIn.size(); i++) {
|
||||
if (i < this.items.size()) {
|
|
@ -1,9 +1,9 @@
|
|||
package com.progwml6.ironchest.common.block.regular.entity;
|
||||
package dev.ubujira.ironbarrels.common.block.regular.entity;
|
||||
|
||||
import com.progwml6.ironchest.common.block.IronChestsBlocks;
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import com.progwml6.ironchest.common.inventory.IronChestMenu;
|
||||
import dev.ubujira.ironbarrels.common.block.IronChestsBlocks;
|
||||
import dev.ubujira.ironbarrels.common.block.IronChestsTypes;
|
||||
import dev.ubujira.ironbarrels.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import dev.ubujira.ironbarrels.common.inventory.IronChestMenu;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
|
@ -1,10 +1,10 @@
|
|||
package com.progwml6.ironchest.common.block.regular.entity;
|
||||
package dev.ubujira.ironbarrels.common.block.regular.entity;
|
||||
|
||||
import com.progwml6.ironchest.common.block.IronChestsBlocks;
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.block.entity.ICrystalChest;
|
||||
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import com.progwml6.ironchest.common.inventory.IronChestMenu;
|
||||
import dev.ubujira.ironbarrels.common.block.IronChestsBlocks;
|
||||
import dev.ubujira.ironbarrels.common.block.IronChestsTypes;
|
||||
import dev.ubujira.ironbarrels.common.block.entity.ICrystalChest;
|
||||
import dev.ubujira.ironbarrels.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import dev.ubujira.ironbarrels.common.inventory.IronChestMenu;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
|
@ -1,9 +1,9 @@
|
|||
package com.progwml6.ironchest.common.block.regular.entity;
|
||||
package dev.ubujira.ironbarrels.common.block.regular.entity;
|
||||
|
||||
import com.progwml6.ironchest.common.block.IronChestsBlocks;
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import com.progwml6.ironchest.common.inventory.IronChestMenu;
|
||||
import dev.ubujira.ironbarrels.common.block.IronChestsBlocks;
|
||||
import dev.ubujira.ironbarrels.common.block.IronChestsTypes;
|
||||
import dev.ubujira.ironbarrels.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import dev.ubujira.ironbarrels.common.inventory.IronChestMenu;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
|
@ -1,9 +1,9 @@
|
|||
package com.progwml6.ironchest.common.block.regular.entity;
|
||||
package dev.ubujira.ironbarrels.common.block.regular.entity;
|
||||
|
||||
import com.progwml6.ironchest.common.block.IronChestsBlocks;
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import com.progwml6.ironchest.common.inventory.IronChestMenu;
|
||||
import dev.ubujira.ironbarrels.common.block.IronChestsBlocks;
|
||||
import dev.ubujira.ironbarrels.common.block.IronChestsTypes;
|
||||
import dev.ubujira.ironbarrels.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import dev.ubujira.ironbarrels.common.inventory.IronChestMenu;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
|
@ -1,9 +1,9 @@
|
|||
package com.progwml6.ironchest.common.block.regular.entity;
|
||||
package dev.ubujira.ironbarrels.common.block.regular.entity;
|
||||
|
||||
import com.progwml6.ironchest.common.block.IronChestsBlocks;
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import com.progwml6.ironchest.common.inventory.IronChestMenu;
|
||||
import dev.ubujira.ironbarrels.common.block.IronChestsBlocks;
|
||||
import dev.ubujira.ironbarrels.common.block.IronChestsTypes;
|
||||
import dev.ubujira.ironbarrels.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import dev.ubujira.ironbarrels.common.inventory.IronChestMenu;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
|
@ -1,9 +1,9 @@
|
|||
package com.progwml6.ironchest.common.block.regular.entity;
|
||||
package dev.ubujira.ironbarrels.common.block.regular.entity;
|
||||
|
||||
import com.progwml6.ironchest.common.block.IronChestsBlocks;
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import com.progwml6.ironchest.common.inventory.IronChestMenu;
|
||||
import dev.ubujira.ironbarrels.common.block.IronChestsBlocks;
|
||||
import dev.ubujira.ironbarrels.common.block.IronChestsTypes;
|
||||
import dev.ubujira.ironbarrels.common.block.entity.IronChestsBlockEntityTypes;
|
||||
import dev.ubujira.ironbarrels.common.inventory.IronChestMenu;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
import net.minecraft.world.inventory.AbstractContainerMenu;
|
|
@ -0,0 +1,7 @@
|
|||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package dev.ubujira.ironbarrels.common.block.regular.entity;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -0,0 +1,7 @@
|
|||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package dev.ubujira.ironbarrels.common.block.regular;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -1,24 +1,22 @@
|
|||
package com.progwml6.ironchest.common.data;
|
||||
package dev.ubujira.ironbarrels.common.data;
|
||||
|
||||
import com.progwml6.ironchest.IronChests;
|
||||
import com.progwml6.ironchest.common.block.IronChestsBlocks;
|
||||
import com.progwml6.ironchest.common.item.IronChestsItems;
|
||||
import com.progwml6.ironchest.common.item.IronChestsUpgradeType;
|
||||
import dev.ubujira.ironbarrels.IronChests;
|
||||
import dev.ubujira.ironbarrels.common.block.IronChestsBlocks;
|
||||
import dev.ubujira.ironbarrels.common.item.IronChestsItems;
|
||||
import dev.ubujira.ironbarrels.common.item.IronChestsUpgradeType;
|
||||
import net.minecraft.advancements.Advancement;
|
||||
import net.minecraft.advancements.AdvancementRewards;
|
||||
import net.minecraft.advancements.RequirementsStrategy;
|
||||
import net.minecraft.advancements.critereon.RecipeUnlockedTrigger;
|
||||
import net.minecraft.data.recipes.ShapelessRecipeBuilder;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.recipes.FinishedRecipe;
|
||||
import net.minecraft.data.recipes.RecipeProvider;
|
||||
import net.minecraft.data.recipes.ShapedRecipeBuilder;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.ItemTags;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraftforge.common.Tags;
|
||||
import net.minecraftforge.common.crafting.ConditionalAdvancement;
|
||||
import net.minecraftforge.common.crafting.ConditionalRecipe;
|
||||
|
@ -91,57 +89,6 @@ public class IronChestsRecipeProvider extends RecipeProvider implements IConditi
|
|||
.unlockedBy("has_glass", has(Tags.Items.GLASS))
|
||||
.save(consumer, location(folder + "diamond_crystal_chest"));
|
||||
|
||||
ShapedRecipeBuilder.shaped(IronChestsBlocks.DIRT_CHEST.get())
|
||||
.define('M', Ingredient.of(Blocks.DIRT, Blocks.COARSE_DIRT, Blocks.PODZOL))
|
||||
.define('S', Tags.Items.CHESTS_WOODEN)
|
||||
.pattern("MMM")
|
||||
.pattern("MSM")
|
||||
.pattern("MMM")
|
||||
.unlockedBy("has_iron_ingot", has(Blocks.DIRT))
|
||||
.save(consumer, location(folder + "vanilla_dirt_chest"));
|
||||
|
||||
ShapelessRecipeBuilder.shapeless(IronChestsBlocks.TRAPPED_IRON_CHEST.get())
|
||||
.requires(IronChestsBlocks.IRON_CHEST.get())
|
||||
.requires(Blocks.TRIPWIRE_HOOK)
|
||||
.unlockedBy("has_tripwire_hook", has(Blocks.TRIPWIRE_HOOK))
|
||||
.save(consumer, location(folder + "trapped_iron_chest"));
|
||||
|
||||
ShapelessRecipeBuilder.shapeless(IronChestsBlocks.TRAPPED_GOLD_CHEST.get())
|
||||
.requires(IronChestsBlocks.GOLD_CHEST.get())
|
||||
.requires(Blocks.TRIPWIRE_HOOK)
|
||||
.unlockedBy("has_tripwire_hook", has(Blocks.TRIPWIRE_HOOK))
|
||||
.save(consumer, location(folder + "trapped_gold_chest"));
|
||||
|
||||
ShapelessRecipeBuilder.shapeless(IronChestsBlocks.TRAPPED_DIAMOND_CHEST.get())
|
||||
.requires(IronChestsBlocks.DIAMOND_CHEST.get())
|
||||
.requires(Blocks.TRIPWIRE_HOOK)
|
||||
.unlockedBy("has_tripwire_hook", has(Blocks.TRIPWIRE_HOOK))
|
||||
.save(consumer, location(folder + "trapped_diamond_chest"));
|
||||
|
||||
ShapelessRecipeBuilder.shapeless(IronChestsBlocks.TRAPPED_COPPER_CHEST.get())
|
||||
.requires(IronChestsBlocks.COPPER_CHEST.get())
|
||||
.requires(Blocks.TRIPWIRE_HOOK)
|
||||
.unlockedBy("has_tripwire_hook", has(Blocks.TRIPWIRE_HOOK))
|
||||
.save(consumer, location(folder + "trapped_copper_chest"));
|
||||
|
||||
ShapelessRecipeBuilder.shapeless(IronChestsBlocks.TRAPPED_CRYSTAL_CHEST.get())
|
||||
.requires(IronChestsBlocks.CRYSTAL_CHEST.get())
|
||||
.requires(Blocks.TRIPWIRE_HOOK)
|
||||
.unlockedBy("has_tripwire_hook", has(Blocks.TRIPWIRE_HOOK))
|
||||
.save(consumer, location(folder + "trapped_crystal_chest"));
|
||||
|
||||
ShapelessRecipeBuilder.shapeless(IronChestsBlocks.TRAPPED_OBSIDIAN_CHEST.get())
|
||||
.requires(IronChestsBlocks.OBSIDIAN_CHEST.get())
|
||||
.requires(Blocks.TRIPWIRE_HOOK)
|
||||
.unlockedBy("has_tripwire_hook", has(Blocks.TRIPWIRE_HOOK))
|
||||
.save(consumer, location(folder + "trapped_obsidian_chest"));
|
||||
|
||||
ShapelessRecipeBuilder.shapeless(IronChestsBlocks.TRAPPED_DIRT_CHEST.get())
|
||||
.requires(IronChestsBlocks.DIRT_CHEST.get())
|
||||
.requires(Blocks.TRIPWIRE_HOOK)
|
||||
.unlockedBy("has_tripwire_hook", has(Blocks.TRIPWIRE_HOOK))
|
||||
.save(consumer, location(folder + "trapped_dirt_chest"));
|
||||
|
||||
ResourceLocation copperToIronChest = location(folder + "copper_iron_chest");
|
||||
ConditionalRecipe.builder()
|
||||
.addCondition(not(new TagEmptyCondition("forge:ingots/copper")))
|
||||
|
@ -153,7 +100,7 @@ public class IronChestsRecipeProvider extends RecipeProvider implements IConditi
|
|||
.pattern("GSG")
|
||||
.pattern("MGM")
|
||||
.unlockedBy("has_item", has(Tags.Items.INGOTS_IRON))::save)
|
||||
.setAdvancement(location("recipes/ironchest/chests/copper_iron_chest"), ConditionalAdvancement.builder()
|
||||
.setAdvancement(location("recipes/ironbarrels/chests/copper_iron_chest"), ConditionalAdvancement.builder()
|
||||
.addCondition(not(new TagEmptyCondition("forge:ingots/copper")))
|
||||
.addAdvancement(Advancement.Builder.advancement()
|
||||
.parent(new ResourceLocation("recipes/root"))
|
||||
|
@ -173,7 +120,7 @@ public class IronChestsRecipeProvider extends RecipeProvider implements IConditi
|
|||
.pattern("MSM")
|
||||
.pattern("MMM")
|
||||
.unlockedBy("has_item", has(INGOTS_COPPER))::save)
|
||||
.setAdvancement(location("recipes/ironchest/chests/vanilla_copper_chest"), ConditionalAdvancement.builder()
|
||||
.setAdvancement(location("recipes/ironbarrels/chests/vanilla_copper_chest"), ConditionalAdvancement.builder()
|
||||
.addCondition(not(new TagEmptyCondition("forge:ingots/copper")))
|
||||
.addAdvancement(Advancement.Builder.advancement()
|
||||
.parent(new ResourceLocation("recipes/root"))
|
||||
|
@ -243,7 +190,7 @@ public class IronChestsRecipeProvider extends RecipeProvider implements IConditi
|
|||
.pattern("MSM")
|
||||
.pattern("MMM")
|
||||
.unlockedBy("has_item", has(ItemTags.PLANKS))::save)
|
||||
.setAdvancement(location("recipes/ironchest/upgrades/wood_to_copper_chest_upgrade"), ConditionalAdvancement.builder()
|
||||
.setAdvancement(location("recipes/ironbarrels/upgrades/wood_to_copper_chest_upgrade"), ConditionalAdvancement.builder()
|
||||
.addCondition(not(new TagEmptyCondition("forge:ingots/copper")))
|
||||
.addAdvancement(Advancement.Builder.advancement()
|
||||
.parent(new ResourceLocation("recipes/root"))
|
||||
|
@ -264,7 +211,7 @@ public class IronChestsRecipeProvider extends RecipeProvider implements IConditi
|
|||
.pattern("GSG")
|
||||
.pattern("MGM")
|
||||
.unlockedBy("has_item", has(ItemTags.PLANKS))::save)
|
||||
.setAdvancement(location("recipes/ironchest/upgrades/copper_to_iron_chest_upgrade"), ConditionalAdvancement.builder()
|
||||
.setAdvancement(location("recipes/ironbarrels/upgrades/copper_to_iron_chest_upgrade"), ConditionalAdvancement.builder()
|
||||
.addCondition(not(new TagEmptyCondition("forge:ingots/copper")))
|
||||
.addAdvancement(Advancement.Builder.advancement()
|
||||
.parent(new ResourceLocation("recipes/root"))
|
|
@ -1,6 +1,6 @@
|
|||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package com.progwml6.ironchest.common.ai;
|
||||
package dev.ubujira.ironbarrels.common.data;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package com.progwml6.ironchest.common.inventory;
|
||||
package dev.ubujira.ironbarrels.common.inventory;
|
||||
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import dev.ubujira.ironbarrels.common.block.IronChestsTypes;
|
||||
import net.minecraft.world.Container;
|
||||
import net.minecraft.world.SimpleContainer;
|
||||
import net.minecraft.world.entity.player.Inventory;
|
||||
|
@ -72,14 +72,6 @@ public class IronChestMenu extends AbstractContainerMenu {
|
|||
return new IronChestMenu(IronChestsContainerTypes.OBSIDIAN_CHEST.get(), containerId, playerInventory, inventory, IronChestsTypes.OBSIDIAN);
|
||||
}
|
||||
|
||||
public static IronChestMenu createDirtContainer(int containerId, Inventory playerInventory) {
|
||||
return new IronChestMenu(IronChestsContainerTypes.DIRT_CHEST.get(), containerId, playerInventory, new SimpleContainer(IronChestsTypes.DIRT.size), IronChestsTypes.DIRT);
|
||||
}
|
||||
|
||||
public static IronChestMenu createDirtContainer(int containerId, Inventory playerInventory, Container inventory) {
|
||||
return new IronChestMenu(IronChestsContainerTypes.DIRT_CHEST.get(), containerId, playerInventory, inventory, IronChestsTypes.DIRT);
|
||||
}
|
||||
|
||||
protected IronChestMenu(@Nullable MenuType<?> menuType, int containerId, Inventory playerInventory, Container inventory, IronChestsTypes chestType) {
|
||||
super(menuType, containerId);
|
||||
|
||||
|
@ -90,13 +82,9 @@ public class IronChestMenu extends AbstractContainerMenu {
|
|||
|
||||
inventory.startOpen(playerInventory.player);
|
||||
|
||||
if (chestType == IronChestsTypes.DIRT) {
|
||||
this.addSlot(new DirtChestSlot(inventory, 0, 12 + 4 * 18, 8 + 2 * 18));
|
||||
} else {
|
||||
for (int chestRow = 0; chestRow < chestType.getRowCount(); chestRow++) {
|
||||
for (int chestCol = 0; chestCol < chestType.rowLength; chestCol++) {
|
||||
this.addSlot(new Slot(inventory, chestCol + chestRow * chestType.rowLength, 12 + chestCol * 18, 18 + chestRow * 18));
|
||||
}
|
||||
for (int chestRow = 0; chestRow < chestType.getRowCount(); chestRow++) {
|
||||
for (int chestCol = 0; chestCol < chestType.rowLength; chestCol++) {
|
||||
this.addSlot(new Slot(inventory, chestCol + chestRow * chestType.rowLength, 12 + chestCol * 18, 18 + chestRow * 18));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
package com.progwml6.ironchest.common.inventory;
|
||||
package dev.ubujira.ironbarrels.common.inventory;
|
||||
|
||||
import com.progwml6.ironchest.IronChests;
|
||||
import dev.ubujira.ironbarrels.IronChests;
|
||||
import net.minecraft.world.inventory.MenuType;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
|
||||
public class IronChestsContainerTypes {
|
||||
|
||||
|
@ -22,5 +22,4 @@ public class IronChestsContainerTypes {
|
|||
|
||||
public static final RegistryObject<MenuType<IronChestMenu>> OBSIDIAN_CHEST = CONTAINERS.register("obsidian_chest", () -> new MenuType<>(IronChestMenu::createObsidianContainer));
|
||||
|
||||
public static final RegistryObject<MenuType<IronChestMenu>> DIRT_CHEST = CONTAINERS.register("dirt_chest", () -> new MenuType<>(IronChestMenu::createDirtContainer));
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package dev.ubujira.ironbarrels.common.inventory;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -1,26 +1,24 @@
|
|||
package com.progwml6.ironchest.common.item;
|
||||
package dev.ubujira.ironbarrels.common.item;
|
||||
|
||||
import com.progwml6.ironchest.common.block.IronChestsBlocks;
|
||||
import com.progwml6.ironchest.common.block.regular.AbstractIronChestBlock;
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.block.regular.entity.AbstractIronChestBlockEntity;
|
||||
import com.progwml6.ironchest.common.block.trapped.entity.AbstractTrappedIronChestBlockEntity;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.entity.TrappedChestBlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.ChestBlock;
|
||||
import dev.ubujira.ironbarrels.common.block.IronChestsBlocks;
|
||||
import dev.ubujira.ironbarrels.common.block.IronChestsTypes;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.AbstractIronChestBlock;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.entity.AbstractIronChestBlockEntity;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.network.chat.Component;
|
||||
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.block.entity.ChestBlockEntity;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.ChestBlock;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.entity.ChestBlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
public class ChestUpgradeItem extends Item {
|
||||
|
||||
|
@ -89,20 +87,14 @@ public class ChestUpgradeItem extends Item {
|
|||
return InteractionResult.PASS;
|
||||
}
|
||||
|
||||
boolean trapped = tileEntity instanceof AbstractTrappedIronChestBlockEntity;
|
||||
|
||||
if(trapped) {
|
||||
iBlockState = IronChestsTypes.get(this.type.target).get(1).defaultBlockState();
|
||||
} else {
|
||||
iBlockState = IronChestsTypes.get(this.type.target).get(0).defaultBlockState();
|
||||
}
|
||||
iBlockState = IronChestsTypes.get(this.type.target).get(0).defaultBlockState();
|
||||
|
||||
chestContents = chest.getItems();
|
||||
chestFacing = chestState.getValue(AbstractIronChestBlock.FACING);
|
||||
customName = chest.getCustomName();
|
||||
iBlockState = iBlockState.setValue(AbstractIronChestBlock.FACING, chestFacing);
|
||||
|
||||
newChest = this.type.target.makeEntity(blockPos, iBlockState, trapped);
|
||||
newChest = this.type.target.makeEntity(blockPos, iBlockState);
|
||||
} else if (tileEntity instanceof ChestBlockEntity chest) {
|
||||
BlockState chestState = world.getBlockState(blockPos);
|
||||
chestFacing = chestState.getValue(ChestBlock.FACING);
|
||||
|
@ -127,17 +119,11 @@ public class ChestUpgradeItem extends Item {
|
|||
|
||||
customName = chest.getCustomName();
|
||||
|
||||
boolean trapped = tileEntity instanceof TrappedChestBlockEntity;
|
||||
|
||||
if(trapped) {
|
||||
iBlockState = IronChestsTypes.get(this.type.target).get(1).defaultBlockState();
|
||||
} else {
|
||||
iBlockState = IronChestsTypes.get(this.type.target).get(0).defaultBlockState();
|
||||
}
|
||||
iBlockState = IronChestsTypes.get(this.type.target).get(0).defaultBlockState();
|
||||
|
||||
iBlockState = iBlockState.setValue(AbstractIronChestBlock.FACING, chestFacing);
|
||||
|
||||
newChest = this.type.target.makeEntity(blockPos, iBlockState, trapped);
|
||||
newChest = this.type.target.makeEntity(blockPos, iBlockState);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
package dev.ubujira.ironbarrels.common.item;
|
||||
|
||||
import dev.ubujira.ironbarrels.client.model.inventory.IronChestItemStackRenderer;
|
||||
import dev.ubujira.ironbarrels.common.block.IronChestsBlocks;
|
||||
import dev.ubujira.ironbarrels.common.block.IronChestsTypes;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.entity.CopperChestBlockEntity;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.entity.CrystalChestBlockEntity;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.entity.DiamondChestBlockEntity;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.entity.GoldChestBlockEntity;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.entity.IronChestBlockEntity;
|
||||
import dev.ubujira.ironbarrels.common.block.regular.entity.ObsidianChestBlockEntity;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.IItemRenderProperties;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class IronChestBlockItem extends BlockItem {
|
||||
|
||||
protected Supplier<IronChestsTypes> type;
|
||||
|
||||
public IronChestBlockItem(Block block, Properties properties, Supplier<Callable<IronChestsTypes>> type) {
|
||||
super(block, properties);
|
||||
|
||||
IronChestsTypes tempType = DistExecutor.callWhenOn(Dist.CLIENT, type);
|
||||
|
||||
this.type = tempType == null ? null : () -> tempType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initializeClient(Consumer<IItemRenderProperties> consumer) {
|
||||
super.initializeClient(consumer);
|
||||
|
||||
consumer.accept(new IItemRenderProperties() {
|
||||
@Override
|
||||
public BlockEntityWithoutLevelRenderer getItemStackRenderer() {
|
||||
Supplier<BlockEntity> modelToUse;
|
||||
|
||||
switch (type.get()) {
|
||||
case GOLD -> modelToUse = () -> new GoldChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.GOLD_CHEST.get().defaultBlockState());
|
||||
case DIAMOND -> modelToUse = () -> new DiamondChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.DIAMOND_CHEST.get().defaultBlockState());
|
||||
case COPPER -> modelToUse = () -> new CopperChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.COPPER_CHEST.get().defaultBlockState());
|
||||
case CRYSTAL -> modelToUse = () -> new CrystalChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.CRYSTAL_CHEST.get().defaultBlockState());
|
||||
case OBSIDIAN -> modelToUse = () -> new ObsidianChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.OBSIDIAN_CHEST.get().defaultBlockState());
|
||||
default -> modelToUse = () -> new IronChestBlockEntity(BlockPos.ZERO, IronChestsBlocks.IRON_CHEST.get().defaultBlockState());
|
||||
}
|
||||
|
||||
return new IronChestItemStackRenderer(Minecraft.getInstance().getBlockEntityRenderDispatcher(), Minecraft.getInstance().getEntityModels(), modelToUse);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,11 +1,11 @@
|
|||
package com.progwml6.ironchest.common.item;
|
||||
package dev.ubujira.ironbarrels.common.item;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.progwml6.ironchest.IronChests;
|
||||
import dev.ubujira.ironbarrels.IronChests;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.RegistryObject;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
|
@ -0,0 +1,37 @@
|
|||
package dev.ubujira.ironbarrels.common.item;
|
||||
|
||||
import dev.ubujira.ironbarrels.common.Util;
|
||||
import dev.ubujira.ironbarrels.common.block.IronChestsTypes;
|
||||
|
||||
import static dev.ubujira.ironbarrels.common.block.IronChestsTypes.COPPER;
|
||||
import static dev.ubujira.ironbarrels.common.block.IronChestsTypes.CRYSTAL;
|
||||
import static dev.ubujira.ironbarrels.common.block.IronChestsTypes.DIAMOND;
|
||||
import static dev.ubujira.ironbarrels.common.block.IronChestsTypes.GOLD;
|
||||
import static dev.ubujira.ironbarrels.common.block.IronChestsTypes.IRON;
|
||||
import static dev.ubujira.ironbarrels.common.block.IronChestsTypes.OBSIDIAN;
|
||||
import static dev.ubujira.ironbarrels.common.block.IronChestsTypes.WOOD;
|
||||
|
||||
public enum IronChestsUpgradeType {
|
||||
|
||||
IRON_TO_GOLD(IRON, GOLD),
|
||||
GOLD_TO_DIAMOND(GOLD, DIAMOND),
|
||||
COPPER_TO_IRON(COPPER, IRON),
|
||||
DIAMOND_TO_CRYSTAL(DIAMOND, CRYSTAL),
|
||||
WOOD_TO_IRON(WOOD, IRON),
|
||||
WOOD_TO_COPPER(WOOD, COPPER),
|
||||
DIAMOND_TO_OBSIDIAN(DIAMOND, OBSIDIAN);
|
||||
|
||||
public final String name;
|
||||
public final IronChestsTypes source;
|
||||
public final IronChestsTypes target;
|
||||
|
||||
IronChestsUpgradeType(IronChestsTypes source, IronChestsTypes target) {
|
||||
this.name = Util.toEnglishName(this.name());
|
||||
this.source = source;
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
public boolean canUpgrade(IronChestsTypes from) {
|
||||
return from == this.source;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package com.progwml6.ironchest.client.model;
|
||||
package dev.ubujira.ironbarrels.common.item;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
package com.progwml6.ironchest.common.network;
|
||||
package dev.ubujira.ironbarrels.common.network;
|
||||
|
||||
import com.progwml6.ironchest.common.block.entity.ICrystalChest;
|
||||
import com.progwml6.ironchest.common.network.helper.IThreadsafePacket;
|
||||
import dev.ubujira.ironbarrels.common.block.entity.ICrystalChest;
|
||||
import dev.ubujira.ironbarrels.common.network.helper.IThreadsafePacket;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.NonNullList;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraftforge.network.NetworkEvent;
|
||||
|
||||
public class InventoryTopStacksSyncPacket implements IThreadsafePacket {
|
||||
|
@ -23,7 +23,7 @@ public class InventoryTopStacksSyncPacket implements IThreadsafePacket {
|
|||
|
||||
public InventoryTopStacksSyncPacket(FriendlyByteBuf buffer) {
|
||||
int size = buffer.readInt();
|
||||
NonNullList<ItemStack> topStacks = NonNullList.<ItemStack>withSize(size, ItemStack.EMPTY);
|
||||
NonNullList<ItemStack> topStacks = NonNullList.withSize(size, ItemStack.EMPTY);
|
||||
|
||||
for (int item = 0; item < size; item++) {
|
||||
ItemStack itemStack = buffer.readItem();
|
|
@ -1,17 +1,17 @@
|
|||
package com.progwml6.ironchest.common.network;
|
||||
package dev.ubujira.ironbarrels.common.network;
|
||||
|
||||
import com.progwml6.ironchest.IronChests;
|
||||
import com.progwml6.ironchest.common.network.helper.ISimplePacket;
|
||||
import dev.ubujira.ironbarrels.IronChests;
|
||||
import dev.ubujira.ironbarrels.common.network.helper.ISimplePacket;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.chunk.LevelChunk;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.network.NetworkDirection;
|
||||
import net.minecraftforge.network.NetworkEvent;
|
||||
|
@ -53,7 +53,7 @@ public class IronChestNetwork {
|
|||
}
|
||||
|
||||
/**
|
||||
* Called during mod construction to setup the network
|
||||
* Called during mod construction to set up the network
|
||||
*/
|
||||
public static void setup() {
|
||||
if (instance != null) {
|
||||
|
@ -117,7 +117,7 @@ public class IronChestNetwork {
|
|||
* @param packet Packet
|
||||
*/
|
||||
public void sendVanillaPacket(Packet<?> packet, Entity player) {
|
||||
if (player instanceof ServerPlayer && ((ServerPlayer) player).connection != null) {
|
||||
if (player instanceof ServerPlayer) {
|
||||
((ServerPlayer) player).connection.send(packet);
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.progwml6.ironchest.common.network.helper;
|
||||
package dev.ubujira.ironbarrels.common.network.helper;
|
||||
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraftforge.network.NetworkEvent;
|
|
@ -1,4 +1,4 @@
|
|||
package com.progwml6.ironchest.common.network.helper;
|
||||
package dev.ubujira.ironbarrels.common.network.helper;
|
||||
|
||||
import net.minecraftforge.network.NetworkEvent;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package com.progwml6.ironchest.client.model.inventory;
|
||||
package dev.ubujira.ironbarrels.common.network.helper;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package dev.ubujira.ironbarrels.common.network;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
@ -1,6 +1,6 @@
|
|||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package com.progwml6.ironchest.client;
|
||||
package dev.ubujira.ironbarrels.common;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
package com.progwml6.ironchest;
|
||||
package dev.ubujira.ironbarrels;
|
||||
|
||||
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||
|
|
@ -1,28 +1,28 @@
|
|||
modLoader="javafml"
|
||||
loaderVersion="${loader_range}"
|
||||
issueTrackerURL="https://github.com/progwml6/ironchest/issues"
|
||||
license="GNU General Public License v3.0"
|
||||
loaderVersion = "${loader_range}"
|
||||
issueTrackerURL = "https://code.ubujira.dev/Ubujira/ironbarrels/issues"
|
||||
license = "GNU General Public License v3.0"
|
||||
|
||||
[[mods]]
|
||||
modId="ironchest"
|
||||
namespace="ironchest"
|
||||
version="${version}"
|
||||
displayName="Iron Chests"
|
||||
authors="cpw, alexbegt, progwml6"
|
||||
description='''
|
||||
New chests with larger sizes, with in-place upgrade items.
|
||||
The feature chest is the crystal chest, which is transparent - some inventory contents are visible without opening the chest
|
||||
modId = "ironbarrels"
|
||||
namespace = "ironbarrels"
|
||||
version = "${version}"
|
||||
displayName = "Iron Barrels"
|
||||
authors = "cpw, alexbegt, progwml6, Ubujira"
|
||||
description = '''
|
||||
New barrels with larger sizes, with in-place upgrade items.
|
||||
The feature barrel is the crystal barrel, which is transparent - some inventory contents are visible without opening the chest
|
||||
'''
|
||||
displayURL="https://minecraft.curseforge.com/projects/iron-chests"
|
||||
displayURL = "https://code.ubujira.dev/Ubujira/ironbarrels"
|
||||
|
||||
[[dependencies.ironchest]]
|
||||
[[dependencies.ironbarrels]]
|
||||
modId="forge"
|
||||
mandatory=true
|
||||
versionRange="${forge_range}"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
|
||||
[[dependencies.ironchest]]
|
||||
[[dependencies.ironbarrels]]
|
||||
modId="minecraft"
|
||||
mandatory=true
|
||||
versionRange="${minecraft_range}"
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"variants": {
|
||||
"": {
|
||||
"model": "ironbarrels:block/copper_chest"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"variants": {
|
||||
"": {
|
||||
"model": "ironbarrels:block/crystal_chest"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"variants": {
|
||||
"": {
|
||||
"model": "ironbarrels:block/diamond_chest"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"variants": {
|
||||
"": {
|
||||
"model": "ironbarrels:block/gold_chest"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"variants": {
|
||||
"": {
|
||||
"model": "ironbarrels:block/iron_chest"
|
||||
}
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue