diff options
| author | bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> | 2019-12-11 22:43:49 +0100 |
|---|---|---|
| committer | bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> | 2019-12-11 22:43:49 +0100 |
| commit | 1a184abb892c4b9a83c7b89d59fcd3206ca7378e (patch) | |
| tree | edfaf3a8a46c7cb3bd2630b89eb5a4892fecf811 /src/main/java | |
| parent | f87ba14311de8c8d9d34858b311a43c268bb4dfe (diff) | |
| download | GT5-Unofficial-1a184abb892c4b9a83c7b89d59fcd3206ca7378e.tar.gz GT5-Unofficial-1a184abb892c4b9a83c7b89d59fcd3206ca7378e.tar.bz2 GT5-Unofficial-1a184abb892c4b9a83c7b89d59fcd3206ca7378e.zip | |
added fully automated Werkstoff Blocks
+ added recipes for the blocks
+ version increase
Signed-off-by: bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com>
Former-commit-id: dec9f6907e8c91cff240f6a9141c3531ceccea62
Diffstat (limited to 'src/main/java')
15 files changed, 386 insertions, 157 deletions
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/client/renderer/BW_Renderer_Block_Ores.java b/src/main/java/com/github/bartimaeusnek/bartworks/client/renderer/BW_Renderer_Block_Ores.java index 7146293456..5418587508 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/client/renderer/BW_Renderer_Block_Ores.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/client/renderer/BW_Renderer_Block_Ores.java @@ -22,9 +22,8 @@ package com.github.bartimaeusnek.bartworks.client.renderer; -import com.github.bartimaeusnek.bartworks.system.material.BW_MetaGeneratedOreTE; -import com.github.bartimaeusnek.bartworks.system.material.BW_MetaGeneratedSmallOreTE; -import com.github.bartimaeusnek.bartworks.system.material.BW_MetaGenerated_SmallOres; +import com.github.bartimaeusnek.bartworks.system.material.BW_MetaGenerated_Block_TE; +import com.github.bartimaeusnek.bartworks.system.material.BW_MetaGenerated_Blocks; import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import cpw.mods.fml.client.registry.RenderingRegistry; import net.minecraft.block.Block; @@ -41,7 +40,7 @@ public class BW_Renderer_Block_Ores implements ISimpleBlockRenderingHandler { @Override public void renderInventoryBlock(Block aBlock, int aMeta, int modelId, RenderBlocks aRenderer) { - BW_MetaGeneratedOreTE tTileEntity = aBlock instanceof BW_MetaGenerated_SmallOres ? new BW_MetaGeneratedSmallOreTE() : new BW_MetaGeneratedOreTE(); + BW_MetaGenerated_Block_TE tTileEntity = ((BW_MetaGenerated_Blocks)aBlock).getProperTileEntityForRendering(); tTileEntity.mMetaData = (short) aMeta; aBlock.setBlockBoundsForItemRender(); aRenderer.setRenderBoundsFromBlock(aBlock); diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/blocks/BW_TileEntityContainer.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/blocks/BW_TileEntityContainer.java index 4fb77d6671..b1aeb18a54 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/blocks/BW_TileEntityContainer.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/blocks/BW_TileEntityContainer.java @@ -53,7 +53,7 @@ import net.minecraftforge.fluids.IFluidContainerItem; public class BW_TileEntityContainer extends BlockContainer implements ITileAddsInformation { - Class<? extends TileEntity> tileEntity; + protected Class<? extends TileEntity> tileEntity; public BW_TileEntityContainer(Material p_i45386_1_, Class<? extends TileEntity> tileEntity, String blockName) { super(p_i45386_1_); diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/net/BW_Network.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/net/BW_Network.java index 7c6ba97d67..b22bd115fd 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/net/BW_Network.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/net/BW_Network.java @@ -59,7 +59,7 @@ public class BW_Network extends MessageToMessageCodec<FMLProxyPacket, GT_Packet> public BW_Network() { this.mChannel = NetworkRegistry.INSTANCE.newChannel("BartWorks", this, new BW_Network.HandlerShared()); - this.mSubChannels = new GT_Packet[]{new RendererPacket(), new CircuitProgrammerPacket(), new OrePacket(), new OreDictCachePacket(), new ServerJoinedPackage()}; + this.mSubChannels = new GT_Packet[]{new RendererPacket(), new CircuitProgrammerPacket(), new MetaBlockPacket(), new OreDictCachePacket(), new ServerJoinedPackage()}; } protected void encode(ChannelHandlerContext aContext, GT_Packet aPacket, List<Object> aOutput) throws Exception { diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/net/OrePacket.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/net/MetaBlockPacket.java index 75d5cddc30..7d083bdaec 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/net/OrePacket.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/net/MetaBlockPacket.java @@ -23,7 +23,7 @@ package com.github.bartimaeusnek.bartworks.common.net; import com.github.bartimaeusnek.bartworks.MainMod; -import com.github.bartimaeusnek.bartworks.system.material.BW_MetaGeneratedOreTE; +import com.github.bartimaeusnek.bartworks.system.material.BW_MetaGenerated_Block_TE; import com.github.bartimaeusnek.bartworks.util.MurmurHash3; import com.google.common.io.ByteArrayDataInput; import gregtech.api.net.GT_Packet; @@ -33,14 +33,14 @@ import net.minecraft.world.World; import java.nio.ByteBuffer; -public class OrePacket extends GT_Packet { +public class MetaBlockPacket extends GT_Packet { int x; short y; int z; short meta; - public OrePacket(int x, int y, int z, int meta) { + public MetaBlockPacket(int x, int y, int z, int meta) { super(false); this.x = x; this.y = (short) y; @@ -48,7 +48,7 @@ public class OrePacket extends GT_Packet { this.meta = (short) meta; } - public OrePacket() { + public MetaBlockPacket() { super(true); } @@ -72,7 +72,7 @@ public class OrePacket extends GT_Packet { this.z = buff.getInt(); this.y = buff.getShort(); this.meta = buff.getShort(); - OrePacket todecode = new OrePacket(this.x, this.y, this.z, this.meta); + MetaBlockPacket todecode = new MetaBlockPacket(this.x, this.y, this.z, this.meta); if (buff.getInt() != MurmurHash3.murmurhash3_x86_32(ByteBuffer.allocate(12).putInt(this.x).putInt(this.z).putShort(this.y).putShort(this.meta).array(), 0, 12, 31)) { MainMod.LOGGER.error("PACKET HASH DOES NOT MATCH!"); return null; @@ -84,8 +84,8 @@ public class OrePacket extends GT_Packet { public void process(IBlockAccess iBlockAccess) { if (iBlockAccess != null) { TileEntity tTileEntity = iBlockAccess.getTileEntity(this.x, this.y, this.z); - if ((tTileEntity instanceof BW_MetaGeneratedOreTE)) { - ((BW_MetaGeneratedOreTE) tTileEntity).mMetaData = this.meta; + if ((tTileEntity instanceof BW_MetaGenerated_Block_TE)) { + ((BW_MetaGenerated_Block_TE) tTileEntity).mMetaData = this.meta; } if (((iBlockAccess instanceof World)) && (((World) iBlockAccess).isRemote)) { ((World) iBlockAccess).markBlockForUpdate(this.x, this.y, this.z); diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGeneratedOre_Item.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGeneratedBlock_Item.java index 90c30d1adf..d50511337d 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGeneratedOre_Item.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGeneratedBlock_Item.java @@ -35,9 +35,9 @@ import net.minecraft.world.World; import java.util.ArrayList; import java.util.List; -public class BW_MetaGeneratedOre_Item extends BW_ItemBlocks { +public class BW_MetaGeneratedBlock_Item extends BW_ItemBlocks { - public BW_MetaGeneratedOre_Item(Block par1) { + public BW_MetaGeneratedBlock_Item(Block par1) { super(par1); } @@ -70,7 +70,7 @@ public class BW_MetaGeneratedOre_Item extends BW_ItemBlocks { if (!aWorld.setBlock(aX, aY, aZ, this.field_150939_a, tDamage, 3)) { return false; } - BW_MetaGeneratedOreTE tTileEntity = (BW_MetaGeneratedOreTE) aWorld.getTileEntity(aX, aY, aZ); + BW_MetaGenerated_Block_TE tTileEntity = (BW_MetaGenerated_Block_TE) aWorld.getTileEntity(aX, aY, aZ); tTileEntity.mMetaData = tDamage; } else if (!aWorld.setBlock(aX, aY, aZ, this.field_150939_a, 0, 3)) { return false; diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGeneratedOreTE.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGeneratedOreTE.java index 5d876b3986..5a5539b3f4 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGeneratedOreTE.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGeneratedOreTE.java @@ -22,69 +22,14 @@ package com.github.bartimaeusnek.bartworks.system.material; -import com.github.bartimaeusnek.bartworks.common.net.OrePacket; -import com.github.bartimaeusnek.bartworks.util.Coords; import gregtech.api.enums.OrePrefixes; import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.tileentity.ITexturedTileEntity; import gregtech.api.objects.GT_CopiedBlockTexture; import gregtech.api.objects.GT_RenderedTexture; import net.minecraft.block.Block; import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.Packet; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import java.util.ArrayList; - -import static com.github.bartimaeusnek.bartworks.MainMod.BW_Network_instance; - -public class BW_MetaGeneratedOreTE extends TileEntity implements ITexturedTileEntity { - - public short mMetaData; - - public static boolean placeOre(World aWorld, Coords coords, Werkstoff werkstoff) { - short meta = werkstoff.getmID(); - aWorld.setBlock(coords.x, coords.y, coords.z, WerkstoffLoader.BWOres, 0, 0); - TileEntity tTileEntity = aWorld.getTileEntity(coords.x, coords.y, coords.z); - if ((tTileEntity instanceof BW_MetaGeneratedOreTE)) { - ((BW_MetaGeneratedOreTE) tTileEntity).mMetaData = meta; - } - return true; - } - - public boolean canUpdate() { - return false; - } - - public void readFromNBT(NBTTagCompound aNBT) { - super.readFromNBT(aNBT); - this.mMetaData = aNBT.getShort("m"); - } - - public void writeToNBT(NBTTagCompound aNBT) { - super.writeToNBT(aNBT); - aNBT.setShort("m", this.mMetaData); - } - - public ArrayList<ItemStack> getDrops(Block aDroppedOre, int aFortune) { - ArrayList<ItemStack> rList = new ArrayList<>(); - if (this.mMetaData < 0) { - rList.add(new ItemStack(Blocks.cobblestone, 1, 0)); - return rList; - } - rList.add(new ItemStack(aDroppedOre, 1, this.mMetaData)); - return rList; - } - - @Override - public Packet getDescriptionPacket() { - if (!this.worldObj.isRemote) - BW_Network_instance.sendPacketToAllPlayersInRange(this.worldObj, new OrePacket(this.xCoord, (short) this.yCoord, this.zCoord, this.mMetaData), this.xCoord, this.zCoord); - return null; - } +public class BW_MetaGeneratedOreTE extends BW_MetaGenerated_Block_TE { @Override public ITexture[] getTexture(Block aBlock, byte aSide) { @@ -95,4 +40,9 @@ public class BW_MetaGeneratedOreTE extends TileEntity implements ITexturedTileEn } return new ITexture[]{new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_RenderedTexture(gregtech.api.enums.TextureSet.SET_NONE.mTextures[OrePrefixes.ore.mTextureIndex])}; } + + @Override + protected Block GetProperBlock() { + return WerkstoffLoader.BWOres; + } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGeneratedSmallOreTE.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGeneratedSmallOreTE.java index 849126df83..80126f39f4 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGeneratedSmallOreTE.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGeneratedSmallOreTE.java @@ -39,7 +39,7 @@ import java.util.Random; public class BW_MetaGeneratedSmallOreTE extends BW_MetaGeneratedOreTE { - public ArrayList<ItemStack> getDrops(Block aDroppedOre, int aFortune) { + public ArrayList<ItemStack> getDrops(int aFortune) { ArrayList<ItemStack> rList = new ArrayList<>(); Materials aMaterial = Werkstoff.werkstoffHashMap.get(this.mMetaData).getBridgeMaterial(); @@ -113,4 +113,9 @@ public class BW_MetaGeneratedSmallOreTE extends BW_MetaGeneratedOreTE { } return new ITexture[]{new GT_CopiedBlockTexture(Blocks.stone, 0, 0), new GT_RenderedTexture(gregtech.api.enums.TextureSet.SET_NONE.mTextures[OrePrefixes.oreSmall.mTextureIndex])}; } + + @Override + protected Block GetProperBlock() { + return WerkstoffLoader.BWSmallOres; + } } diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Block_TE.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Block_TE.java new file mode 100644 index 0000000000..7213816976 --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Block_TE.java @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2018-2019 bartimaeusnek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.github.bartimaeusnek.bartworks.system.material; + +import com.github.bartimaeusnek.bartworks.common.net.MetaBlockPacket; +import gregtech.api.interfaces.tileentity.ITexturedTileEntity; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.Packet; +import net.minecraft.tileentity.TileEntity; + +import java.util.ArrayList; + +import static com.github.bartimaeusnek.bartworks.MainMod.BW_Network_instance; + +public abstract class BW_MetaGenerated_Block_TE extends TileEntity implements ITexturedTileEntity { + + public short mMetaData; + + public boolean canUpdate() { + return false; + } + + public void readFromNBT(NBTTagCompound aNBT) { + super.readFromNBT(aNBT); + this.mMetaData = aNBT.getShort("m"); + } + + public void writeToNBT(NBTTagCompound aNBT) { + aNBT.setShort("m", this.mMetaData); + super.writeToNBT(aNBT); + } + + @Override + public Packet getDescriptionPacket() { + if (!this.worldObj.isRemote) + BW_Network_instance.sendPacketToAllPlayersInRange(this.worldObj, new MetaBlockPacket(this.xCoord, (short) this.yCoord, this.zCoord, this.mMetaData), this.xCoord, this.zCoord); + return null; + } + + protected abstract Block GetProperBlock(); + + public ArrayList<ItemStack> getDrops(int aFortune) { + ArrayList<ItemStack> rList = new ArrayList<>(); + if (this.mMetaData < 0) { + rList.add(new ItemStack(Blocks.cobblestone, 1, 0)); + return rList; + } + rList.add(new ItemStack(GetProperBlock(), 1, this.mMetaData)); + return rList; + } + +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Blocks.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Blocks.java new file mode 100644 index 0000000000..1b3a645e5c --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Blocks.java @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2018-2019 bartimaeusnek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.github.bartimaeusnek.bartworks.system.material; + +import com.github.bartimaeusnek.bartworks.client.renderer.BW_Renderer_Block_Ores; +import com.github.bartimaeusnek.bartworks.common.blocks.BW_TileEntityContainer; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.block.Block; +import net.minecraft.block.ITileEntityProvider; +import net.minecraft.block.material.Material; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +import java.util.ArrayList; + +import static com.github.bartimaeusnek.bartworks.system.material.BW_MetaGenerated_Items.metaTab; + +public abstract class BW_MetaGenerated_Blocks extends BW_TileEntityContainer { + + public static ThreadLocal<BW_MetaGenerated_Block_TE> mTemporaryTileEntity = new ThreadLocal<>(); + + public BW_MetaGenerated_Blocks(Material p_i45386_1_, Class<? extends TileEntity> tileEntity, String blockName) { + super(p_i45386_1_, tileEntity, blockName); + + this.setHardness(5.0F); + this.setResistance(5.0F); + this.setBlockTextureName("stone"); + this.setCreativeTab(metaTab); + for (Werkstoff w : Werkstoff.werkstoffHashSet) + doRegistrationStuff(w); + } + + @SideOnly(Side.CLIENT) + public final BW_MetaGenerated_Block_TE getProperTileEntityForRendering(){ + return (BW_MetaGenerated_Block_TE) createNewTileEntity(null,0); + } + + protected abstract void doRegistrationStuff(Werkstoff w); + + @Override + public String getHarvestTool(int metadata) { + return "pickaxe"; + } + + protected boolean canSilkHarvest() { + return false; + } + + public int getRenderType() { + if (BW_Renderer_Block_Ores.INSTANCE == null) { + return super.getRenderType(); + } + return BW_Renderer_Block_Ores.INSTANCE.mRenderID; + } + + public int getDamageValue(World aWorld, int aX, int aY, int aZ) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if (((tTileEntity instanceof BW_MetaGenerated_Block_TE))) { + return ((BW_MetaGenerated_Block_TE) tTileEntity).mMetaData; + } + return 0; + } + + @Override + public TileEntity createTileEntity(World world, int metadata) { + return ((ITileEntityProvider)this).createNewTileEntity(world, metadata); + } + + @Override + public boolean hasTileEntity(int metadata) { + return true; + } + + public void breakBlock(World world, int x, int y, int z, Block block, int meta) { + TileEntity tTileEntity = world.getTileEntity(x, y, z); + if ((tTileEntity instanceof BW_MetaGenerated_Block_TE)) { + mTemporaryTileEntity.set((BW_MetaGenerated_Block_TE) tTileEntity); + } + super.breakBlock(world, x, y, z, block, meta); + } + + public ArrayList<ItemStack> getDrops(World aWorld, int aX, int aY, int aZ, int aMeta, int aFortune) { + TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); + if ((tTileEntity instanceof BW_MetaGenerated_Block_TE)) { + return ((BW_MetaGenerated_Block_TE) tTileEntity).getDrops(aFortune); + } + return mTemporaryTileEntity.get() == null ? new ArrayList<>() : mTemporaryTileEntity.get().getDrops(aFortune); + } + +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Items.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Items.java index 57f6c319b6..268be7eddf 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Items.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Items.java @@ -68,7 +68,9 @@ public class BW_MetaGenerated_Items extends GT_MetaGenerated_Item implements IRa public Item getTabIconItem() { return new ItemStack(Blocks.iron_ore).getItem(); } + }; + protected final OrePrefixes orePrefixes; public BW_MetaGenerated_Items(OrePrefixes orePrefixes, Object unused){ diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Ores.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Ores.java index 9ac1b0f383..dc4bc47673 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Ores.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_Ores.java @@ -22,8 +22,6 @@ package com.github.bartimaeusnek.bartworks.system.material; -import com.github.bartimaeusnek.bartworks.client.renderer.BW_Renderer_Block_Ores; -import com.github.bartimaeusnek.bartworks.common.blocks.BW_TileEntityContainer; import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_ModHandler; @@ -35,29 +33,16 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; -import net.minecraft.util.StatCollector; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import static com.github.bartimaeusnek.bartworks.system.material.BW_MetaGenerated_Items.metaTab; - -public class BW_MetaGenerated_Ores extends BW_TileEntityContainer { - - public static ThreadLocal<BW_MetaGeneratedOreTE> mTemporaryTileEntity = new ThreadLocal<>(); +public class BW_MetaGenerated_Ores extends BW_MetaGenerated_Blocks { public BW_MetaGenerated_Ores(Material p_i45386_1_, Class<? extends TileEntity> tileEntity, String blockName) { super(p_i45386_1_, tileEntity, blockName); - - this.setHardness(5.0F); - this.setResistance(5.0F); - this.setBlockTextureName("stone"); - this.setCreativeTab(metaTab); - for (Werkstoff w : Werkstoff.werkstoffHashSet) - doRegistrationStuff(w); } protected void doRegistrationStuff(Werkstoff w){ @@ -98,10 +83,6 @@ public class BW_MetaGenerated_Ores extends BW_TileEntityContainer { } } - public String getLocalizedName() { - return StatCollector.translateToLocal(this.getUnlocalizedName() + ".name"); - } - @Override public IIcon getIcon(int side, int meta) { return Blocks.stone.getIcon(0, 0); @@ -112,46 +93,6 @@ public class BW_MetaGenerated_Ores extends BW_TileEntityContainer { return Blocks.stone.getIcon(0, 0); } - @Override - public String getHarvestTool(int metadata) { - return "pickaxe"; - } - - protected boolean canSilkHarvest() { - return false; - } - - public int getRenderType() { - if (BW_Renderer_Block_Ores.INSTANCE == null) { - return super.getRenderType(); - } - return BW_Renderer_Block_Ores.INSTANCE.mRenderID; - } - - public int getDamageValue(World aWorld, int aX, int aY, int aZ) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if (((tTileEntity instanceof BW_MetaGeneratedOreTE))) { - return ((BW_MetaGeneratedOreTE) tTileEntity).mMetaData; - } - return 0; - } - - public void breakBlock(World world, int x, int y, int z, Block block, int meta) { - TileEntity tTileEntity = world.getTileEntity(x, y, z); - if ((tTileEntity instanceof BW_MetaGeneratedOreTE)) { - BW_MetaGenerated_Ores.mTemporaryTileEntity.set((BW_MetaGeneratedOreTE) tTileEntity); - } - super.breakBlock(world, x, y, z, block, meta); - } - - public ArrayList<ItemStack> getDrops(World aWorld, int aX, int aY, int aZ, int aMeta, int aFortune) { - TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); - if ((tTileEntity instanceof BW_MetaGeneratedOreTE)) { - return ((BW_MetaGeneratedOreTE) tTileEntity).getDrops(WerkstoffLoader.BWOres,aFortune); - } - return BW_MetaGenerated_Ores.mTemporaryTileEntity.get() == null ? new ArrayList<>() : BW_MetaGenerated_Ores.mTemporaryTileEntity.get().getDrops(WerkstoffLoader.BWOres,aFortune); - } - public int getHarvestLevel(int metadata) { return 3; } @@ -171,17 +112,6 @@ public class BW_MetaGenerated_Ores extends BW_TileEntityContainer { } } -// @Override -// public void onNeighborBlockChange(World aWorld, int aX, int aY, int aZ, Block p_149695_5_) { -// if ((!aWorld.isRemote || this.checkForAir(aWorld,aX,aY,aZ)) && aWorld.getTileEntity(aX, aY, aZ) instanceof BW_MetaGeneratedOreTE) -// ((BW_MetaGeneratedOreTE)aWorld.getTileEntity(aX, aY, aZ)).sendPacket(); -// } -// -// @Override -// public void onNeighborChange(IBlockAccess aWorld, int aX, int aY, int aZ, int tileX, int tileY, int tileZ) { -// if ((FMLCommonHandler.instance().getEffectiveSide().isServer() || this.checkForAir(aWorld,aX,aY,aZ)) && aWorld.getTileEntity(aX, aY, aZ) instanceof BW_MetaGeneratedOreTE) -// ((BW_MetaGeneratedOreTE)aWorld.getTileEntity(aX, aY, aZ)).sendPacket(); -// } @SuppressWarnings("unused") private boolean checkForAir(IBlockAccess aWorld, int aX, int aY, int aZ){ for (int x = -1; x <= 1; x++) { diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_WerkstoffBlock_TE.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_WerkstoffBlock_TE.java new file mode 100644 index 0000000000..632c3e034f --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_WerkstoffBlock_TE.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2018-2019 bartimaeusnek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.github.bartimaeusnek.bartworks.system.material; + +import gregtech.api.enums.OrePrefixes; +import gregtech.api.interfaces.ITexture; +import gregtech.api.objects.GT_CopiedBlockTexture; +import gregtech.api.objects.GT_RenderedTexture; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; + +public class BW_MetaGenerated_WerkstoffBlock_TE extends BW_MetaGenerated_Block_TE { + + @Override + public ITexture[] getTexture(Block aBlock, byte aSide) { + Werkstoff aMaterial = Werkstoff.werkstoffHashMap.get(this.mMetaData); + if ((aMaterial != null)) { + GT_RenderedTexture aIconSet = new GT_RenderedTexture(aMaterial.getTexSet().mTextures[OrePrefixes.block.mTextureIndex], aMaterial.getRGBA()); + return new ITexture[]{new GT_CopiedBlockTexture(Blocks.iron_block, 0, 0), aIconSet}; + } + return new ITexture[]{new GT_CopiedBlockTexture(Blocks.iron_block, 0, 0), new GT_RenderedTexture(gregtech.api.enums.TextureSet.SET_NONE.mTextures[OrePrefixes.block.mTextureIndex])}; + } + + @Override + protected Block GetProperBlock() { + return WerkstoffLoader.BWBlocks; + } +} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_WerkstoffBlocks.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_WerkstoffBlocks.java new file mode 100644 index 0000000000..382163ae8b --- /dev/null +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/material/BW_MetaGenerated_WerkstoffBlocks.java @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2018-2019 bartimaeusnek + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package com.github.bartimaeusnek.bartworks.system.material; + +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_LanguageManager; +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; + +import java.util.List; + +public class BW_MetaGenerated_WerkstoffBlocks extends BW_MetaGenerated_Blocks { + |
