Upgrade Iron Chests to 1.15.2. Textures are broken at the moment due to vanilla changes.
This commit is contained in:
parent
d0152542f3
commit
56db909289
|
@ -13,4 +13,5 @@ out/
|
|||
.idea/
|
||||
/*.iml
|
||||
/*.ipr
|
||||
/*.iws
|
||||
/*.iws
|
||||
/generated
|
|
@ -29,6 +29,8 @@ sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = co
|
|||
minecraft {
|
||||
mappings channel: 'snapshot', version: mappings_version
|
||||
|
||||
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||
|
||||
runs {
|
||||
client {
|
||||
workingDirectory project.file('run')
|
||||
|
|
|
@ -7,12 +7,12 @@ org.gradle.daemon=false
|
|||
mod_version=10.0
|
||||
|
||||
# Minecraft Version Information
|
||||
minecraft_version=1.15.1
|
||||
minecraft_version=1.15.2
|
||||
minecraft_version_toml=15
|
||||
|
||||
# Forge Version Information
|
||||
forge_version=30.0.18
|
||||
forge_version_toml=30
|
||||
forge_version=31.0.0
|
||||
forge_version_toml=31
|
||||
|
||||
# Mappings Information
|
||||
mappings_version=20191217-1.14.3
|
||||
mappings_version=20200122-1.15.1
|
|
@ -1,11 +1,26 @@
|
|||
package com.progwml6.ironchest.client.data;
|
||||
|
||||
import com.progwml6.ironchest.IronChests;
|
||||
import com.progwml6.ironchest.common.Util;
|
||||
import com.progwml6.ironchest.common.block.IronChestsBlocks;
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.item.IronChestsItems;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.data.DataGenerator;
|
||||
import net.minecraft.data.DirectoryCache;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.util.IItemProvider;
|
||||
import net.minecraftforge.common.data.LanguageProvider;
|
||||
import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class IronChestsLangProvider extends LanguageProvider {
|
||||
|
||||
|
@ -34,7 +49,57 @@ public class IronChestsLangProvider extends LanguageProvider {
|
|||
|
||||
@Override
|
||||
protected void addTranslations() {
|
||||
// Blocks
|
||||
|
||||
this.addBlock(IronChestsBlocks.IRON_CHEST);
|
||||
this.addBlock(IronChestsBlocks.GOLD_CHEST);
|
||||
this.addBlock(IronChestsBlocks.DIAMOND_CHEST);
|
||||
this.addBlock(IronChestsBlocks.COPPER_CHEST);
|
||||
this.addBlock(IronChestsBlocks.SILVER_CHEST);
|
||||
this.addBlock(IronChestsBlocks.CRYSTAL_CHEST);
|
||||
this.addBlock(IronChestsBlocks.OBSIDIAN_CHEST);
|
||||
this.addBlock(IronChestsBlocks.DIRT_CHEST);
|
||||
|
||||
// ITEMS
|
||||
|
||||
IronChestsItems.UPGRADES.values().forEach(this::addItem);
|
||||
|
||||
// MISC
|
||||
|
||||
this.add(IronChests.IRONCHESTS_ITEM_GROUP, "Iron Chests");
|
||||
|
||||
//IronChestsTypes.values()
|
||||
}
|
||||
|
||||
private String getAutomaticName(Supplier<? extends IForgeRegistryEntry<?>> sup) {
|
||||
return Util.toEnglishName(sup.get().getRegistryName().getPath());
|
||||
}
|
||||
|
||||
private void addBlock(Supplier<? extends Block> block) {
|
||||
this.addBlock(block, this.getAutomaticName(block));
|
||||
}
|
||||
|
||||
private void addItem(Supplier<? extends Item> item) {
|
||||
this.addItem(item, this.getAutomaticName(item));
|
||||
}
|
||||
|
||||
private void addItemWithTooltip(Supplier<? extends Item> block, String name, List<String> tooltip) {
|
||||
this.addItem(block, name);
|
||||
this.addTooltip(block, tooltip);
|
||||
}
|
||||
|
||||
private void addTooltip(Supplier<? extends IItemProvider> item, String tooltip) {
|
||||
this.add(item.get().asItem().getTranslationKey() + ".desc", tooltip);
|
||||
}
|
||||
|
||||
private void addTooltip(Supplier<? extends IItemProvider> item, List<String> tooltip) {
|
||||
for (int i = 0; i < tooltip.size(); i++) {
|
||||
this.add(item.get().asItem().getTranslationKey() + ".desc." + i, tooltip.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
private void add(ItemGroup group, String name) {
|
||||
this.add(group.getTranslationKey(), name);
|
||||
}
|
||||
|
||||
// Automatic en_ud generation
|
||||
|
@ -83,7 +148,7 @@ public class IronChestsLangProvider extends LanguageProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void add(String key, String value) {
|
||||
public void add(String key, String value) {
|
||||
super.add(key, value);
|
||||
this.upsideDown.add(key, this.toUpsideDown(value));
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ public class IronChestItemStackRenderer<T extends TileEntity> extends ItemStackT
|
|||
}
|
||||
|
||||
@Override
|
||||
public void func_228364_a_(ItemStack itemStackIn, MatrixStack matrixStack, IRenderTypeBuffer iRenderTypeBuffer, int p_228364_4_, int p_228364_5_) {
|
||||
TileEntityRendererDispatcher.instance.func_228852_a_(this.te.get(), matrixStack, iRenderTypeBuffer, p_228364_4_, p_228364_5_);
|
||||
public void render(ItemStack itemStackIn, MatrixStack matrixStack, IRenderTypeBuffer iRenderTypeBuffer, int p_228364_4_, int p_228364_5_) {
|
||||
TileEntityRendererDispatcher.instance.renderNullable(this.te.get(), matrixStack, iRenderTypeBuffer, p_228364_4_, p_228364_5_);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,18 +33,18 @@ public class IronChestTileEntityRenderer<T extends TileEntity & IChestLid> exten
|
|||
super(tileEntityRendererDispatcher);
|
||||
|
||||
this.chestBottom = new ModelRenderer(64, 64, 0, 19);
|
||||
this.chestBottom.func_228301_a_(1.0F, 0.0F, 1.0F, 14.0F, 10.0F, 14.0F, 0.0F);
|
||||
this.chestBottom.addBox(1.0F, 0.0F, 1.0F, 14.0F, 10.0F, 14.0F, 0.0F);
|
||||
this.chestLid = new ModelRenderer(64, 64, 0, 0);
|
||||
this.chestLid.func_228301_a_(1.0F, 0.0F, 0.0F, 14.0F, 5.0F, 14.0F, 0.0F);
|
||||
this.chestLid.addBox(1.0F, 0.0F, 0.0F, 14.0F, 5.0F, 14.0F, 0.0F);
|
||||
this.chestLid.rotationPointY = 9.0F;
|
||||
this.chestLid.rotationPointZ = 1.0F;
|
||||
this.chestLock = new ModelRenderer(64, 64, 0, 0);
|
||||
this.chestLock.func_228301_a_(7.0F, -1.0F, 15.0F, 2.0F, 4.0F, 1.0F, 0.0F);
|
||||
this.chestLock.addBox(7.0F, -1.0F, 15.0F, 2.0F, 4.0F, 1.0F, 0.0F);
|
||||
this.chestLock.rotationPointY = 8.0F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_225616_a_(T tileEntityIn, float partialTicks, MatrixStack matrixStack, IRenderTypeBuffer iRenderTypeBuffer, int p_225616_5_, int p_225616_6_) {
|
||||
public void render(T tileEntityIn, float partialTicks, MatrixStack matrixStack, IRenderTypeBuffer iRenderTypeBuffer, int p_225616_5_, int p_225616_6_) {
|
||||
GenericIronChestTileEntity tileEntity = (GenericIronChestTileEntity) tileEntityIn;
|
||||
|
||||
World world = tileEntity.getWorld();
|
||||
|
@ -62,11 +62,11 @@ public class IronChestTileEntityRenderer<T extends TileEntity & IChestLid> exten
|
|||
if (block instanceof GenericIronChestBlock) {
|
||||
GenericIronChestBlock ironChestBlock = (GenericIronChestBlock) block;
|
||||
|
||||
matrixStack.func_227860_a_();
|
||||
matrixStack.push();
|
||||
float f = blockstate.get(GenericIronChestBlock.FACING).getHorizontalAngle();
|
||||
matrixStack.func_227861_a_(0.5D, 0.5D, 0.5D);
|
||||
matrixStack.func_227863_a_(Vector3f.field_229181_d_.func_229187_a_(-f));
|
||||
matrixStack.func_227861_a_(-0.5D, -0.5D, -0.5D);
|
||||
matrixStack.translate(0.5D, 0.5D, 0.5D);
|
||||
matrixStack.rotate(Vector3f.field_229181_d_.func_229187_a_(-f));
|
||||
matrixStack.translate(-0.5D, -0.5D, -0.5D);
|
||||
|
||||
TileEntityMerger.ICallbackWrapper<? extends GenericIronChestTileEntity> iCallbackWrapper;
|
||||
if (flag) {
|
||||
|
@ -82,19 +82,19 @@ public class IronChestTileEntityRenderer<T extends TileEntity & IChestLid> exten
|
|||
int i = iCallbackWrapper.apply(new DualBrightnessCallback<>()).applyAsInt(p_225616_5_);
|
||||
|
||||
Material material = IronChestsModels.chooseChestModel(tileEntity, chestType);
|
||||
IVertexBuilder ivertexbuilder = material.func_229311_a_(iRenderTypeBuffer, RenderType::func_228638_b_);
|
||||
IVertexBuilder ivertexbuilder = material.func_229311_a_(iRenderTypeBuffer, RenderType::entityCutout);
|
||||
|
||||
this.handleModelRender(matrixStack, ivertexbuilder, this.chestLid, this.chestLock, this.chestBottom, f1, i, p_225616_6_);
|
||||
|
||||
matrixStack.func_227865_b_();
|
||||
matrixStack.pop();
|
||||
}
|
||||
}
|
||||
|
||||
private void handleModelRender(MatrixStack matrixStack, IVertexBuilder iVertexBuilder, ModelRenderer firstModel, ModelRenderer secondModel, ModelRenderer thirdModel, float f1, int p_228871_7_, int p_228871_8_) {
|
||||
firstModel.rotateAngleX = -(f1 * ((float) Math.PI / 2F));
|
||||
secondModel.rotateAngleX = firstModel.rotateAngleX;
|
||||
firstModel.func_228308_a_(matrixStack, iVertexBuilder, p_228871_7_, p_228871_8_);
|
||||
secondModel.func_228308_a_(matrixStack, iVertexBuilder, p_228871_7_, p_228871_8_);
|
||||
thirdModel.func_228308_a_(matrixStack, iVertexBuilder, p_228871_7_, p_228871_8_);
|
||||
firstModel.render(matrixStack, iVertexBuilder, p_228871_7_, p_228871_8_);
|
||||
secondModel.render(matrixStack, iVertexBuilder, p_228871_7_, p_228871_8_);
|
||||
thirdModel.render(matrixStack, iVertexBuilder, p_228871_7_, p_228871_8_);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,38 +1,23 @@
|
|||
package com.progwml6.ironchest.client.tileentity;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import com.progwml6.ironchest.IronChests;
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.Atlases;
|
||||
import net.minecraft.client.renderer.model.Material;
|
||||
import net.minecraft.client.renderer.model.ModelBakery;
|
||||
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||
import net.minecraft.profiler.EmptyProfiler;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = IronChests.MODID, value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
public class IronChestsModels {
|
||||
|
||||
public static final ResourceLocation chestAtlas = new ResourceLocation("textures/atlas/chest.png");
|
||||
|
||||
protected static final Set<Material> LOCATIONS_BUILTIN_TEXTURES = Util.make(Sets.newHashSet(), (p_229337_0_) -> {
|
||||
addTextures(p_229337_0_::add);
|
||||
});
|
||||
|
||||
public IronChestsModels() {
|
||||
System.out.println("IronChestsModels");
|
||||
//ModelBakery.LOCATIONS_BUILTIN_TEXTURES.addAll(LOCATIONS_BUILTIN_TEXTURES);
|
||||
}
|
||||
|
||||
public static final Material IRON_CHEST_LOCATION = getChestMaterial("iron");
|
||||
public static final Material GOLD_CHEST_LOCATION = getChestMaterial("gold");
|
||||
public static final Material DIAMOND_CHEST_LOCATION = getChestMaterial("diamond");
|
||||
|
@ -54,7 +39,7 @@ public class IronChestsModels {
|
|||
}
|
||||
|
||||
private static Material getChestMaterial(String name) {
|
||||
return new Material(Atlases.field_228747_f_, new ResourceLocation(IronChests.MODID, "model/" + name + "_chest"));
|
||||
return new Material(Atlases.CHEST_ATLAS, new ResourceLocation(IronChests.MODID, "model/" + name + "_chest"));
|
||||
}
|
||||
|
||||
public static Material chooseChestModel(TileEntity tileEntity, IronChestsTypes type) {
|
||||
|
@ -77,7 +62,23 @@ public class IronChestsModels {
|
|||
return DIRT_CHEST_LOCATION;
|
||||
case WOOD:
|
||||
default:
|
||||
return Atlases.field_228758_q_;
|
||||
return Atlases.CHEST_MATERIAL;
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onStitch(TextureStitchEvent.Pre event) {
|
||||
if (!event.getMap().getBasePath().equals(Atlases.CHEST_ATLAS)) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.addSprite(IRON_CHEST_LOCATION.func_229313_b_());
|
||||
event.addSprite(GOLD_CHEST_LOCATION.func_229313_b_());
|
||||
event.addSprite(DIAMOND_CHEST_LOCATION.func_229313_b_());
|
||||
event.addSprite(COPPER_CHEST_LOCATION.func_229313_b_());
|
||||
event.addSprite(SILVER_CHEST_LOCATION.func_229313_b_());
|
||||
event.addSprite(CRYSTAL_CHEST_LOCATION.func_229313_b_());
|
||||
event.addSprite(OBSIDIAN_CHEST_LOCATION.func_229313_b_());
|
||||
event.addSprite(DIRT_CHEST_LOCATION.func_229313_b_());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
package com.progwml6.ironchest.common;
|
||||
|
||||
public class IronChestsTags {
|
||||
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package com.progwml6.ironchest.common;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class Util {
|
||||
|
||||
public static String toEnglishName(String internalName) {
|
||||
return Arrays.stream(internalName.toLowerCase(Locale.ROOT).split("_"))
|
||||
.map(StringUtils::capitalize)
|
||||
.collect(Collectors.joining(" "));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package com.progwml6.ironchest.common.ai;
|
||||
|
||||
import net.minecraft.entity.ai.goal.CatSitOnBlockGoal;
|
||||
import net.minecraft.entity.ai.goal.PrioritizedGoal;
|
||||
import net.minecraft.entity.passive.CatEntity;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
public class CatsSitOnChestsHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public void changeSittingTaskForOcelots(final LivingEvent.LivingUpdateEvent evt) {
|
||||
if (evt.getEntityLiving().ticksExisted < 5 && evt.getEntityLiving() instanceof CatEntity) {
|
||||
HashSet<PrioritizedGoal> goals = new HashSet<>();
|
||||
|
||||
CatEntity catEntity = (CatEntity) evt.getEntityLiving();
|
||||
|
||||
for (PrioritizedGoal goal : catEntity.goalSelector.goals) {
|
||||
if (goal.getGoal().getClass() == CatSitOnBlockGoal.class) {
|
||||
goals.add(goal);
|
||||
}
|
||||
}
|
||||
|
||||
for (PrioritizedGoal goal : goals) {
|
||||
catEntity.goalSelector.removeGoal(goal.getGoal());
|
||||
catEntity.goalSelector.addGoal(goal.getPriority(), new IronChestCatSitOnBlockGoal(catEntity, 0.4F));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package com.progwml6.ironchest.common.ai;
|
||||
|
||||
import com.progwml6.ironchest.common.block.GenericIronChestBlock;
|
||||
import com.progwml6.ironchest.common.block.tileentity.GenericIronChestTileEntity;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.ai.goal.CatSitOnBlockGoal;
|
||||
import net.minecraft.entity.passive.CatEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
|
||||
public class IronChestCatSitOnBlockGoal extends CatSitOnBlockGoal {
|
||||
|
||||
public IronChestCatSitOnBlockGoal(CatEntity catEntity, double p_i50330_2_) {
|
||||
super(catEntity, p_i50330_2_);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldMoveTo(IWorldReader worldIn, BlockPos pos) {
|
||||
if (!worldIn.isAirBlock(pos.up())) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
BlockState blockstate = worldIn.getBlockState(pos);
|
||||
Block block = blockstate.getBlock();
|
||||
|
||||
if (block instanceof GenericIronChestBlock) {
|
||||
return GenericIronChestTileEntity.getPlayersUsing(worldIn, pos) < 1;
|
||||
}
|
||||
|
||||
return super.shouldMoveTo(worldIn, pos);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -133,7 +133,7 @@ public class GenericIronChestBlock extends Block implements IWaterLoggable {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType func_225533_a_(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
|
||||
public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
|
||||
if (!worldIn.isRemote) {
|
||||
INamedContainerProvider inamedcontainerprovider = this.getContainer(state, worldIn, pos);
|
||||
if (inamedcontainerprovider != null) {
|
||||
|
|
|
@ -34,35 +34,35 @@ public class IronChestsBlocks {
|
|||
|
||||
public static final RegistryObject<IronChestBlock> IRON_CHEST = register(
|
||||
"iron_chest", () -> new IronChestBlock(Block.Properties.create(Material.IRON).hardnessAndResistance(3.0F)),
|
||||
() -> ironChestRenderer());
|
||||
IronChestsBlocks::ironChestRenderer);
|
||||
|
||||
public static final RegistryObject<GoldChestBlock> GOLD_CHEST = register(
|
||||
"gold_chest", () -> new GoldChestBlock(Block.Properties.create(Material.IRON).hardnessAndResistance(3.0F)),
|
||||
() -> goldChestRenderer());
|
||||
IronChestsBlocks::goldChestRenderer);
|
||||
|
||||
public static final RegistryObject<DiamondChestBlock> DIAMOND_CHEST = register(
|
||||
"diamond_chest", () -> new DiamondChestBlock(Block.Properties.create(Material.IRON).hardnessAndResistance(3.0F)),
|
||||
() -> diamondChestRenderer());
|
||||
IronChestsBlocks::diamondChestRenderer);
|
||||
|
||||
public static final RegistryObject<CopperChestBlock> COPPER_CHEST = register(
|
||||
"copper_chest", () -> new CopperChestBlock(Block.Properties.create(Material.IRON).hardnessAndResistance(3.0F)),
|
||||
() -> copperChestRenderer());
|
||||
IronChestsBlocks::copperChestRenderer);
|
||||
|
||||
public static final RegistryObject<SilverChestBlock> SILVER_CHEST = register(
|
||||
"silver_chest", () -> new SilverChestBlock(Block.Properties.create(Material.IRON).hardnessAndResistance(3.0F)),
|
||||
() -> silverChestRenderer());
|
||||
IronChestsBlocks::silverChestRenderer);
|
||||
|
||||
public static final RegistryObject<CrystalChestBlock> CRYSTAL_CHEST = register(
|
||||
"crystal_chest", () -> new CrystalChestBlock(Block.Properties.create(Material.IRON).hardnessAndResistance(3.0F)),
|
||||
() -> crystalChestRenderer());
|
||||
IronChestsBlocks::crystalChestRenderer);
|
||||
|
||||
public static final RegistryObject<ObsidianChestBlock> OBSIDIAN_CHEST = register(
|
||||
"obsidian_chest", () -> new ObsidianChestBlock(Block.Properties.create(Material.IRON).hardnessAndResistance(3.0F, 10000.0F)),
|
||||
() -> obsidianChestRenderer());
|
||||
IronChestsBlocks::obsidianChestRenderer);
|
||||
|
||||
public static final RegistryObject<DirtChestBlock> DIRT_CHEST = register(
|
||||
"dirt_chest", () -> new DirtChestBlock(Block.Properties.create(Material.IRON).hardnessAndResistance(3.0F)),
|
||||
() -> dirtChestRenderer());
|
||||
IronChestsBlocks::dirtChestRenderer);
|
||||
|
||||
private static <T extends Block> RegistryObject<T> register(String name, Supplier<? extends T> sup, Supplier<Callable<ItemStackTileEntityRenderer>> renderMethod) {
|
||||
return register(name, sup, block -> item(block, renderMethod));
|
||||
|
@ -79,46 +79,46 @@ public class IronChestsBlocks {
|
|||
}
|
||||
|
||||
private static Supplier<BlockItem> item(final RegistryObject<? extends Block> block, final Supplier<Callable<ItemStackTileEntityRenderer>> renderMethod) {
|
||||
return () -> new BlockItem(block.get(), new Item.Properties().group(IronChests.IRONCHESTS_ITEM_GROUP).setTEISR(renderMethod));
|
||||
return () -> new BlockItem(block.get(), new Item.Properties().group(IronChests.IRONCHESTS_ITEM_GROUP).setISTER(renderMethod));
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private static Callable<ItemStackTileEntityRenderer> ironChestRenderer() {
|
||||
return () -> new IronChestItemStackRenderer(() -> new IronChestTileEntity());
|
||||
return () -> new IronChestItemStackRenderer(IronChestTileEntity::new);
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private static Callable<ItemStackTileEntityRenderer> goldChestRenderer() {
|
||||
return () -> new IronChestItemStackRenderer(() -> new GoldChestTileEntity());
|
||||
return () -> new IronChestItemStackRenderer(GoldChestTileEntity::new);
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private static Callable<ItemStackTileEntityRenderer> diamondChestRenderer() {
|
||||
return () -> new IronChestItemStackRenderer(() -> new DiamondChestTileEntity());
|
||||
return () -> new IronChestItemStackRenderer(DiamondChestTileEntity::new);
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private static Callable<ItemStackTileEntityRenderer> copperChestRenderer() {
|
||||
return () -> new IronChestItemStackRenderer(() -> new CopperChestTileEntity());
|
||||
return () -> new IronChestItemStackRenderer(CopperChestTileEntity::new);
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private static Callable<ItemStackTileEntityRenderer> silverChestRenderer() {
|
||||
return () -> new IronChestItemStackRenderer(() -> new SilverChestTileEntity());
|
||||
return () -> new IronChestItemStackRenderer(SilverChestTileEntity::new);
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private static Callable<ItemStackTileEntityRenderer> crystalChestRenderer() {
|
||||
return () -> new IronChestItemStackRenderer(() -> new CrystalChestTileEntity());
|
||||
return () -> new IronChestItemStackRenderer(CrystalChestTileEntity::new);
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private static Callable<ItemStackTileEntityRenderer> obsidianChestRenderer() {
|
||||
return () -> new IronChestItemStackRenderer(() -> new ObsidianChestTileEntity());
|
||||
return () -> new IronChestItemStackRenderer(ObsidianChestTileEntity::new);
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private static Callable<ItemStackTileEntityRenderer> dirtChestRenderer() {
|
||||
return () -> new IronChestItemStackRenderer(() -> new DirtChestTileEntity());
|
||||
return () -> new IronChestItemStackRenderer(DirtChestTileEntity::new);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.progwml6.ironchest.common.block;
|
||||
|
||||
import com.progwml6.ironchest.common.Util;
|
||||
import com.progwml6.ironchest.common.block.tileentity.CopperChestTileEntity;
|
||||
import com.progwml6.ironchest.common.block.tileentity.CrystalChestTileEntity;
|
||||
import com.progwml6.ironchest.common.block.tileentity.DiamondChestTileEntity;
|
||||
|
@ -9,47 +10,43 @@ import com.progwml6.ironchest.common.block.tileentity.GoldChestTileEntity;
|
|||
import com.progwml6.ironchest.common.block.tileentity.IronChestTileEntity;
|
||||
import com.progwml6.ironchest.common.block.tileentity.ObsidianChestTileEntity;
|
||||
import com.progwml6.ironchest.common.block.tileentity.SilverChestTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public enum IronChestsTypes implements IStringSerializable {
|
||||
|
||||
IRON(54, 9, IronChestTileEntity.class, 184, 222, new ResourceLocation("ironchest", "textures/gui/iron_container.png"), 256, 256),
|
||||
GOLD(81, 9, GoldChestTileEntity.class, 184, 276, new ResourceLocation("ironchest", "textures/gui/gold_container.png"), 256, 276),
|
||||
DIAMOND(108, 12, DiamondChestTileEntity.class, 238, 276, new ResourceLocation("ironchest", "textures/gui/diamond_container.png"), 256, 276),
|
||||
COPPER(45, 9, CopperChestTileEntity.class, 184, 204, new ResourceLocation("ironchest", "textures/gui/copper_container.png"), 256, 256),
|
||||
SILVER(72, 9, SilverChestTileEntity.class, 184, 258, new ResourceLocation("ironchest", "textures/gui/silver_container.png"), 256, 276),
|
||||
CRYSTAL(108, 12, CrystalChestTileEntity.class, 238, 276, new ResourceLocation("ironchest", "textures/gui/diamond_container.png"), 256, 276),
|
||||
OBSIDIAN(108, 12, ObsidianChestTileEntity.class, 238, 276, new ResourceLocation("ironchest", "textures/gui/diamond_container.png"), 256, 276),
|
||||
DIRTCHEST9000(1, 1, DirtChestTileEntity.class, 184, 184, new ResourceLocation("ironchest", "textures/gui/dirt_container.png"), 256, 256),
|
||||
WOOD(0, 0, null, 0, 0, null, 0, 0);
|
||||
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),
|
||||
SILVER(72, 9, 184, 258, new ResourceLocation("ironchest", "textures/gui/silver_container.png"), 256, 276),
|
||||
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),
|
||||
DIRTCHEST9000(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 Class<? extends TileEntity> clazz;
|
||||
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, Class<? extends GenericIronChestTileEntity> clazz, int xSize, int ySize, ResourceLocation guiTexture, int textureXSize, int textureYSize) {
|
||||
this(null, size, rowLength, clazz, xSize, ySize, guiTexture, textureXSize, 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, Class<? extends GenericIronChestTileEntity> clazz, int xSize, int ySize, ResourceLocation guiTexture, int textureXSize, int textureYSize) {
|
||||
this.name = name == null ? toEnglishName(this.name()) : name;
|
||||
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.clazz = clazz;
|
||||
this.xSize = xSize;
|
||||
this.ySize = ySize;
|
||||
this.guiTexture = guiTexture;
|
||||
|
@ -65,12 +62,6 @@ public enum IronChestsTypes implements IStringSerializable {
|
|||
return this.name;
|
||||
}
|
||||
|
||||
public static final String toEnglishName(String internalName) {
|
||||
return Arrays.stream(internalName.toLowerCase(Locale.ROOT).split("_"))
|
||||
.map(StringUtils::capitalize)
|
||||
.collect(Collectors.joining(" "));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.getEnglishName();
|
||||
|
@ -83,4 +74,50 @@ public enum IronChestsTypes implements IStringSerializable {
|
|||
public boolean isTransparent() {
|
||||
return this == CRYSTAL;
|
||||
}
|
||||
|
||||
public static Block get(IronChestsTypes type) {
|
||||
switch (type) {
|
||||
case IRON:
|
||||
return IronChestsBlocks.IRON_CHEST.get();
|
||||
case GOLD:
|
||||
return IronChestsBlocks.GOLD_CHEST.get();
|
||||
case DIAMOND:
|
||||
return IronChestsBlocks.DIAMOND_CHEST.get();
|
||||
case COPPER:
|
||||
return IronChestsBlocks.COPPER_CHEST.get();
|
||||
case SILVER:
|
||||
return IronChestsBlocks.SILVER_CHEST.get();
|
||||
case CRYSTAL:
|
||||
return IronChestsBlocks.CRYSTAL_CHEST.get();
|
||||
case OBSIDIAN:
|
||||
return IronChestsBlocks.OBSIDIAN_CHEST.get();
|
||||
case DIRTCHEST9000:
|
||||
return IronChestsBlocks.DIRT_CHEST.get();
|
||||
default:
|
||||
return Blocks.CHEST;
|
||||
}
|
||||
}
|
||||
|
||||
public GenericIronChestTileEntity makeEntity() {
|
||||
switch (this) {
|
||||
case IRON:
|
||||
return new IronChestTileEntity();
|
||||
case GOLD:
|
||||
return new GoldChestTileEntity();
|
||||
case DIAMOND:
|
||||
return new DiamondChestTileEntity();
|
||||
case COPPER:
|
||||
return new CopperChestTileEntity();
|
||||
case SILVER:
|
||||
return new SilverChestTileEntity();
|
||||
case CRYSTAL:
|
||||
return new CrystalChestTileEntity();
|
||||
case OBSIDIAN:
|
||||
return new ObsidianChestTileEntity();
|
||||
case DIRTCHEST9000:
|
||||
return new DirtChestTileEntity();
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,16 +48,16 @@ public class DirtChestTileEntity extends GenericIronChestTileEntity {
|
|||
}
|
||||
|
||||
private static void createBookData() {
|
||||
dirtChest9000GuideBook.setTagInfo("author", StringNBT.func_229705_a_("cpw"));
|
||||
dirtChest9000GuideBook.setTagInfo("author", StringNBT.valueOf("cpw"));
|
||||
|
||||
dirtChest9000GuideBook.setTagInfo("title", StringNBT.func_229705_a_(I18n.format("book.ironchest.dirtchest9000.title")));
|
||||
dirtChest9000GuideBook.setTagInfo("title", StringNBT.valueOf(I18n.format("book.ironchest.dirtchest9000.title")));
|
||||
|
||||
ListNBT pages = new ListNBT();
|
||||
pages.add(StringNBT.func_229705_a_(ITextComponent.Serializer.toJson(new TranslationTextComponent("book.ironchest.dirtchest9000.page1"))));
|
||||
pages.add(StringNBT.func_229705_a_(ITextComponent.Serializer.toJson(new TranslationTextComponent("book.ironchest.dirtchest9000.page2"))));
|
||||
pages.add(StringNBT.func_229705_a_(ITextComponent.Serializer.toJson(new TranslationTextComponent("book.ironchest.dirtchest9000.page3"))));
|
||||
pages.add(StringNBT.func_229705_a_(ITextComponent.Serializer.toJson(new TranslationTextComponent("book.ironchest.dirtchest9000.page4"))));
|
||||
pages.add(StringNBT.func_229705_a_(ITextComponent.Serializer.toJson(new TranslationTextComponent("book.ironchest.dirtchest9000.page5"))));
|
||||
pages.add(StringNBT.valueOf(ITextComponent.Serializer.toJson(new TranslationTextComponent("book.ironchest.dirtchest9000.page1"))));
|
||||
pages.add(StringNBT.valueOf(ITextComponent.Serializer.toJson(new TranslationTextComponent("book.ironchest.dirtchest9000.page2"))));
|
||||
pages.add(StringNBT.valueOf(ITextComponent.Serializer.toJson(new TranslationTextComponent("book.ironchest.dirtchest9000.page3"))));
|
||||
pages.add(StringNBT.valueOf(ITextComponent.Serializer.toJson(new TranslationTextComponent("book.ironchest.dirtchest9000.page4"))));
|
||||
pages.add(StringNBT.valueOf(ITextComponent.Serializer.toJson(new TranslationTextComponent("book.ironchest.dirtchest9000.page5"))));
|
||||
|
||||
dirtChest9000GuideBook.setTagInfo("pages", pages);
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.progwml6.ironchest.common.block.tileentity;
|
||||
|
||||
import com.progwml6.ironchest.IronChests;
|
||||
import com.progwml6.ironchest.common.block.GenericIronChestBlock;
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.inventory.IronChestContainer;
|
||||
|
@ -71,7 +72,7 @@ public class GenericIronChestTileEntity extends LockableLootTileEntity implement
|
|||
|
||||
@Override
|
||||
protected ITextComponent getDefaultName() {
|
||||
return new TranslationTextComponent("container.chest");
|
||||
return new TranslationTextComponent(IronChests.MODID + ".container."+ this.chestType.getId() + "chest");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -250,10 +251,10 @@ public class GenericIronChestTileEntity extends LockableLootTileEntity implement
|
|||
IronChestsTypes type = IronChestsTypes.IRON;
|
||||
|
||||
if (this.hasWorld()) {
|
||||
IronChestsTypes typeNew = GenericIronChestBlock.getTypeFromBlock(this.getBlockState().getBlock());
|
||||
IronChestsTypes typeFromBlock = GenericIronChestBlock.getTypeFromBlock(this.getBlockState().getBlock());
|
||||
|
||||
if (typeNew != null) {
|
||||
type = typeNew;
|
||||
if (typeFromBlock != null) {
|
||||
type = typeFromBlock;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,160 @@
|
|||
package com.progwml6.ironchest.common.item;
|
||||
|
||||
import com.progwml6.ironchest.common.block.GenericIronChestBlock;
|
||||
import com.progwml6.ironchest.common.block.IronChestsTypes;
|
||||
import com.progwml6.ironchest.common.block.tileentity.GenericIronChestTileEntity;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.ChestBlock;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.tileentity.ChestTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ChestUpgradeItem extends Item {
|
||||
|
||||
private final IronChestsUpgradeType type;
|
||||
|
||||
public ChestUpgradeItem(IronChestsUpgradeType type, Properties properties) {
|
||||
super(properties);
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
|
||||
super.addInformation(stack, worldIn, tooltip, flagIn);
|
||||
//tooltip.add(new TranslationTextComponent(this.getTranslationKey() + ".desc").applyTextStyle(TextFormatting.GRAY));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onItemUseFirst(ItemStack stack, ItemUseContext context) {
|
||||
PlayerEntity entityPlayer = context.getPlayer();
|
||||
BlockPos blockPos = context.getPos();
|
||||
World world = context.getWorld();
|
||||
ItemStack itemStack = context.getItem();
|
||||
|
||||
if (world.isRemote) {
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
if (entityPlayer == null) {
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
if (this.type.canUpgrade(IronChestsTypes.WOOD)) {
|
||||
if (!(world.getBlockState(blockPos).getBlock() instanceof ChestBlock)) {
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (world.getBlockState(blockPos).getBlock().getDefaultState() != IronChestsTypes.get(this.type.source).getDefaultState()) {
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
}
|
||||
|
||||
TileEntity tileEntity = world.getTileEntity(blockPos);
|
||||
|
||||
if (this.type.canUpgrade(IronChestsTypes.WOOD)) {
|
||||
if (!(tileEntity instanceof ChestTileEntity)) {
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
}
|
||||
|
||||
GenericIronChestTileEntity newChest = null;
|
||||
ITextComponent customName = null;
|
||||
NonNullList<ItemStack> chestContents = NonNullList.withSize(27, ItemStack.EMPTY);
|
||||
Direction chestFacing = Direction.NORTH;
|
||||
|
||||
if (tileEntity != null) {
|
||||
if (tileEntity instanceof GenericIronChestTileEntity) {
|
||||
GenericIronChestTileEntity chest = (GenericIronChestTileEntity) tileEntity;
|
||||
BlockState chestState = world.getBlockState(blockPos);
|
||||
|
||||
if (GenericIronChestTileEntity.getPlayersUsing(world, blockPos) > 0) {
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
if (!chest.canOpen(entityPlayer)) {
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
chestContents = chest.getItems();
|
||||
chestFacing = chestState.get(GenericIronChestBlock.FACING);
|
||||
customName = chest.getCustomName();
|
||||
newChest = this.type.target.makeEntity();
|
||||
|
||||
if (newChest == null) {
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
}
|
||||
else if (tileEntity instanceof ChestTileEntity) {
|
||||
BlockState chestState = world.getBlockState(blockPos);
|
||||
chestFacing = chestState.get(ChestBlock.FACING);
|
||||
ChestTileEntity chest = (ChestTileEntity) tileEntity;
|
||||
|
||||
if (ChestTileEntity.getPlayersUsing(world, blockPos) > 0) {
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
if (!chest.canOpen(entityPlayer)) {
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
if (!this.type.canUpgrade(IronChestsTypes.WOOD)) {
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
chestContents = NonNullList.withSize(chest.getSizeInventory(), ItemStack.EMPTY);
|
||||
|
||||
for (int slot = 0; slot < chestContents.size(); slot++) {
|
||||
chestContents.set(slot, chest.getStackInSlot(slot));
|
||||
}
|
||||
|
||||
customName = chest.getCustomName();
|
||||
|
||||
newChest = this.type.target.makeEntity();
|
||||
}
|
||||
}
|
||||
|
||||
tileEntity.updateContainingBlockInfo();
|
||||
|
||||
world.removeTileEntity(blockPos);
|
||||
world.removeBlock(blockPos, false);
|
||||
|
||||
BlockState iBlockState = IronChestsTypes.get(this.type.target).getDefaultState().with(GenericIronChestBlock.FACING, chestFacing);
|
||||
|
||||
world.setBlockState(blockPos, iBlockState, 3);
|
||||
world.setTileEntity(blockPos, newChest);
|
||||
|
||||
world.notifyBlockUpdate(blockPos, iBlockState, iBlockState, 3);
|
||||
|
||||
TileEntity tileEntity2 = world.getTileEntity(blockPos);
|
||||
|
||||
if (tileEntity2 instanceof GenericIronChestTileEntity) {
|
||||
if (customName != null) {
|
||||
((GenericIronChestTileEntity) tileEntity2).setCustomName(customName);
|
||||
}
|
||||
|
||||
((GenericIronChestTileEntity) tileEntity2).setItems(chestContents);
|
||||
}
|
||||
|
||||
if (!entityPlayer.abilities.isCreativeMode) {
|
||||
itemStack.shrink(1);
|
||||
}
|
||||
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,11 +1,27 @@
|
|||
package com.progwml6.ironchest.common.item;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.progwml6.ironchest.IronChests;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.fml.RegistryObject;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class IronChestsItems {
|
||||
|
||||
public static final DeferredRegister<Item> ITEMS = new DeferredRegister<>(ForgeRegistries.ITEMS, IronChests.MODID);
|
||||
|
||||
public static final ImmutableMap<IronChestsUpgradeType, RegistryObject<ChestUpgradeItem>> UPGRADES = ImmutableMap.copyOf(Arrays.stream(IronChestsUpgradeType.values())
|
||||
.collect(Collectors.toMap(Function.identity(), type -> register(type.name().toLowerCase(Locale.ROOT) + "_chest_upgrade",
|
||||
() -> new ChestUpgradeItem(type, new Item.Properties().group(IronChests.IRONCHESTS_ITEM_GROUP).maxStackSize(1))))));
|
||||
|
||||
private static <T extends Item> RegistryObject<T> register(final String name, final Supplier<T> sup) {
|
||||
return ITEMS.register(name, sup);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
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.SILVER;
|
||||
import static com.progwml6.ironchest.common.block.IronChestsTypes.WOOD;
|
||||
|
||||
public enum IronChestsUpgradeType {
|
||||
|
||||
IRON_TO_GOLD(IRON, GOLD),
|
||||
GOLD_TO_DIAMOND(GOLD, DIAMOND),
|
||||
COPPER_TO_SILVER(COPPER, SILVER),
|
||||
SILVER_TO_GOLD(SILVER, GOLD),
|
||||
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;
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
public net.minecraft.entity.ai.goal.GoalSelector field_220892_d # goals
|
|
@ -10,15 +10,15 @@
|
|||
"block.ironchest.dirt_chest": "DirtChest 9000!",
|
||||
|
||||
"_comment": "Upgrades",
|
||||
"item.ironchest.iron_gold_chest_upgrade": "Iron to Gold Chest Upgrade",
|
||||
"item.ironchest.gold_diamond_chest_upgrade": "Gold to Diamond Chest Upgrade",
|
||||
"item.ironchest.copper_silver_chest_upgrade": "Copper to Silver Chest Upgrade",
|
||||
"item.ironchest.silver_gold_chest_upgrade": "Silver to Gold Chest Upgrade",
|
||||
"item.ironchest.copper_iron_chest_upgrade": "Copper to Iron Chest Upgrade",
|
||||
"item.ironchest.diamond_crystal_chest_upgrade": "Diamond to Crystal Chest Upgrade",
|
||||
"item.ironchest.wood_iron_chest_upgrade": "Wood to Iron Chest Upgrade",
|
||||
"item.ironchest.wood_copper_chest_upgrade": "Wood to Copper Chest Upgrade",
|
||||
"item.ironchest.diamond_obsidian_chest_upgrade": "Diamond to Obsidian Chest Upgrade",
|
||||
"item.ironchest.iron_to_gold_chest_upgrade": "Iron to Gold Chest Upgrade",
|
||||
"item.ironchest.gold_to_diamond_chest_upgrade": "Gold to Diamond Chest Upgrade",
|
||||
"item.ironchest.copper_to_silver_chest_upgrade": "Copper to Silver Chest Upgrade",
|
||||
"item.ironchest.silver_to_gold_chest_upgrade": "Silver to Gold Chest Upgrade",
|
||||
"item.ironchest.copper_to_iron_chest_upgrade": "Copper to Iron Chest Upgrade",
|
||||
"item.ironchest.diamond_to_crystal_chest_upgrade": "Diamond to Crystal Chest Upgrade",
|
||||
"item.ironchest.wood_to_iron_chest_upgrade": "Wood to Iron Chest Upgrade",
|
||||
"item.ironchest.wood_to_copper_chest_upgrade": "Wood to Copper Chest Upgrade",
|
||||
"item.ironchest.diamond_to_obsidian_chest_upgrade": "Diamond to Obsidian Chest Upgrade",
|
||||
|
||||
"_comment": "Books",
|
||||
"book.ironchest.dirtchest9000.title": "How to use your DirtChest 9000!",
|
||||
|
|
|
@ -10,15 +10,15 @@
|
|||
"block.ironchest.dirt_chest": "흙 상자 9000!",
|
||||
|
||||
"_comment": "Upgrades",
|
||||
"item.ironchest.iron_gold_chest_upgrade": "철 상자를 금 상자로 업그레이드",
|
||||
"item.ironchest.gold_diamond_chest_upgrade": "금 상자를 다이아몬드 상자로 업그레이드",
|
||||
"item.ironchest.copper_silver_chest_upgrade": "구리 상자를 은 상자로 업그레이드",
|
||||
"item.ironchest.silver_gold_chest_upgrade": "은 상자를 금 상자로 업그레이드",
|
||||
"item.ironchest.copper_iron_chest_upgrade": "구리 상자를 철 상자로 업그레이드",
|
||||
"item.ironchest.diamond_crystal_chest_upgrade": "다이아몬드 상자를 수정 상자로 업그레이드",
|
||||
"item.ironchest.wood_iron_chest_upgrade": "나무 상자를 철 상자로 업그레이드",
|
||||
"item.ironchest.wood_copper_chest_upgrade": "나무 상자를 구리 상자로 업그레이드",
|
||||
"item.ironchest.diamond_obsidian_chest_upgrade": "다이아몬드 상자를 흑요석 상자로 업그레이드",
|
||||
"item.ironchest.iron_to_gold_chest_upgrade": "철 상자를 금 상자로 업그레이드",
|
||||
"item.ironchest.gold_to_diamond_chest_upgrade": "금 상자를 다이아몬드 상자로 업그레이드",
|
||||
"item.ironchest.copper_to_silver_chest_upgrade": "구리 상자를 은 상자로 업그레이드",
|
||||
"item.ironchest.silver_to_gold_chest_upgrade": "은 상자를 금 상자로 업그레이드",
|
||||
"item.ironchest.copper_to_iron_chest_upgrade": "구리 상자를 철 상자로 업그레이드",
|
||||
"item.ironchest.diamond_to_crystal_chest_upgrade": "다이아몬드 상자를 수정 상자로 업그레이드",
|
||||
"item.ironchest.wood_to_iron_chest_upgrade": "나무 상자를 철 상자로 업그레이드",
|
||||
"item.ironchest.wood_to_copper_chest_upgrade": "나무 상자를 구리 상자로 업그레이드",
|
||||
"item.ironchest.diamond_to_obsidian_chest_upgrade": "다이아몬드 상자를 흑요석 상자로 업그레이드",
|
||||
|
||||
"_comment": "Books",
|
||||
"book.ironchest.dirtchest9000.title": "흙 상자 9000을 사용하는 방법!",
|
||||
|
|
|
@ -10,15 +10,15 @@
|
|||
"block.ironchest.dirt_chest": "DirtChest 9000!",
|
||||
|
||||
"_comment": "Upgrades",
|
||||
"item.ironchest.iron_gold_chest_upgrade": "Ulepszenie żelaznej skrzyni na złotą",
|
||||
"item.ironchest.gold_diamond_chest_upgrade": "Ulepszenie złotej skrzyni na diamentową",
|
||||
"item.ironchest.copper_silver_chest_upgrade": "Ulepszenie miedzianej skrzyni na srebrną",
|
||||
"item.ironchest.silver_gold_chest_upgrade": "Ulepszenie srebrnej skrzyni na złotą",
|
||||
"item.ironchest.copper_iron_chest_upgrade": "Ulepszenie miedzianej skrzyni na żelazną",
|
||||
"item.ironchest.diamond_crystal_chest_upgrade": "Ulepszenie diamentowej skrzyni na kryształową",
|
||||
"item.ironchest.wood_iron_chest_upgrade": "Ulepszenie drewnianej skrzyni na żelazną",
|
||||
"item.ironchest.wood_copper_chest_upgrade": "Ulepszenie drewnianej skrzyni na miedzianą",
|
||||
"item.ironchest.diamond_obsidian_chest_upgrade": "Ulepszenie diamentowej skrzyni na obsydianową",
|
||||
"item.ironchest.iron_to_gold_chest_upgrade": "Ulepszenie żelaznej skrzyni na złotą",
|
||||
"item.ironchest.gold_to_diamond_chest_upgrade": "Ulepszenie złotej skrzyni na diamentową",
|
||||
"item.ironchest.copper_to_silver_chest_upgrade": "Ulepszenie miedzianej skrzyni na srebrną",
|
||||
"item.ironchest.silver_to_gold_chest_upgrade": "Ulepszenie srebrnej skrzyni na złotą",
|
||||
"item.ironchest.copper_to_iron_chest_upgrade": "Ulepszenie miedzianej skrzyni na żelazną",
|
||||
"item.ironchest.diamond_to_crystal_chest_upgrade": "Ulepszenie diamentowej skrzyni na kryształową",
|
||||
"item.ironchest.wood_to_iron_chest_upgrade": "Ulepszenie drewnianej skrzyni na żelazną",
|
||||
"item.ironchest.wood_to_copper_chest_upgrade": "Ulepszenie drewnianej skrzyni na miedzianą",
|
||||
"item.ironchest.diamond_to_obsidian_chest_upgrade": "Ulepszenie diamentowej skrzyni na obsydianową",
|
||||
|
||||
"_comment": "Books",
|
||||
"book.ironchest.dirtchest9000.title": "How to use your DirtChest 9000!",
|
||||
|
|
|
@ -10,15 +10,15 @@
|
|||
"block.ironchest.dirt_chest": "泥箱子9000!",
|
||||
|
||||
"_comment": "Upgrades",
|
||||
"item.ironchest.iron_gold_chest_upgrade": "升级:铁>金",
|
||||
"item.ironchest.gold_diamond_chest_upgrade": "升级:金>钻石",
|
||||
"item.ironchest.copper_silver_chest_upgrade": "升级:铜>银",
|
||||
"item.ironchest.silver_gold_chest_upgrade": "升级:银>金",
|
||||
"item.ironchest.copper_iron_chest_upgrade": "升级:铜>铁",
|
||||
"item.ironchest.diamond_crystal_chest_upgrade": "升级:钻石>水晶",
|
||||
"item.ironchest.wood_iron_chest_upgrade": "升级:木>铁",
|
||||
"item.ironchest.wood_copper_chest_upgrade": "升级:木>铜",
|
||||
"item.ironchest.diamond_obsidian_chest_upgrade": "升级:钻石>黑曜石",
|
||||
"item.ironchest.iron_to_gold_chest_upgrade": "升级:铁>金",
|
||||
"item.ironchest.gold_to_diamond_chest_upgrade": "升级:金>钻石",
|
||||
"item.ironchest.copper_to_silver_chest_upgrade": "升级:铜>银",
|
||||
"item.ironchest.silver_to_gold_chest_upgrade": "升级:银>金",
|
||||
"item.ironchest.copper_to_iron_chest_upgrade": "升级:铜>铁",
|
||||
"item.ironchest.diamond_to_crystal_chest_upgrade": "升级:钻石>水晶",
|
||||
"item.ironchest.wood_to_iron_chest_upgrade": "升级:木>铁",
|
||||
"item.ironchest.wood_to_copper_chest_upgrade": "升级:木>铜",
|
||||
"item.ironchest.diamond_to_obsidian_chest_upgrade": "升级:钻石>黑曜石",
|
||||
|
||||
"_comment": "Books",
|
||||
"book.ironchest.dirtchest9000.title": "傻瓜也一定会用的泥箱子9000!",
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
]
|
||||
},
|
||||
"result": {
|
||||
"item": "ironchest:copper_iron_chest_upgrade"
|
||||
"item": "ironchest:copper_to_iron_chest_upgrade"
|
||||
},
|
||||
"_comment": "replaceme with tag forge:glass when out."
|
||||
}
|
|
@ -14,6 +14,6 @@
|
|||
}
|
||||
},
|
||||
"result": {
|
||||
"item": "ironchest:copper_silver_chest_upgrade"
|
||||
"item": "ironchest:copper_to_silver_chest_upgrade"
|
||||
}
|
||||
}
|
|
@ -64,7 +64,7 @@
|
|||
]
|
||||
},
|
||||
"result": {
|
||||
"item": "ironchest:diamond_crystal_chest_upgrade"
|
||||
"item": "ironchest:diamond_to_crystal_chest_upgrade"
|
||||
},
|
||||
"_comment": "replaceme with tag forge:glass when out."
|
||||
}
|
|
@ -64,7 +64,7 @@
|
|||
]
|
||||
},
|
||||
"result": {
|
||||
"item": "ironchest:diamond_obsidian_chest_upgrade"
|
||||
"item": "ironchest:diamond_to_obsidian_chest_upgrade"
|
||||
},
|
||||
"_comment": "replaceme with tag forge:glass when out."
|
||||
}
|
|
@ -67,7 +67,7 @@
|
|||
]
|
||||
},
|
||||
"result": {
|
||||
"item": "ironchest:gold_diamond_chest_upgrade"
|
||||
"item": "ironchest:gold_to_diamond_chest_upgrade"
|
||||
},
|
||||
"_comment": "replaceme with tag forge:glass when out."
|
||||
}
|
|
@ -14,6 +14,6 @@
|
|||
}
|
||||
},
|
||||
"result": {
|
||||
"item": "ironchest:iron_gold_chest_upgrade"
|
||||
"item": "ironchest:iron_to_gold_chest_upgrade"
|
||||
}
|
||||
}
|
|
@ -67,7 +67,7 @@
|
|||
]
|
||||
},
|
||||
"result": {
|
||||
"item": "ironchest:silver_gold_chest_upgrade"
|
||||
"item": "ironchest:silver_to_gold_chest_upgrade"
|
||||
},
|
||||
"_comment": "replaceme with tag forge:glass when out."
|
||||
}
|
|
@ -14,6 +14,6 @@
|
|||
}
|
||||
},
|
||||
"result": {
|
||||
"item": "ironchest:wood_copper_chest_upgrade"
|
||||
"item": "ironchest:wood_to_copper_chest_upgrade"
|
||||
}
|
||||
}
|
|
@ -14,6 +14,6 @@
|
|||
}
|
||||
},
|
||||
"result": {
|
||||
"item": "ironchest:wood_iron_chest_upgrade"
|
||||
"item": "ironchest:wood_to_iron_chest_upgrade"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue