diff options
Diffstat (limited to 'src/main/java/kubatech/loaders/block')
8 files changed, 640 insertions, 0 deletions
diff --git a/src/main/java/kubatech/loaders/block/defc/DEFCCasingBlock.java b/src/main/java/kubatech/loaders/block/defc/DEFCCasingBlock.java new file mode 100644 index 0000000000..5a6b95acfe --- /dev/null +++ b/src/main/java/kubatech/loaders/block/defc/DEFCCasingBlock.java @@ -0,0 +1,63 @@ +package kubatech.loaders.block.defc; + +import static kubatech.kubatech.KT; + +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.enums.Textures; +import gregtech.api.render.TextureFactory; +import gregtech.api.util.GT_LanguageManager; +import gregtech.common.blocks.GT_Block_Casings_Abstract; +import kubatech.Tags; +import kubatech.api.enums.ItemList; + +public class DEFCCasingBlock extends GT_Block_Casings_Abstract { + + @SideOnly(Side.CLIENT) + private IIcon[] texture; + + public DEFCCasingBlock() { + super(DEFCCasingItemBlock.class, "defc.casing", Material.anvil); + this.setHardness(15.0F); + this.setResistance(30.0F); + this.setCreativeTab(KT); + + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".7.name", "Naquadah Alloy Fusion Casing"); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".8.name", "Bloody Ichorium Fusion Casing"); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".9.name", "Draconium Fusion Casing"); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".10.name", "Wyvern Fusion Casing"); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".11.name", "Awakened Draconium Fusion Casing"); + GT_LanguageManager.addStringLocalization(getUnlocalizedName() + ".12.name", "Chaotic Fusion Casing"); + + ItemList.DEFCCasingBase.set(new ItemStack(this, 1, 7)); + ItemList.DEFCCasingT1.set(new ItemStack(this, 1, 8)); + ItemList.DEFCCasingT2.set(new ItemStack(this, 1, 9)); + ItemList.DEFCCasingT3.set(new ItemStack(this, 1, 10)); + ItemList.DEFCCasingT4.set(new ItemStack(this, 1, 11)); + ItemList.DEFCCasingT5.set(new ItemStack(this, 1, 12)); + + // Taking one texture slot :P + Textures.BlockIcons.setCasingTexture((byte) 1, (byte) (15 + 48), TextureFactory.of(this, 0)); + } + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(int side, int meta) { + if (meta < 7 || meta > 12) return texture[0]; + return texture[meta - 7]; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerBlockIcons(IIconRegister aIconRegister) { + texture = new IIcon[6]; + for (int i = 0; i < texture.length; i++) { + texture[i] = aIconRegister.registerIcon(Tags.MODID + ":casing/defc_" + i); + } + } +} diff --git a/src/main/java/kubatech/loaders/block/defc/DEFCCasingItemBlock.java b/src/main/java/kubatech/loaders/block/defc/DEFCCasingItemBlock.java new file mode 100644 index 0000000000..669e3a6dc8 --- /dev/null +++ b/src/main/java/kubatech/loaders/block/defc/DEFCCasingItemBlock.java @@ -0,0 +1,36 @@ +package kubatech.loaders.block.defc; + +import static kubatech.kubatech.KT; + +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraft.util.StatCollector; + +import gregtech.common.blocks.GT_Item_Casings_Abstract; + +public class DEFCCasingItemBlock extends GT_Item_Casings_Abstract { + + public DEFCCasingItemBlock(Block block) { + super(block); + this.setMaxDamage(0); + this.setHasSubtypes(true); + this.setCreativeTab(KT); + } + + @Override + @SuppressWarnings("unchecked") + public void addInformation(ItemStack aStack, EntityPlayer aPlayer, List aList, boolean aF3_H) { + if (getDamage(aStack) > 7) + aList.add(StatCollector.translateToLocalFormatted("defc.casing.tip", getDamage(aStack) - 7)); + super.addInformation(aStack, aPlayer, aList, aF3_H); + } + + @Override + public IIcon getIconFromDamage(int p_77617_1_) { + return this.field_150939_a.getIcon(0, p_77617_1_); + } +} diff --git a/src/main/java/kubatech/loaders/block/kubablock/BlockProxy.java b/src/main/java/kubatech/loaders/block/kubablock/BlockProxy.java new file mode 100644 index 0000000000..5aef5135a3 --- /dev/null +++ b/src/main/java/kubatech/loaders/block/kubablock/BlockProxy.java @@ -0,0 +1,111 @@ +/* + * spotless:off + * KubaTech - Gregtech Addon + * Copyright (C) 2022 - 2024 kuba6000 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see <https://www.gnu.org/licenses/>. + * spotless:on + */ + +package kubatech.loaders.block.kubablock; + +import static kubatech.loaders.block.kubablock.KubaBlock.defaultTileEntityUI; + +import java.util.List; + +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; + +import com.gtnewhorizons.modularui.api.screen.ITileWithModularUI; + +import kubatech.Tags; + +public class BlockProxy { + + private final String unlocalizedName; + private final String sideTexturePath; + private final String topBottomTexturePath; + private IIcon sideIcon; + private IIcon topBottomIcon; + + public BlockProxy(String unlocalizedName, String texture) { + this.unlocalizedName = "kubablock." + unlocalizedName; + sideTexturePath = topBottomTexturePath = Tags.MODID + ":" + texture; + } + + public BlockProxy(String unlocalizedName, String sideTexture, String topBottomTexture) { + this.unlocalizedName = "kubablock." + unlocalizedName; + sideTexturePath = Tags.MODID + ":" + sideTexture; + topBottomTexturePath = Tags.MODID + ":" + topBottomTexture; + } + + public void itemInit(int ID) {} + + public boolean onActivated(World world, int x, int y, int z, EntityPlayer player) { + if (this instanceof IProxyTileEntityProvider) { + TileEntity te = world.getTileEntity(x, y, z); + if (te instanceof ITileWithModularUI) { + if (world.isRemote) return true; + if (te instanceof KubaBlock.IModularUIProvider) ((KubaBlock.IModularUIProvider) te).getUI() + .open(player, world, x, y, z); + else defaultTileEntityUI.open(player, world, x, y, z); + return true; + } + } + return false; + } + + public void onBlockPlaced(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {} + + public void registerIcon(IIconRegister iconRegister) { + sideIcon = iconRegister.registerIcon(sideTexturePath); + if (sideTexturePath.equals(topBottomTexturePath)) topBottomIcon = sideIcon; + else topBottomIcon = iconRegister.registerIcon(topBottomTexturePath); + } + + public IIcon getIcon(int side) { + if (side <= 1) return topBottomIcon; + else return sideIcon; + } + + public String getUnlocalizedName() { + return this.unlocalizedName; + } + + public String getDisplayName(ItemStack stack) { + return StatCollector.translateToLocal(this.unlocalizedName + ".name") + .trim(); + } + + public void addInformation(ItemStack stack, EntityPlayer entity, List<String> tooltipList, boolean showDebugInfo) {} + + public float getHardness() { + return 10.f; + } + + public Material getMaterial() { + return Material.anvil; + } + + public float getResistance() { + return 5.f; + } +} diff --git a/src/main/java/kubatech/loaders/block/kubablock/IProxyTileEntityProvider.java b/src/main/java/kubatech/loaders/block/kubablock/IProxyTileEntityProvider.java new file mode 100644 index 0000000000..c9fb1e8da9 --- /dev/null +++ b/src/main/java/kubatech/loaders/block/kubablock/IProxyTileEntityProvider.java @@ -0,0 +1,29 @@ +/* + * spotless:off + * KubaTech - Gregtech Addon + * Copyright (C) 2022 - 2024 kuba6000 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see <https://www.gnu.org/licenses/>. + * spotless:on + */ + +package kubatech.loaders.block.kubablock; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +public interface IProxyTileEntityProvider { + + TileEntity createTileEntity(World world); +} diff --git a/src/main/java/kubatech/loaders/block/kubablock/KubaBlock.java b/src/main/java/kubatech/loaders/block/kubablock/KubaBlock.java new file mode 100644 index 0000000000..d6349d88ff --- /dev/null +++ b/src/main/java/kubatech/loaders/block/kubablock/KubaBlock.java @@ -0,0 +1,198 @@ +/* + * spotless:off + * KubaTech - Gregtech Addon + * Copyright (C) 2022 - 2024 kuba6000 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see <https://www.gnu.org/licenses/>. + * spotless:on + */ + +package kubatech.loaders.block.kubablock; + +import static kubatech.kubatech.KT; + +import java.lang.ref.WeakReference; +import java.util.HashMap; +import java.util.List; +import java.util.function.Function; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; + +import com.gtnewhorizons.modularui.api.screen.ITileWithModularUI; +import com.gtnewhorizons.modularui.api.screen.ModularUIContext; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; +import com.gtnewhorizons.modularui.common.builder.UIBuilder; +import com.gtnewhorizons.modularui.common.builder.UIInfo; +import com.gtnewhorizons.modularui.common.internal.wrapper.ModularGui; +import com.gtnewhorizons.modularui.common.internal.wrapper.ModularUIContainer; + +import kubatech.loaders.BlockLoader; + +public class KubaBlock extends Block { + + public static final Function<IModularUIContainerCreator, UIInfo<?, ?>> TileEntityUIFactory = containerConstructor -> UIBuilder + .of() + .container((player, world, x, y, z) -> { + TileEntity te = world.getTileEntity(x, y, z); + if (te instanceof ITileWithModularUI) { + final UIBuildContext buildContext = new UIBuildContext(player); + final ModularWindow window = ((ITileWithModularUI) te).createWindow(buildContext); + return containerConstructor + .createUIContainer(new ModularUIContext(buildContext, te::markDirty), window); + } + return null; + }) + .gui(((player, world, x, y, z) -> { + if (!world.isRemote) return null; + TileEntity te = world.getTileEntity(x, y, z); + if (te instanceof ITileWithModularUI) { + final UIBuildContext buildContext = new UIBuildContext(player); + final ModularWindow window = ((ITileWithModularUI) te).createWindow(buildContext); + return new ModularGui( + containerConstructor.createUIContainer(new ModularUIContext(buildContext, null), window)); + } + return null; + })) + .build(); + + public static final UIInfo<?, ?> defaultTileEntityUI = TileEntityUIFactory.apply(ModularUIContainer::new); + + static final HashMap<Integer, BlockProxy> blocks = new HashMap<>(); + private static int idCounter = 0; + + public KubaBlock(Material p_i45394_1_) { + super(p_i45394_1_); + setCreativeTab(KT); + } + + public ItemStack registerProxyBlock(BlockProxy block) { + blocks.put(idCounter, block); + block.itemInit(idCounter); + return new ItemStack(BlockLoader.kubaItemBlock, 1, idCounter++); + } + + private BlockProxy getBlock(int id) { + return blocks.get(id); + } + + WeakReference<World> lastAccessor = null; + int X, Y, Z; + + public void setLastBlockAccess(World accessor, int x, int y, int z) { + lastAccessor = new WeakReference<>(accessor); + X = x; + Y = y; + Z = z; + } + + @Override + public boolean hasTileEntity(int meta) { + return getBlock(meta) instanceof IProxyTileEntityProvider; + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List p_149666_3_) { + for (int i = 0; i < blocks.size(); i++) p_149666_3_.add(new ItemStack(p_149666_1_, 1, i)); + } + + @Override + public int damageDropped(int meta) { + return meta; + } + + @Override + public void registerBlockIcons(IIconRegister p_149651_1_) { + blocks.values() + .forEach(b -> b.registerIcon(p_149651_1_)); + } + + @Override + public IIcon getIcon(int p_149691_1_, int p_149691_2_) { + return blocks.get(p_149691_2_) + .getIcon(p_149691_1_); + } + + @Override + public String getLocalizedName() { + return "KUBABLOCK"; + } + + @Override + public TileEntity createTileEntity(World world, int metadata) { + if (!hasTileEntity(metadata)) return null; + return ((IProxyTileEntityProvider) getBlock(metadata)).createTileEntity(world); + } + + @Override + public boolean onBlockActivated(World p_149727_1_, int p_149727_2_, int p_149727_3_, int p_149727_4_, + EntityPlayer p_149727_5_, int p_149727_6_, float p_149727_7_, float p_149727_8_, float p_149727_9_) { + return getBlock(p_149727_1_.getBlockMetadata(p_149727_2_, p_149727_3_, p_149727_4_)) + .onActivated(p_149727_1_, p_149727_2_, p_149727_3_, p_149727_4_, p_149727_5_); + } + + @Override + public void onBlockPlacedBy(World p_149689_1_, int p_149689_2_, int p_149689_3_, int p_149689_4_, + EntityLivingBase p_149689_5_, ItemStack p_149689_6_) { + getBlock(p_149689_6_.getItemDamage()) + .onBlockPlaced(p_149689_1_, p_149689_2_, p_149689_3_, p_149689_4_, p_149689_5_, p_149689_6_); + } + + @Override + public float getBlockHardness(World p_149712_1_, int p_149712_2_, int p_149712_3_, int p_149712_4_) { + return getBlock(p_149712_1_.getBlockMetadata(p_149712_2_, p_149712_3_, p_149712_4_)).getHardness(); + } + + @Override + public Material getMaterial() { + if (lastAccessor == null) return super.getMaterial(); + World world = lastAccessor.get(); + if (world == null) { + lastAccessor = null; + return super.getMaterial(); + } + if (world.getBlock(X, Y, Z) != this) return super.getMaterial(); + return getBlock(world.getBlockMetadata(X, Y, Z)).getMaterial(); + } + + @Override + public float getExplosionResistance(Entity par1Entity, World world, int x, int y, int z, double explosionX, + double explosionY, double explosionZ) { + return getBlock(world.getBlockMetadata(x, y, z)).getResistance(); + } + + @FunctionalInterface + public interface IModularUIContainerCreator { + + ModularUIContainer createUIContainer(ModularUIContext context, ModularWindow mainWindow); + } + + @FunctionalInterface + public interface IModularUIProvider { + + UIInfo<?, ?> getUI(); + } +} diff --git a/src/main/java/kubatech/loaders/block/kubablock/KubaItemBlock.java b/src/main/java/kubatech/loaders/block/kubablock/KubaItemBlock.java new file mode 100644 index 0000000000..bd5c9d1119 --- /dev/null +++ b/src/main/java/kubatech/loaders/block/kubablock/KubaItemBlock.java @@ -0,0 +1,73 @@ +/* + * spotless:off + * KubaTech - Gregtech Addon + * Copyright (C) 2022 - 2024 kuba6000 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see <https://www.gnu.org/licenses/>. + * spotless:on + */ + +package kubatech.loaders.block.kubablock; + +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public class KubaItemBlock extends ItemBlock { + + public KubaItemBlock(Block p_i45328_1_) { + super(p_i45328_1_); + setHasSubtypes(true); + } + + @Override + public boolean placeBlockAt(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, + float hitX, float hitY, float hitZ, int metadata) { + return super.placeBlockAt(stack, player, world, x, y, z, side, hitX, hitY, hitZ, metadata); + } + + @Override + public void registerIcons(IIconRegister p_94581_1_) { + super.registerIcons(p_94581_1_); + } + + @Override + public String getUnlocalizedName(ItemStack p_77667_1_) { + return KubaBlock.blocks.get(p_77667_1_.getItemDamage()) + .getUnlocalizedName(); + } + + @Override + public String getItemStackDisplayName(ItemStack p_77653_1_) { + return KubaBlock.blocks.get(p_77653_1_.getItemDamage()) + .getDisplayName(p_77653_1_); + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_) { + KubaBlock.blocks.get(p_77624_1_.getItemDamage()) + .addInformation(p_77624_1_, p_77624_2_, p_77624_3_, p_77624_4_); + } + + @Override + public int getMetadata(int p_77647_1_) { + return p_77647_1_; + } +} diff --git a/src/main/java/kubatech/loaders/block/kubablock/blocks/TeaAcceptor.java b/src/main/java/kubatech/loaders/block/kubablock/blocks/TeaAcceptor.java new file mode 100644 index 0000000000..06ee3490b1 --- /dev/null +++ b/src/main/java/kubatech/loaders/block/kubablock/blocks/TeaAcceptor.java @@ -0,0 +1,64 @@ +/* + * spotless:off + * KubaTech - Gregtech Addon + * Copyright (C) 2022 - 2024 kuba6000 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see <https://www.gnu.org/licenses/>. + * spotless:on + */ + +package kubatech.loaders.block.kubablock.blocks; + +import java.util.List; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +import kubatech.loaders.block.kubablock.BlockProxy; +import kubatech.loaders.block.kubablock.IProxyTileEntityProvider; +import kubatech.tileentity.TeaAcceptorTile; + +public class TeaAcceptor extends BlockProxy implements IProxyTileEntityProvider { + + public TeaAcceptor() { + super("tea_acceptor", "tea_acceptor", "blank"); + } + + @Override + public TileEntity createTileEntity(World world) { + return new TeaAcceptorTile(); + } + + @Override + public void onBlockPlaced(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) { + if (world.isRemote) return; + if (!(player instanceof EntityPlayerMP)) return; + ((TeaAcceptorTile) world.getTileEntity(x, y, z)).setTeaOwner(player.getPersistentID()); + } + + @Override + public void addInformation(ItemStack stack, EntityPlayer entity, List<String> tooltipList, boolean showDebugInfo) { + tooltipList.add("Accepts Tea items and adds them to your network"); + tooltipList.add("Can accept up to 10 stacks per tick"); + } + + @Override + public float getResistance() { + return 999999999999.f; + } +} diff --git a/src/main/java/kubatech/loaders/block/kubablock/blocks/TeaStorage.java b/src/main/java/kubatech/loaders/block/kubablock/blocks/TeaStorage.java new file mode 100644 index 0000000000..436af9a4e2 --- /dev/null +++ b/src/main/java/kubatech/loaders/block/kubablock/blocks/TeaStorage.java @@ -0,0 +1,66 @@ +/* + * spotless:off + * KubaTech - Gregtech Addon + * Copyright (C) 2022 - 2024 kuba6000 + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library. If not, see <https://www.gnu.org/licenses/>. + * spotless:on + */ + +package kubatech.loaders.block.kubablock.blocks; + +import static kubatech.api.Variables.numberFormat; + +import java.util.List; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.World; + +import kubatech.loaders.block.kubablock.BlockProxy; +import kubatech.loaders.block.kubablock.IProxyTileEntityProvider; +import kubatech.tileentity.TeaStorageTile; + +public class TeaStorage extends BlockProxy implements IProxyTileEntityProvider { + + public TeaStorage() { + super("tea_storage", "tea_storage"); + } + + @Override + public TileEntity createTileEntity(World world) { + return new TeaStorageTile(); + } + + @Override + public void onBlockPlaced(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) { + if (world.isRemote) return; + if (!(player instanceof EntityPlayerMP)) return; + ((TeaStorageTile) world.getTileEntity(x, y, z)).setTeaOwner(player.getPersistentID()); + } + + @Override + public void addInformation(ItemStack stack, EntityPlayer entity, List<String> tooltipList, boolean showDebugInfo) { + tooltipList.add("Extends Tea Storage by " + EnumChatFormatting.RED + numberFormat.format(Long.MAX_VALUE)); + } + + @Override + public float getResistance() { + return 999999999999.f; + } +} |