aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/common/blocks
diff options
context:
space:
mode:
authorkekzdealer <kekzdealer@gmail.com>2020-05-17 16:33:44 +0200
committerkekzdealer <kekzdealer@gmail.com>2020-05-17 16:33:44 +0200
commit6045fc76bf08eeaf1e74c0a86200bf0288d8e3fa (patch)
treecf2f05b36c3104548a95119f08468ef5e076481e /src/main/java/common/blocks
parent695e5ab73f82e33598c96e6c59ca7fd18eb4259a (diff)
downloadGT5-Unofficial-6045fc76bf08eeaf1e74c0a86200bf0288d8e3fa.tar.gz
GT5-Unofficial-6045fc76bf08eeaf1e74c0a86200bf0288d8e3fa.tar.bz2
GT5-Unofficial-6045fc76bf08eeaf1e74c0a86200bf0288d8e3fa.zip
Massive code cleanup and rewrite for Item Proxy tech
Diffstat (limited to 'src/main/java/common/blocks')
-rw-r--r--src/main/java/common/blocks/Block_ItemProxyEndpoint.java16
-rw-r--r--src/main/java/common/blocks/Block_ItemProxySource.java20
2 files changed, 8 insertions, 28 deletions
diff --git a/src/main/java/common/blocks/Block_ItemProxyEndpoint.java b/src/main/java/common/blocks/Block_ItemProxyEndpoint.java
index 5b4888a1f5..ec1bc6b827 100644
--- a/src/main/java/common/blocks/Block_ItemProxyEndpoint.java
+++ b/src/main/java/common/blocks/Block_ItemProxyEndpoint.java
@@ -18,7 +18,7 @@ import net.minecraft.world.World;
public class Block_ItemProxyEndpoint extends Block {
- private static Block_ItemProxyEndpoint instance = new Block_ItemProxyEndpoint();
+ private static final Block_ItemProxyEndpoint instance = new Block_ItemProxyEndpoint();
private Block_ItemProxyEndpoint() {
super(Material.glass);
@@ -45,19 +45,11 @@ public class Block_ItemProxyEndpoint extends Block {
final TileEntity te = world.getTileEntity(x, y, z);
if(te instanceof TE_ItemProxyEndpoint) {
- final TE_ItemProxyEndpoint endpoint = (TE_ItemProxyEndpoint) te;
- if(player.inventory.getCurrentItem() != null && player.inventory.getCurrentItem().getItem() instanceof Item_Configurator) {
-
- final ItemStack held = player.inventory.getCurrentItem();
- if(held.hasTagCompound() && held.getTagCompound().hasKey("config")) {
- endpoint.setChannel(UUID.fromString(held.getTagCompound().getString("config")));
- }
- } else {
- player.openGui(KekzCore.instance, GuiHandler.ITEM_PROXY_ENDPOINT, world, x, y, z);
- }
+ player.openGui(KekzCore.instance, GuiHandler.ITEM_PROXY_ENDPOINT, world, x, y, z);
return true;
+ } else {
+ return false;
}
- return false;
}
@Override
diff --git a/src/main/java/common/blocks/Block_ItemProxySource.java b/src/main/java/common/blocks/Block_ItemProxySource.java
index 25d9de482b..7291c15e6f 100644
--- a/src/main/java/common/blocks/Block_ItemProxySource.java
+++ b/src/main/java/common/blocks/Block_ItemProxySource.java
@@ -3,21 +3,18 @@ package common.blocks;
import common.itemBlocks.IB_ItemProxySource;
import common.tileentities.TE_ItemProxySource;
import cpw.mods.fml.common.registry.GameRegistry;
-import items.Item_Configurator;
import kekztech.GuiHandler;
import kekztech.KekzCore;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class Block_ItemProxySource extends Block {
- private static Block_ItemProxySource instance = new Block_ItemProxySource();
+ private static final Block_ItemProxySource instance = new Block_ItemProxySource();
private Block_ItemProxySource() {
super(Material.glass);
@@ -44,20 +41,11 @@ public class Block_ItemProxySource extends Block {
final TileEntity te = world.getTileEntity(x, y, z);
if(te instanceof TE_ItemProxySource) {
- final TE_ItemProxySource source = (TE_ItemProxySource) te;
- if(player.inventory.getCurrentItem() != null && player.inventory.getCurrentItem().getItem() instanceof Item_Configurator) {
-
- final NBTTagCompound configNBT = new NBTTagCompound();
- configNBT.setString("config", source.getChannel().toString());
- final ItemStack held = player.inventory.getCurrentItem();
- held.setTagCompound(configNBT);
-
- } else {
- player.openGui(KekzCore.instance, GuiHandler.ITEM_PROXY_SOURCE, world, x, y, z);
- }
+ player.openGui(KekzCore.instance, GuiHandler.ITEM_PROXY_SOURCE, world, x, y, z);
return true;
+ } else {
+ return false;
}
- return false;
}
@Override