diff options
| author | Raven Szewczyk <git@eigenraven.me> | 2024-05-25 14:42:41 +0100 |
|---|---|---|
| committer | Raven Szewczyk <git@eigenraven.me> | 2024-05-25 14:42:41 +0100 |
| commit | 8aa595f083b5c3e43246119fca5f4263f81e851b (patch) | |
| tree | 157d2b528e4b4ea0321022ebfee398f559a9e121 /src/main/java/kubatech/loaders/block/kubablock/blocks | |
| parent | 14a97a5a177399cd8df7f246856c08fcda441afd (diff) | |
| download | GT5-Unofficial-8aa595f083b5c3e43246119fca5f4263f81e851b.tar.gz GT5-Unofficial-8aa595f083b5c3e43246119fca5f4263f81e851b.tar.bz2 GT5-Unofficial-8aa595f083b5c3e43246119fca5f4263f81e851b.zip | |
Migrate kubatech source code
Diffstat (limited to 'src/main/java/kubatech/loaders/block/kubablock/blocks')
| -rw-r--r-- | src/main/java/kubatech/loaders/block/kubablock/blocks/TeaAcceptor.java | 64 | ||||
| -rw-r--r-- | src/main/java/kubatech/loaders/block/kubablock/blocks/TeaStorage.java | 66 |
2 files changed, 130 insertions, 0 deletions
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; + } +} |
