mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-27 23:45:55 +00:00
EnderIO block is all bag in action.
This commit is contained in:
1 parent
fffdc8de63
commit
1161ff8c4a
12 files changed
+633
-459
No files matched your search
@@ -5,104 +5,101 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
/**
|
||||
* Reference implementation of {@link IEnergyContainerItem}. Use/extend this or implement your own.
|
||||
* Reference implementation of {@link IEnergyContainerItem}. Use/extend this or
|
||||
* implement your own.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public class ItemEnergyContainer extends Item implements IEnergyContainerItem {
|
||||
|
||||
protected int capacity;
|
||||
protected int maxReceive;
|
||||
protected int maxExtract;
|
||||
protected int capacity;
|
||||
protected int maxReceive;
|
||||
protected int maxExtract;
|
||||
|
||||
public ItemEnergyContainer() {
|
||||
}
|
||||
public ItemEnergyContainer() {
|
||||
}
|
||||
|
||||
public ItemEnergyContainer(int capacity) {
|
||||
public ItemEnergyContainer(int capacity) {
|
||||
this(capacity, capacity, capacity);
|
||||
}
|
||||
|
||||
this(capacity, capacity, capacity);
|
||||
}
|
||||
public ItemEnergyContainer(int capacity, int maxTransfer) {
|
||||
this(capacity, maxTransfer, maxTransfer);
|
||||
}
|
||||
|
||||
public ItemEnergyContainer(int itemID, int capacity, int maxTransfer) {
|
||||
public ItemEnergyContainer(int capacity, int maxReceive, int maxExtract) {
|
||||
this.capacity = capacity;
|
||||
this.maxReceive = maxReceive;
|
||||
this.maxExtract = maxExtract;
|
||||
}
|
||||
|
||||
this(itemID, capacity, maxTransfer, maxTransfer);
|
||||
}
|
||||
public ItemEnergyContainer setCapacity(int capacity) {
|
||||
this.capacity = capacity;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemEnergyContainer(int itemID, int capacity, int maxReceive, int maxExtract) {
|
||||
this.capacity = capacity;
|
||||
this.maxReceive = maxReceive;
|
||||
this.maxExtract = maxExtract;
|
||||
}
|
||||
public void setMaxTransfer(int maxTransfer) {
|
||||
setMaxReceive(maxTransfer);
|
||||
setMaxExtract(maxTransfer);
|
||||
}
|
||||
|
||||
public ItemEnergyContainer setCapacity(int capacity) {
|
||||
public void setMaxReceive(int maxReceive) {
|
||||
|
||||
this.capacity = capacity;
|
||||
return this;
|
||||
}
|
||||
this.maxReceive = maxReceive;
|
||||
}
|
||||
|
||||
public void setMaxTransfer(int maxTransfer) {
|
||||
public void setMaxExtract(int maxExtract) {
|
||||
|
||||
setMaxReceive(maxTransfer);
|
||||
setMaxExtract(maxTransfer);
|
||||
}
|
||||
this.maxExtract = maxExtract;
|
||||
}
|
||||
|
||||
public void setMaxReceive(int maxReceive) {
|
||||
/* IEnergyContainerItem */
|
||||
@Override
|
||||
public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) {
|
||||
|
||||
this.maxReceive = maxReceive;
|
||||
}
|
||||
if(container.stackTagCompound == null) {
|
||||
container.stackTagCompound = new NBTTagCompound();
|
||||
}
|
||||
int energy = container.stackTagCompound.getInteger("Energy");
|
||||
int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive));
|
||||
|
||||
public void setMaxExtract(int maxExtract) {
|
||||
if(!simulate) {
|
||||
energy += energyReceived;
|
||||
container.stackTagCompound.setInteger("Energy", energy);
|
||||
}
|
||||
return energyReceived;
|
||||
}
|
||||
|
||||
this.maxExtract = maxExtract;
|
||||
}
|
||||
@Override
|
||||
public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) {
|
||||
|
||||
/* IEnergyContainerItem */
|
||||
@Override
|
||||
public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) {
|
||||
if(container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
|
||||
return 0;
|
||||
}
|
||||
int energy = container.stackTagCompound.getInteger("Energy");
|
||||
int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
|
||||
|
||||
if (container.stackTagCompound == null) {
|
||||
container.stackTagCompound = new NBTTagCompound();
|
||||
}
|
||||
int energy = container.stackTagCompound.getInteger("Energy");
|
||||
int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive));
|
||||
if(!simulate) {
|
||||
energy -= energyExtracted;
|
||||
container.stackTagCompound.setInteger("Energy", energy);
|
||||
}
|
||||
return energyExtracted;
|
||||
}
|
||||
|
||||
if (!simulate) {
|
||||
energy += energyReceived;
|
||||
container.stackTagCompound.setInteger("Energy", energy);
|
||||
}
|
||||
return energyReceived;
|
||||
}
|
||||
@Override
|
||||
public int getEnergyStored(ItemStack container) {
|
||||
|
||||
@Override
|
||||
public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) {
|
||||
if(container == null || container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
|
||||
return 0;
|
||||
}
|
||||
return container.stackTagCompound.getInteger("Energy");
|
||||
}
|
||||
|
||||
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
|
||||
return 0;
|
||||
}
|
||||
int energy = container.stackTagCompound.getInteger("Energy");
|
||||
int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
|
||||
@Override
|
||||
public int getMaxEnergyStored(ItemStack container) {
|
||||
|
||||
if (!simulate) {
|
||||
energy -= energyExtracted;
|
||||
container.stackTagCompound.setInteger("Energy", energy);
|
||||
}
|
||||
return energyExtracted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ItemStack container) {
|
||||
|
||||
if (container.stackTagCompound == null || !container.stackTagCompound.hasKey("Energy")) {
|
||||
return 0;
|
||||
}
|
||||
return container.stackTagCompound.getInteger("Energy");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ItemStack container) {
|
||||
|
||||
return capacity;
|
||||
}
|
||||
return capacity;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +1,15 @@
|
||||
package crazypants.enderio;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.Mod.EventHandler;
|
||||
import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.*;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStartedEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStoppedEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import crazypants.enderio.enderface.BlockEnderIO;
|
||||
import crazypants.enderio.enderface.ItemEnderface;
|
||||
@@ -13,9 +18,8 @@ import crazypants.enderio.network.PacketTileEntity;
|
||||
import crazypants.enderio.teleport.BlockTravelAnchor;
|
||||
import crazypants.enderio.teleport.ItemTravelStaff;
|
||||
import crazypants.enderio.teleport.TeleportRecipes;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
@Mod(modid = "EnderIO", name = "Ender IO",version = "1.1.0alpha", dependencies = "required-after:Forge@[7.0,);required-after:FML@[5.0.5,)")
|
||||
@Mod(modid = "EnderIO", name = "Ender IO", version = "1.1.0alpha", dependencies = "required-after:Forge@[7.0,);required-after:FML@[5.0.5,)")
|
||||
public class EnderIO {
|
||||
|
||||
@Instance("EnderIO")
|
||||
@@ -29,13 +33,13 @@ public class EnderIO {
|
||||
public static GuiHandler guiHandler = new GuiHandler();
|
||||
|
||||
// Materials
|
||||
// public static ItemCapacitor itemBasicCapacitor;
|
||||
// public static ItemAlloy itemAlloy;
|
||||
// public static BlockFusedQuartz blockFusedQuartz;
|
||||
// public static ItemFusedQuartzFrame itemFusedQuartzFrame;
|
||||
// public static ItemMachinePart itemMachinePart;
|
||||
// public static ItemPowderIngot itemPowderIngot;
|
||||
// public static ItemMaterial itemMaterial;
|
||||
// public static ItemCapacitor itemBasicCapacitor;
|
||||
// public static ItemAlloy itemAlloy;
|
||||
// public static BlockFusedQuartz blockFusedQuartz;
|
||||
// public static ItemFusedQuartzFrame itemFusedQuartzFrame;
|
||||
// public static ItemMachinePart itemMachinePart;
|
||||
// public static ItemPowderIngot itemPowderIngot;
|
||||
// public static ItemMaterial itemMaterial;
|
||||
|
||||
// Enderface
|
||||
public static BlockEnderIO blockEnderIo;
|
||||
@@ -46,61 +50,60 @@ public class EnderIO {
|
||||
public static ItemTravelStaff itemTravelStaff;
|
||||
|
||||
// Painter
|
||||
// public static BlockPainter blockPainter;
|
||||
// public static BlockCustomFence blockCustomFence;
|
||||
// public static BlockCustomFenceGate blockCustomFenceGate;
|
||||
// public static BlockCustomWall blockCustomWall;
|
||||
// public static BlockCustomStair blockCustomStair;
|
||||
// public static BlockCustomSlab blockCustomSlab;
|
||||
// public static BlockCustomSlab blockCustomDoubleSlab;
|
||||
//
|
||||
// // Conduits
|
||||
// public static BlockConduitBundle blockConduitBundle;
|
||||
// public static BlockConduitFacade blockConduitFacade;
|
||||
// public static ItemConduitFacade itemConduitFacade;
|
||||
// public static ItemRedstoneConduit itemRedstoneConduit;
|
||||
// public static ItemPowerConduit itemPowerConduit;
|
||||
// public static ItemLiquidConduit itemLiquidConduit;
|
||||
// public static ItemItemConduit itemItemConduit;
|
||||
// public static ItemMeConduit itemMeConduit;
|
||||
//
|
||||
// // Machines
|
||||
// public static BlockStirlingGenerator blockStirlingGenerator;
|
||||
// public static BlockSolarPanel blockSolarPanel;
|
||||
// public static BlockReservoir blockReservoir;
|
||||
// public static BlockAlloySmelter blockAlloySmelter;
|
||||
// public static BlockCapacitorBank blockCapacitorBank;
|
||||
// public static BlockCrusher blockCrusher;
|
||||
// public static BlockHyperCube blockHyperCube;
|
||||
// public static BlockPowerMonitor blockPowerMonitor;
|
||||
//
|
||||
// public static BlockElectricLight blockElectricLight;
|
||||
// public static BlockLightNode blockLightNode;
|
||||
//
|
||||
// public static ItemYetaWrench itemYetaWench;
|
||||
// public static ItemMJReader itemMJReader;
|
||||
//
|
||||
// public static ITrigger triggerNoEnergy;
|
||||
// public static ITrigger triggerHasEnergy;
|
||||
// public static ITrigger triggerFullEnergy;
|
||||
// public static ITrigger triggerIsCharging;
|
||||
// public static ITrigger triggerFinishedCharging;
|
||||
// public static BlockPainter blockPainter;
|
||||
// public static BlockCustomFence blockCustomFence;
|
||||
// public static BlockCustomFenceGate blockCustomFenceGate;
|
||||
// public static BlockCustomWall blockCustomWall;
|
||||
// public static BlockCustomStair blockCustomStair;
|
||||
// public static BlockCustomSlab blockCustomSlab;
|
||||
// public static BlockCustomSlab blockCustomDoubleSlab;
|
||||
//
|
||||
// // Conduits
|
||||
// public static BlockConduitBundle blockConduitBundle;
|
||||
// public static BlockConduitFacade blockConduitFacade;
|
||||
// public static ItemConduitFacade itemConduitFacade;
|
||||
// public static ItemRedstoneConduit itemRedstoneConduit;
|
||||
// public static ItemPowerConduit itemPowerConduit;
|
||||
// public static ItemLiquidConduit itemLiquidConduit;
|
||||
// public static ItemItemConduit itemItemConduit;
|
||||
// public static ItemMeConduit itemMeConduit;
|
||||
//
|
||||
// // Machines
|
||||
// public static BlockStirlingGenerator blockStirlingGenerator;
|
||||
// public static BlockSolarPanel blockSolarPanel;
|
||||
// public static BlockReservoir blockReservoir;
|
||||
// public static BlockAlloySmelter blockAlloySmelter;
|
||||
// public static BlockCapacitorBank blockCapacitorBank;
|
||||
// public static BlockCrusher blockCrusher;
|
||||
// public static BlockHyperCube blockHyperCube;
|
||||
// public static BlockPowerMonitor blockPowerMonitor;
|
||||
//
|
||||
// public static BlockElectricLight blockElectricLight;
|
||||
// public static BlockLightNode blockLightNode;
|
||||
//
|
||||
// public static ItemYetaWrench itemYetaWench;
|
||||
// public static ItemMJReader itemMJReader;
|
||||
//
|
||||
// public static ITrigger triggerNoEnergy;
|
||||
// public static ITrigger triggerHasEnergy;
|
||||
// public static ITrigger triggerFullEnergy;
|
||||
// public static ITrigger triggerIsCharging;
|
||||
// public static ITrigger triggerFinishedCharging;
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
|
||||
Config.load(event);
|
||||
|
||||
// ConduitGeometryUtil.setupBounds((float) Config.conduitScale);
|
||||
|
||||
// itemBasicCapacitor = ItemCapacitor.create();
|
||||
// itemAlloy = ItemAlloy.create();
|
||||
// blockFusedQuartz = BlockFusedQuartz.create();
|
||||
// itemFusedQuartzFrame = ItemFusedQuartzFrame.create();
|
||||
// itemMachinePart = ItemMachinePart.create();
|
||||
// itemPowderIngot = ItemPowderIngot.create();
|
||||
// itemMaterial = ItemMaterial.create();
|
||||
// ConduitGeometryUtil.setupBounds((float) Config.conduitScale);
|
||||
|
||||
// itemBasicCapacitor = ItemCapacitor.create();
|
||||
// itemAlloy = ItemAlloy.create();
|
||||
// blockFusedQuartz = BlockFusedQuartz.create();
|
||||
// itemFusedQuartzFrame = ItemFusedQuartzFrame.create();
|
||||
// itemMachinePart = ItemMachinePart.create();
|
||||
// itemPowderIngot = ItemPowderIngot.create();
|
||||
// itemMaterial = ItemMaterial.create();
|
||||
|
||||
blockEnderIo = BlockEnderIO.create();
|
||||
itemEnderface = ItemEnderface.create();
|
||||
@@ -108,43 +111,43 @@ public class EnderIO {
|
||||
blockTravelPlatform = BlockTravelAnchor.create();
|
||||
itemTravelStaff = ItemTravelStaff.create();
|
||||
|
||||
// blockHyperCube = BlockHyperCube.create();
|
||||
//
|
||||
// blockPainter = BlockPainter.create();
|
||||
// blockCustomFence = BlockCustomFence.create();
|
||||
// blockCustomFenceGate = BlockCustomFenceGate.create();
|
||||
// blockCustomWall = BlockCustomWall.create();
|
||||
// blockCustomStair = BlockCustomStair.create();
|
||||
// blockCustomSlab = new BlockCustomSlab(false);
|
||||
// blockCustomDoubleSlab = new BlockCustomSlab(true);
|
||||
// blockCustomSlab.init();
|
||||
// blockCustomDoubleSlab.init();
|
||||
//
|
||||
// blockStirlingGenerator = BlockStirlingGenerator.create();
|
||||
// blockSolarPanel = BlockSolarPanel.create();
|
||||
// blockReservoir = BlockReservoir.create();
|
||||
// blockAlloySmelter = BlockAlloySmelter.create();
|
||||
// blockCapacitorBank = BlockCapacitorBank.create();
|
||||
// blockCrusher = BlockCrusher.create();
|
||||
// blockPowerMonitor = BlockPowerMonitor.create();
|
||||
//
|
||||
// blockConduitBundle = BlockConduitBundle.create();
|
||||
// blockConduitFacade = BlockConduitFacade.create();
|
||||
// itemConduitFacade = ItemConduitFacade.create();
|
||||
//
|
||||
// itemRedstoneConduit = ItemRedstoneConduit.create();
|
||||
// itemPowerConduit = ItemPowerConduit.create();
|
||||
// itemLiquidConduit = ItemLiquidConduit.create();
|
||||
// itemItemConduit = ItemItemConduit.create();
|
||||
// itemMeConduit = ItemMeConduit.create();
|
||||
//
|
||||
// blockElectricLight = BlockElectricLight.create();
|
||||
// blockLightNode = BlockLightNode.create();
|
||||
//
|
||||
// itemYetaWench = ItemYetaWrench.create();
|
||||
// itemMJReader = ItemMJReader.create();
|
||||
//
|
||||
// MaterialRecipes.registerOresInDictionary();
|
||||
// blockHyperCube = BlockHyperCube.create();
|
||||
//
|
||||
// blockPainter = BlockPainter.create();
|
||||
// blockCustomFence = BlockCustomFence.create();
|
||||
// blockCustomFenceGate = BlockCustomFenceGate.create();
|
||||
// blockCustomWall = BlockCustomWall.create();
|
||||
// blockCustomStair = BlockCustomStair.create();
|
||||
// blockCustomSlab = new BlockCustomSlab(false);
|
||||
// blockCustomDoubleSlab = new BlockCustomSlab(true);
|
||||
// blockCustomSlab.init();
|
||||
// blockCustomDoubleSlab.init();
|
||||
//
|
||||
// blockStirlingGenerator = BlockStirlingGenerator.create();
|
||||
// blockSolarPanel = BlockSolarPanel.create();
|
||||
// blockReservoir = BlockReservoir.create();
|
||||
// blockAlloySmelter = BlockAlloySmelter.create();
|
||||
// blockCapacitorBank = BlockCapacitorBank.create();
|
||||
// blockCrusher = BlockCrusher.create();
|
||||
// blockPowerMonitor = BlockPowerMonitor.create();
|
||||
//
|
||||
// blockConduitBundle = BlockConduitBundle.create();
|
||||
// blockConduitFacade = BlockConduitFacade.create();
|
||||
// itemConduitFacade = ItemConduitFacade.create();
|
||||
//
|
||||
// itemRedstoneConduit = ItemRedstoneConduit.create();
|
||||
// itemPowerConduit = ItemPowerConduit.create();
|
||||
// itemLiquidConduit = ItemLiquidConduit.create();
|
||||
// itemItemConduit = ItemItemConduit.create();
|
||||
// itemMeConduit = ItemMeConduit.create();
|
||||
//
|
||||
// blockElectricLight = BlockElectricLight.create();
|
||||
// blockLightNode = BlockLightNode.create();
|
||||
//
|
||||
// itemYetaWench = ItemYetaWrench.create();
|
||||
// itemMJReader = ItemMJReader.create();
|
||||
//
|
||||
// MaterialRecipes.registerOresInDictionary();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@@ -159,45 +162,45 @@ public class EnderIO {
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
|
||||
//Register Custom Dungeon Loot here
|
||||
// ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(
|
||||
// new WeightedRandomChestContent(new ItemStack(EnderIO.itemAlloy, 1, Alloy.ELECTRICAL_STEEL.ordinal()), 1, 3, 60));
|
||||
// ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST)
|
||||
// .addItem(new WeightedRandomChestContent(new ItemStack(EnderIO.itemYetaWench, 1, 0), 1, 1, 15));
|
||||
// ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(EnderIO.itemMJReader, 1, 0), 1, 1, 1));
|
||||
//
|
||||
// ItemStack staff = new ItemStack(EnderIO.itemTravelStaff, 1, 0);
|
||||
// itemTravelStaff.setFull(staff);
|
||||
// ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(staff, 1, 1, 30));
|
||||
// ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(Items.quartz), 3, 16, 40));
|
||||
// ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(Items.nether_wart), 1, 4, 30));
|
||||
// ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(Items.ender_pearl), 1, 2, 30));
|
||||
// ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(
|
||||
// new WeightedRandomChestContent(new ItemStack(EnderIO.itemAlloy, 1, Alloy.ELECTRICAL_STEEL.ordinal()), 5, 20, 50));
|
||||
// ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(
|
||||
// new WeightedRandomChestContent(new ItemStack(EnderIO.itemAlloy, 1, Alloy.REDSTONE_ALLOY.ordinal()), 3, 14, 35));
|
||||
// ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(
|
||||
// new WeightedRandomChestContent(new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_IRON.ordinal()), 2, 6, 20));
|
||||
// ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(
|
||||
// new WeightedRandomChestContent(new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_GOLD.ordinal()), 2, 6, 10));
|
||||
// ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(new WeightedRandomChestContent(staff, 1, 1, 5));
|
||||
// ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_DESERT_CHEST).addItem(new WeightedRandomChestContent(staff, 1, 1, 20));
|
||||
//
|
||||
// PacketHandler.instance.addPacketProcessor(new RedstoneModePacketProcessor());
|
||||
// ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(
|
||||
// new WeightedRandomChestContent(new ItemStack(EnderIO.itemAlloy, 1, Alloy.ELECTRICAL_STEEL.ordinal()), 1, 3, 60));
|
||||
// ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST)
|
||||
// .addItem(new WeightedRandomChestContent(new ItemStack(EnderIO.itemYetaWench, 1, 0), 1, 1, 15));
|
||||
// ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(EnderIO.itemMJReader, 1, 0), 1, 1, 1));
|
||||
//
|
||||
// ItemStack staff = new ItemStack(EnderIO.itemTravelStaff, 1, 0);
|
||||
// itemTravelStaff.setFull(staff);
|
||||
// ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(staff, 1, 1, 30));
|
||||
// ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(Items.quartz), 3, 16, 40));
|
||||
// ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(Items.nether_wart), 1, 4, 30));
|
||||
// ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(Items.ender_pearl), 1, 2, 30));
|
||||
// ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(
|
||||
// new WeightedRandomChestContent(new ItemStack(EnderIO.itemAlloy, 1, Alloy.ELECTRICAL_STEEL.ordinal()), 5, 20, 50));
|
||||
// ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(
|
||||
// new WeightedRandomChestContent(new ItemStack(EnderIO.itemAlloy, 1, Alloy.REDSTONE_ALLOY.ordinal()), 3, 14, 35));
|
||||
// ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(
|
||||
// new WeightedRandomChestContent(new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_IRON.ordinal()), 2, 6, 20));
|
||||
// ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(
|
||||
// new WeightedRandomChestContent(new ItemStack(EnderIO.itemAlloy, 1, Alloy.PHASED_GOLD.ordinal()), 2, 6, 10));
|
||||
// ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(new WeightedRandomChestContent(staff, 1, 1, 5));
|
||||
// ChestGenHooks.getInfo(ChestGenHooks.PYRAMID_DESERT_CHEST).addItem(new WeightedRandomChestContent(staff, 1, 1, 20));
|
||||
//
|
||||
// PacketHandler.instance.addPacketProcessor(new RedstoneModePacketProcessor());
|
||||
|
||||
// EnderfaceRecipes.addRecipes();
|
||||
// MaterialRecipes.addRecipes();
|
||||
// ConduitRecipes.addRecipes();
|
||||
// MachineRecipes.addRecipes();
|
||||
// ItemRecipes.addRecipes();
|
||||
// EnderfaceRecipes.addRecipes();
|
||||
// MaterialRecipes.addRecipes();
|
||||
// ConduitRecipes.addRecipes();
|
||||
// MachineRecipes.addRecipes();
|
||||
// ItemRecipes.addRecipes();
|
||||
TeleportRecipes.addRecipes();
|
||||
|
||||
// triggerNoEnergy = new TriggerEnderIO("enderIO.trigger.noEnergy", 0);
|
||||
// triggerHasEnergy = new TriggerEnderIO("enderIO.trigger.hasEnergy", 1);
|
||||
// triggerFullEnergy = new TriggerEnderIO("enderIO.trigger.fullEnergy", 2);
|
||||
// triggerIsCharging = new TriggerEnderIO("enderIO.trigger.isCharging", 3);
|
||||
// triggerFinishedCharging = new TriggerEnderIO("enderIO.trigger.finishedCharging", 4);
|
||||
// triggerNoEnergy = new TriggerEnderIO("enderIO.trigger.noEnergy", 0);
|
||||
// triggerHasEnergy = new TriggerEnderIO("enderIO.trigger.hasEnergy", 1);
|
||||
// triggerFullEnergy = new TriggerEnderIO("enderIO.trigger.fullEnergy", 2);
|
||||
// triggerIsCharging = new TriggerEnderIO("enderIO.trigger.isCharging", 3);
|
||||
// triggerFinishedCharging = new TriggerEnderIO("enderIO.trigger.finishedCharging", 4);
|
||||
|
||||
// ActionManager.registerTriggerProvider(new TriggerProviderEIO());
|
||||
// ActionManager.registerTriggerProvider(new TriggerProviderEIO());
|
||||
|
||||
proxy.load();
|
||||
|
||||
@@ -208,20 +211,21 @@ public class EnderIO {
|
||||
|
||||
packetPipeline.postInitialise();
|
||||
|
||||
// CrusherRecipeManager.getInstance().loadRecipesFromConfig();
|
||||
// AlloyRecipeManager.getInstance().loadRecipesFromConfig();
|
||||
// MaterialRecipes.addOreDictionaryRecipes();
|
||||
// MachineRecipes.addOreDictionaryRecipes();
|
||||
// ConduitRecipes.addOreDictionaryRecipes();
|
||||
// CrusherRecipeManager.getInstance().loadRecipesFromConfig();
|
||||
// AlloyRecipeManager.getInstance().loadRecipesFromConfig();
|
||||
// MaterialRecipes.addOreDictionaryRecipes();
|
||||
// MachineRecipes.addOreDictionaryRecipes();
|
||||
// ConduitRecipes.addOreDictionaryRecipes();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void serverStarted(FMLServerStartedEvent event) {
|
||||
// HyperCubeRegister.load();
|
||||
System.out.println("EnderIO.serverStarted: ");
|
||||
// HyperCubeRegister.load();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void serverStopped(FMLServerStoppedEvent event) {
|
||||
// HyperCubeRegister.unload();
|
||||
// HyperCubeRegister.unload();
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,5 @@
|
||||
package crazypants.enderio.enderface;
|
||||
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import crazypants.enderio.*;
|
||||
import crazypants.enderio.enderface.te.MeProxy;
|
||||
import crazypants.enderio.teleport.ITravelAccessable;
|
||||
import crazypants.util.Lang;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
@@ -18,6 +12,18 @@ import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.EnderIOTab;
|
||||
import crazypants.enderio.GuiHandler;
|
||||
import crazypants.enderio.Log;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.enderface.te.MeProxy;
|
||||
import crazypants.enderio.teleport.ITravelAccessable;
|
||||
import crazypants.util.Lang;
|
||||
|
||||
public class BlockEnderIO extends Block implements ITileEntityProvider {
|
||||
|
||||
@@ -42,8 +48,7 @@ public class BlockEnderIO extends Block implements ITileEntityProvider {
|
||||
|
||||
});
|
||||
|
||||
//TODO:1.7
|
||||
//PacketHandler.instance.addPacketProcessor(new EnderfacePacketProcessor());
|
||||
EnderIO.packetPipeline.registerPacket(PacketOpenRemoteUi.class);
|
||||
|
||||
BlockEnderIO result = new BlockEnderIO();
|
||||
result.init();
|
||||
@@ -69,6 +74,12 @@ public class BlockEnderIO extends Block implements ITileEntityProvider {
|
||||
GameRegistry.registerTileEntity(TileEnderIO.class, ModObject.blockEnderIo.unlocalisedName + "TileEntity");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderBlockPass() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack item) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
@@ -93,7 +104,7 @@ public class BlockEnderIO extends Block implements ITileEntityProvider {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te instanceof ITravelAccessable) {
|
||||
ITravelAccessable ta = (ITravelAccessable) te;
|
||||
System.out.println("crazypants.enderio.enderface.BlockEnderIO.onBlockActivated: Using as UI: " + entityPlayer.getUniqueID().toString());
|
||||
System.out.println("crazypants.enderio.enderface.BlockEnderIO.onBlockActivated: Using as UI: " + entityPlayer.getUniqueID().toString());
|
||||
if(ta.canUiBeAccessed(entityPlayer)) {
|
||||
entityPlayer.openGui(EnderIO.instance, GuiHandler.GUI_ID_TRAVEL_ACCESSABLE, world, x, y, z);
|
||||
} else {
|
||||
@@ -140,7 +151,6 @@ public class BlockEnderIO extends Block implements ITileEntityProvider {
|
||||
selectedOverlayIcon = IIconRegister.registerIcon("enderio:enderIOSelected");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World var1, int var2) {
|
||||
return new TileEnderIO();
|
||||
|
||||
@@ -1,13 +1,5 @@
|
||||
package crazypants.enderio.enderface;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.teleport.TravelEntitySpecialRenderer;
|
||||
import crazypants.render.BoundingBox;
|
||||
import crazypants.render.CubeRenderer;
|
||||
import crazypants.render.RenderUtil;
|
||||
import crazypants.vecmath.Matrix4d;
|
||||
import crazypants.vecmath.VecmathUtil;
|
||||
import crazypants.vecmath.Vector3d;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
@@ -17,8 +9,18 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.teleport.TravelEntitySpecialRenderer;
|
||||
import crazypants.render.BoundingBox;
|
||||
import crazypants.render.CubeRenderer;
|
||||
import crazypants.render.RenderUtil;
|
||||
import crazypants.vecmath.Matrix4d;
|
||||
import crazypants.vecmath.VecmathUtil;
|
||||
import crazypants.vecmath.Vector3d;
|
||||
|
||||
public class EnderIoRenderer extends TileEntitySpecialRenderer implements IItemRenderer {
|
||||
|
||||
private TravelEntitySpecialRenderer selectionRenderer = new TravelEntitySpecialRenderer() {
|
||||
@@ -40,6 +42,8 @@ public class EnderIoRenderer extends TileEntitySpecialRenderer implements IItemR
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) {
|
||||
|
||||
//System.out.println("EnderIoRenderer.renderTileEntityAt: " + x + "," + y + "," + z);
|
||||
|
||||
EntityLivingBase entityPlayer = Minecraft.getMinecraft().thePlayer;
|
||||
|
||||
Vector3d playerEye = new Vector3d(entityPlayer.posX, entityPlayer.posY + 1.62 - entityPlayer.yOffset, entityPlayer.posZ);
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
package crazypants.enderio.enderface;
|
||||
|
||||
import crazypants.enderio.Config;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.teleport.TravelController;
|
||||
import crazypants.render.RenderUtil;
|
||||
import crazypants.util.BlockCoord;
|
||||
import crazypants.vecmath.Camera;
|
||||
import crazypants.vecmath.Matrix4d;
|
||||
import crazypants.vecmath.VecmathUtil;
|
||||
import crazypants.vecmath.Vector3d;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
@@ -25,15 +21,22 @@ import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import crazypants.enderio.Config;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.teleport.TravelController;
|
||||
import crazypants.render.RenderUtil;
|
||||
import crazypants.util.BlockCoord;
|
||||
import crazypants.vecmath.Camera;
|
||||
import crazypants.vecmath.Matrix4d;
|
||||
import crazypants.vecmath.VecmathUtil;
|
||||
import crazypants.vecmath.Vector3d;
|
||||
|
||||
public class GuiEnderface extends GuiScreen {
|
||||
|
||||
@@ -61,7 +64,7 @@ public class GuiEnderface extends GuiScreen {
|
||||
private boolean animateInX = false;
|
||||
private boolean animateInY = false;
|
||||
// private boolean animating = true;
|
||||
float animationDuration = 180;
|
||||
float animationDuration = 60;
|
||||
|
||||
private final Vector3d origin = new Vector3d();
|
||||
private final Vector3d eye = new Vector3d();
|
||||
@@ -202,8 +205,9 @@ public class GuiEnderface extends GuiScreen {
|
||||
List<MovingObjectPosition> hits = new ArrayList<MovingObjectPosition>();
|
||||
for (ViewableBlocks ug : blocks) {
|
||||
if(!ug.bc.equals(new BlockCoord(ioX, ioY, ioZ))) {
|
||||
MovingObjectPosition res = ug.block.collisionRayTrace(world, ug.bc.x, ug.bc.y, ug.bc.z,
|
||||
Vec3.createVectorHelper(start.x, start.y, start.z), Vec3.createVectorHelper(end.x, end.y, end.z));
|
||||
MovingObjectPosition res = player.worldObj.rayTraceBlocks(Vec3.createVectorHelper(start.x, start.y, start.z),
|
||||
Vec3.createVectorHelper(end.x, end.y, end.z), false);
|
||||
|
||||
if(res != null) {
|
||||
hits.add(res);
|
||||
}
|
||||
@@ -213,11 +217,11 @@ public class GuiEnderface extends GuiScreen {
|
||||
if(hit != null) {
|
||||
Block block = world.getBlock(hit.blockX, hit.blockY, hit.blockZ);
|
||||
//TODO:1.7
|
||||
// if(block == EnderIO.blockHyperCube || block == EnderIO.blockCapacitorBank) {
|
||||
// block.onBlockActivated(world, hit.blockX, hit.blockY, hit.blockZ, player, 0, 0, 0, 0);
|
||||
// } else {
|
||||
openInterface(hit.blockX, hit.blockY, hit.blockZ);
|
||||
// }
|
||||
// if(block == EnderIO.blockHyperCube || block == EnderIO.blockCapacitorBank) {
|
||||
// block.onBlockActivated(world, hit.blockX, hit.blockY, hit.blockZ, player, 0, 0, 0, 0);
|
||||
// } else {
|
||||
openInterface(hit.blockX, hit.blockY, hit.blockZ);
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -260,6 +264,8 @@ public class GuiEnderface extends GuiScreen {
|
||||
|
||||
if(chunkLoaded) {
|
||||
|
||||
//TODO: Need to depth sort transparent passes
|
||||
|
||||
TravelController.instance.setSelectionEnabled(false);
|
||||
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
@@ -270,22 +276,26 @@ public class GuiEnderface extends GuiScreen {
|
||||
RenderUtil.bindBlockTexture();
|
||||
|
||||
Vector3d trans = new Vector3d((-origin.x) + eye.x, (-origin.y) + eye.y, (-origin.z) + eye.z);
|
||||
Tessellator.instance.startDrawingQuads();
|
||||
Tessellator.instance.setTranslation(trans.x, trans.y, trans.z);
|
||||
for (ViewableBlocks ug : blocks) {
|
||||
RB.setRenderBounds(0, 0, 0, 1, 1, 1);
|
||||
RB.renderBlockByRenderType(ug.block, ug.bc.x, ug.bc.y, ug.bc.z);
|
||||
for (int pass = 0; pass < 2; pass++) {
|
||||
|
||||
ForgeHooksClient.setRenderPass(pass);
|
||||
setGlStateForPass(pass);
|
||||
|
||||
Tessellator.instance.startDrawingQuads();
|
||||
Tessellator.instance.setTranslation(trans.x, trans.y, trans.z);
|
||||
|
||||
for (ViewableBlocks ug : blocks) {
|
||||
if(ug.block.canRenderInPass(pass)) {
|
||||
RB.setRenderBounds(0, 0, 0, 1, 1, 1);
|
||||
RB.renderBlockByRenderType(ug.block, ug.bc.x, ug.bc.y, ug.bc.z);
|
||||
}
|
||||
}
|
||||
Tessellator.instance.draw();
|
||||
Tessellator.instance.setTranslation(0, 0, 0);
|
||||
}
|
||||
Tessellator.instance.draw();
|
||||
Tessellator.instance.setTranslation(0, 0, 0);
|
||||
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
|
||||
|
||||
//TODO:1.7 check this
|
||||
// TileEntityRenderer.instance.playerX = origin.x - eye.x;
|
||||
// TileEntityRenderer.instance.playerY = origin.y - eye.y;
|
||||
// TileEntityRenderer.instance.playerZ = origin.z - eye.z;
|
||||
TileEntityRendererDispatcher.instance.field_147558_l = origin.x - eye.x;
|
||||
TileEntityRendererDispatcher.instance.field_147560_j = origin.y - eye.y;
|
||||
TileEntityRendererDispatcher.instance.field_147561_k = origin.z - eye.z;
|
||||
@@ -293,22 +303,48 @@ public class GuiEnderface extends GuiScreen {
|
||||
TileEntityRendererDispatcher.staticPlayerX = origin.x - eye.x;
|
||||
TileEntityRendererDispatcher.staticPlayerY = origin.y - eye.y;
|
||||
TileEntityRendererDispatcher.staticPlayerZ = origin.z - eye.z;
|
||||
for (ViewableBlocks ug : blocks) {
|
||||
TileEntity tile = world.getTileEntity(ug.bc.x, ug.bc.y, ug.bc.z);
|
||||
if(tile != null) {
|
||||
TileEntityRendererDispatcher.instance.renderTileEntity(tile, partialTick);
|
||||
|
||||
for (int pass = 0; pass < 2; pass++) {
|
||||
|
||||
ForgeHooksClient.setRenderPass(pass);
|
||||
setGlStateForPass(pass);
|
||||
|
||||
for (ViewableBlocks ug : blocks) {
|
||||
TileEntity tile = world.getTileEntity(ug.bc.x, ug.bc.y, ug.bc.z);
|
||||
if(tile != null) {
|
||||
Vector3d at = new Vector3d(eye.x - 0.5, eye.y - 0.5, eye.z - 0.5);
|
||||
at.x += ug.bc.x - ioX;
|
||||
at.y += ug.bc.y - ioY;
|
||||
at.z += ug.bc.z - ioZ;
|
||||
TileEntityRendererDispatcher.instance.renderTileEntityAt(tile, at.x, at.y, at.z, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ForgeHooksClient.setRenderPass(-1);
|
||||
setGlStateForPass(0);
|
||||
TravelController.instance.setSelectionEnabled(true);
|
||||
|
||||
} else {
|
||||
drawCenteredString(Minecraft.getMinecraft().fontRenderer, "EnderIO chunk not loaded.", width / 2, height / 2 - 32, 0xFFFFFFFF);
|
||||
}
|
||||
}
|
||||
|
||||
drawEffectOverlay(partialTick);
|
||||
}
|
||||
|
||||
private void setGlStateForPass(int pass) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
if(pass == 0) {
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glDepthMask(true);
|
||||
} else {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glDepthMask(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean updateCamera(float partialTick) {
|
||||
ScaledResolution scaledresolution = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);
|
||||
int vpx = guiLeft * scaledresolution.getScaleFactor();
|
||||
@@ -381,7 +417,7 @@ public class GuiEnderface extends GuiScreen {
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
mc.entityRenderer.enableLightmap(0);
|
||||
|
||||
renderPortalOverlay(0.9f - (0.1f * (1 - portalFade)), scaledresolution.getScaledWidth(), scaledresolution.getScaledHeight());
|
||||
renderPortalOverlay(0.8f - (0.2f * (1 - portalFade)), scaledresolution.getScaledWidth(), scaledresolution.getScaledHeight());
|
||||
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
@@ -397,7 +433,7 @@ public class GuiEnderface extends GuiScreen {
|
||||
if(par1 < 1.0F) {
|
||||
par1 *= par1;
|
||||
par1 *= par1;
|
||||
par1 = par1 * 0.8F + 0.2F;
|
||||
par1 = par1 * 0.9F + 0.1F;
|
||||
}
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, par1);
|
||||
RenderUtil.bindBlockTexture();
|
||||
@@ -528,15 +564,18 @@ public class GuiEnderface extends GuiScreen {
|
||||
void openInterface(int x, int y, int z) {
|
||||
|
||||
///TODO:1.7
|
||||
// if(MeProxy.instance.isMeAccessTerminal(player, x, y, z)) {
|
||||
// if(Config.enderIoMeAccessEnabled) {
|
||||
// Packet250CustomPayload pkt = EnderfacePacketProcessor.createMePacket(x, y, z);
|
||||
// PacketDispatcher.sendPacketToServer(pkt);
|
||||
// }
|
||||
// } else {
|
||||
// Packet250CustomPayload pkt = EnderfacePacketProcessor.createPacketEnderface(x, y, z);
|
||||
// PacketDispatcher.sendPacketToServer(pkt);
|
||||
// }
|
||||
// if(MeProxy.instance.isMeAccessTerminal(player, x, y, z)) {
|
||||
// if(Config.enderIoMeAccessEnabled) {
|
||||
// Packet250CustomPayload pkt = EnderfacePacketProcessor.createMePacket(x, y, z);
|
||||
// PacketDispatcher.sendPacketToServer(pkt);
|
||||
// }
|
||||
// } else {
|
||||
// Packet250CustomPayload pkt = EnderfacePacketProcessor.createPacketEnderface(x, y, z);
|
||||
// PacketDispatcher.sendPacketToServer(pkt);
|
||||
// }
|
||||
|
||||
PacketOpenRemoteUi p = new PacketOpenRemoteUi(x, y, z);
|
||||
EnderIO.packetPipeline.sendToServer(p);
|
||||
}
|
||||
|
||||
static class ViewableBlocks {
|
||||
|
||||
@@ -0,0 +1,227 @@
|
||||
package crazypants.enderio.enderface;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.ContainerBeacon;
|
||||
import net.minecraft.inventory.ContainerRepair;
|
||||
import net.minecraft.network.play.server.S2DPacketOpenWindow;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.management.ItemInWorldManager;
|
||||
import net.minecraft.tileentity.TileEntityBeacon;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import net.sf.cglib.proxy.Enhancer;
|
||||
import net.sf.cglib.proxy.MethodInterceptor;
|
||||
import net.sf.cglib.proxy.MethodProxy;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import crazypants.enderio.network.IPacketEio;
|
||||
|
||||
public class PacketOpenRemoteUi implements IPacketEio {
|
||||
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
|
||||
public PacketOpenRemoteUi() {
|
||||
}
|
||||
|
||||
public PacketOpenRemoteUi(int x, int y, int z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode(ChannelHandlerContext ctx, ByteBuf buffer) {
|
||||
buffer.writeInt(x);
|
||||
buffer.writeInt(y);
|
||||
buffer.writeInt(z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(ChannelHandlerContext ctx, ByteBuf buffer) {
|
||||
x = buffer.readInt();
|
||||
y = buffer.readInt();
|
||||
z = buffer.readInt();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleClientSide(EntityPlayer player) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleServerSide(EntityPlayer p) {
|
||||
|
||||
EntityPlayerMP player = (EntityPlayerMP) p;
|
||||
net.minecraft.inventory.Container c = player.openContainer;
|
||||
PlayerProxy pp = new PlayerProxy(player, x, y, z);
|
||||
EntityPlayerMP proxy = createPlayerProxy(player, pp);
|
||||
proxy.playerNetServerHandler = player.playerNetServerHandler;
|
||||
proxy.inventory = player.inventory;
|
||||
proxy.currentWindowId = player.currentWindowId;
|
||||
proxy.inventoryContainer = player.inventoryContainer;
|
||||
//proxy.mcServer = player.mcServer;
|
||||
proxy.openContainer = player.openContainer;
|
||||
//proxy.theItemInWorldManager = player.theItemInWorldManager;
|
||||
proxy.worldObj = player.worldObj;
|
||||
|
||||
System.out.println("PacketOpenRemoteUi.handleServerSide: " + x + "," + y + "," + z);
|
||||
|
||||
player.theItemInWorldManager.activateBlockOrUseItem(proxy, player.worldObj, null, x, y, z, 0, 0, 0, 0);
|
||||
player.theItemInWorldManager.thisPlayerMP = player;
|
||||
if(c != proxy.openContainer) {
|
||||
player.openContainer = proxy.openContainer;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static <T> T createPlayerProxy(EntityPlayerMP player, PlayerProxy proxy) {
|
||||
Enhancer e = new Enhancer();
|
||||
e.setCallback(proxy);
|
||||
|
||||
e.setSuperclass(player.getClass());
|
||||
Class<?>[] argTypes = new Class[] { MinecraftServer.class, WorldServer.class, GameProfile.class, ItemInWorldManager.class };
|
||||
Object[] args = new Object[] { player.mcServer, player.worldObj, player.getGameProfile(), player.theItemInWorldManager };
|
||||
|
||||
e.setInterceptDuringConstruction(false);
|
||||
@SuppressWarnings("unchecked")
|
||||
T proxifiedObj = (T) e.create(argTypes, args);
|
||||
|
||||
return proxifiedObj;
|
||||
}
|
||||
|
||||
public static class PlayerProxy implements MethodInterceptor {
|
||||
|
||||
private EntityPlayerMP realObj;
|
||||
|
||||
private Set<String> interceptNames = new HashSet<String>();
|
||||
|
||||
private Set<String> beaconNames = new HashSet<String>();
|
||||
private Set<String> anvilNames = new HashSet<String>();
|
||||
|
||||
private Set<String> distanceNames = new HashSet<String>();
|
||||
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
|
||||
public PlayerProxy(EntityPlayerMP obj, int x, int y, int z) {
|
||||
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
|
||||
// TODO: Move to config?
|
||||
this.realObj = obj;
|
||||
interceptNames.add("openGui");
|
||||
interceptNames.add("func_146100_a");
|
||||
|
||||
interceptNames.add("displayGUIBrewingStand");
|
||||
interceptNames.add("func_71017_a");
|
||||
interceptNames.add("func_146098_a");
|
||||
|
||||
interceptNames.add("displayGUIChest");
|
||||
interceptNames.add("func_71007_a");
|
||||
|
||||
interceptNames.add("displayGUIDispenser");
|
||||
interceptNames.add("func_71006_a");
|
||||
interceptNames.add("func_146102_a");
|
||||
|
||||
interceptNames.add("displayGUIEnchantment");
|
||||
interceptNames.add("func_71002_c");
|
||||
|
||||
interceptNames.add("displayGUIFurnace");
|
||||
interceptNames.add("func_71042_a");
|
||||
interceptNames.add("func_146101_a");
|
||||
|
||||
interceptNames.add("displayGUIWorkbench");
|
||||
interceptNames.add("func_71058_b");
|
||||
|
||||
interceptNames.add("displayGuiHopper"); // for when its added
|
||||
interceptNames.add("func_94064_a"); // displayGuiHopper
|
||||
|
||||
interceptNames.add("displayGUIHopper");
|
||||
interceptNames.add("func_146093_a");
|
||||
|
||||
beaconNames.add("displayGUIBeacon");
|
||||
beaconNames.add("func_82240_a");
|
||||
beaconNames.add("func_146104_a");
|
||||
|
||||
anvilNames.add("displayGUIAnvil");
|
||||
anvilNames.add("func_82244_d");
|
||||
|
||||
distanceNames.add("getDistanceSq");
|
||||
distanceNames.add("getDistance");
|
||||
distanceNames.add("func_70092_e");
|
||||
distanceNames.add("func_70011_f");
|
||||
distanceNames.add("func_71569_e");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {
|
||||
|
||||
System.out.println("PacketOpenRemoteUi.PlayerProxy.intercept: 1 " + method.getName());
|
||||
if(interceptNames.contains(method.getName())) {
|
||||
|
||||
Object res = method.invoke(realObj, objects);
|
||||
if(realObj.openContainer != null) {
|
||||
realObj.openContainer = new ContainerWrapper(realObj.openContainer);
|
||||
}
|
||||
return res;
|
||||
|
||||
} else if(beaconNames.contains(method.getName())) {
|
||||
|
||||
// Beacon needs to be done manually for some reason to work properly
|
||||
TileEntityBeacon par1TileEntityBeacon = (TileEntityBeacon) objects[0];
|
||||
realObj.getNextWindowId();
|
||||
|
||||
realObj.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(realObj.currentWindowId, 7, par1TileEntityBeacon.getInventoryName(),
|
||||
par1TileEntityBeacon.getSizeInventory(), true));
|
||||
|
||||
realObj.openContainer = new ContainerBeacon(realObj.inventory, par1TileEntityBeacon) {
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer par1EntityPlayer) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
realObj.openContainer.windowId = realObj.currentWindowId;
|
||||
realObj.openContainer.addCraftingToCrafters(realObj);
|
||||
return null;
|
||||
|
||||
} else if(anvilNames.contains(method.getName())) {
|
||||
|
||||
realObj.getNextWindowId();
|
||||
realObj.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(realObj.currentWindowId, 8, "Repairing", 9, true));
|
||||
|
||||
realObj.openContainer = new ContainerRepair(realObj.inventory, realObj.worldObj, ((Integer) objects[0]).intValue(), ((Integer) objects[1]).intValue(),
|
||||
((Integer) objects[2]).intValue(), realObj) {
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer par1EntityPlayer) {
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
realObj.openContainer.windowId = realObj.currentWindowId;
|
||||
realObj.openContainer.addCraftingToCrafters(realObj);
|
||||
return null;
|
||||
|
||||
} else if(distanceNames.contains(method.getName())) {
|
||||
return 6;
|
||||
}
|
||||
method.setAccessible(true);
|
||||
return method.invoke(realObj, objects);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -119,7 +119,7 @@ public class PacketPipeline extends MessageToMessageCodec<FMLProxyPacket, IPacke
|
||||
|
||||
// Method to call from FMLInitializationEvent
|
||||
public void initalise() {
|
||||
this.channels = NetworkRegistry.INSTANCE.newChannel("TConstruct", this);
|
||||
this.channels = NetworkRegistry.INSTANCE.newChannel("EnderIO", this);
|
||||
registerPackets();
|
||||
}
|
||||
|
||||
|
||||
@@ -6,11 +6,15 @@ 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.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent;
|
||||
import cpw.mods.fml.common.network.IGuiHandler;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import crazypants.enderio.Config;
|
||||
@@ -19,6 +23,7 @@ import crazypants.enderio.EnderIOTab;
|
||||
import crazypants.enderio.GuiHandler;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.teleport.packet.PacketAccessMode;
|
||||
import crazypants.enderio.teleport.packet.PacketConfigSync;
|
||||
import crazypants.enderio.teleport.packet.PacketDrainStaff;
|
||||
import crazypants.enderio.teleport.packet.PacketOpenAuthGui;
|
||||
import crazypants.enderio.teleport.packet.PacketTravelEvent;
|
||||
@@ -28,21 +33,26 @@ public class BlockTravelAnchor extends Block implements IGuiHandler, ITileEntity
|
||||
|
||||
public static BlockTravelAnchor create() {
|
||||
|
||||
//TODO: 1.7
|
||||
//TravelPacketHandler pp = new TravelPacketHandler();
|
||||
//PacketHandler.instance.addPacketProcessor(pp);
|
||||
//NetworkRegistry.instance().registerConnectionHandler(pp);
|
||||
|
||||
EnderIO.packetPipeline.registerPacket(PacketAccessMode.class);
|
||||
EnderIO.packetPipeline.registerPacket(PacketTravelEvent.class);
|
||||
EnderIO.packetPipeline.registerPacket(PacketDrainStaff.class);
|
||||
EnderIO.packetPipeline.registerPacket(PacketOpenAuthGui.class);
|
||||
EnderIO.packetPipeline.registerPacket(PacketConfigSync.class);
|
||||
|
||||
BlockTravelAnchor result = new BlockTravelAnchor();
|
||||
result.init();
|
||||
|
||||
FMLCommonHandler.instance().bus().register(result);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//to lazy to create a new class
|
||||
@SubscribeEvent
|
||||
public void onPlayerLoggon(PlayerLoggedInEvent evt) {
|
||||
EnderIO.packetPipeline.sendTo(new PacketConfigSync(), (EntityPlayerMP) evt.player);
|
||||
}
|
||||
|
||||
IIcon selectedOverlayIcon;
|
||||
IIcon highlightOverlayIcon;
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ public class ItemTravelStaff extends ItemEnergyContainer implements IEnergyConta
|
||||
}
|
||||
|
||||
public void setFull(ItemStack container) {
|
||||
setEnergy(container, getMaxEnergyStored(container));
|
||||
setEnergy(container, Config.travelStaffMaxStoredPower * 10);
|
||||
}
|
||||
|
||||
private void updateDamage(ItemStack stack) {
|
||||
|
||||
@@ -177,16 +177,16 @@ public class TravelController {
|
||||
if(eio.canBlockBeAccessed(player)) {
|
||||
|
||||
int requiredPower = equipped == null ? 0 : TravelController.instance.getRequiredPower(player, TravelSource.STAFF, target);
|
||||
if(requiredPower <= 0 || requiredPower <= EnderIO.itemTravelStaff.getEnergyStored(equipped)) {
|
||||
if(requiredPower >= 0 && requiredPower <= EnderIO.itemTravelStaff.getEnergyStored(equipped)) {
|
||||
if(requiredPower > 0) {
|
||||
PacketDrainStaff p = new PacketDrainStaff(requiredPower);
|
||||
EnderIO.packetPipeline.sendToServer(p);
|
||||
}
|
||||
player.openGui(EnderIO.instance, GuiHandler.GUI_ID_ENDERFACE, world, target.x,
|
||||
TravelController.instance.selectedCoord.y, TravelController.instance.selectedCoord.z);
|
||||
} else {
|
||||
player.addChatComponentMessage(new ChatComponentTranslation("enderio.gui.travelAccessable.unauthorised"));
|
||||
}
|
||||
} else {
|
||||
player.addChatComponentMessage(new ChatComponentTranslation("enderio.gui.travelAccessable.unauthorised"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,12 +208,11 @@ public class TravelController {
|
||||
}
|
||||
|
||||
int requiredPower = 0;
|
||||
if(source == TravelSource.STAFF_BLINK) {
|
||||
requiredPower = getRequiredPower(player, source, coord);
|
||||
if(requiredPower < 0) {
|
||||
return false;
|
||||
}
|
||||
requiredPower = getRequiredPower(player, source, coord);
|
||||
if(requiredPower < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!isInRangeTarget(player, coord, source.maxDistanceTravelledSq)) {
|
||||
if(source != TravelSource.STAFF_BLINK) {
|
||||
player.addChatComponentMessage(new ChatComponentTranslation("enderio.blockTravelPlatform.outOfRange"));
|
||||
|
||||
@@ -1,167 +0,0 @@
|
||||
package crazypants.enderio.teleport;
|
||||
|
||||
import crazypants.enderio.IPacketProcessor;
|
||||
import crazypants.enderio.PacketHandler;
|
||||
|
||||
//TODO:1.7
|
||||
public class TravelPacketHandler implements IPacketProcessor/*
|
||||
* ,
|
||||
* IConnectionHandler
|
||||
*/{
|
||||
|
||||
@Override
|
||||
public boolean canProcessPacket(int packetID) {
|
||||
return packetID == PacketHandler.ID_TRAVEL_AUTH_ACCESS_MODE || packetID == PacketHandler.ID_TRAVEL_AUTH_GUI || packetID == PacketHandler.ID_TRAVEL_PLATFORM
|
||||
|| packetID == PacketHandler.ID_TRAVEL_STAFF_DRAIN
|
||||
|| packetID == PacketHandler.ID_TRAVEL_SETTINGS;
|
||||
}
|
||||
|
||||
// public static Packet createAccessModePacket(int x, int y, int z, AccessMode mode) {
|
||||
// ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
// DataOutputStream dos = new DataOutputStream(bos);
|
||||
// try {
|
||||
// dos.writeInt(PacketHandler.ID_TRAVEL_AUTH_ACCESS_MODE);
|
||||
// dos.writeInt(x);
|
||||
// dos.writeInt(y);
|
||||
// dos.writeInt(z);
|
||||
// dos.writeShort(mode.ordinal());
|
||||
// } catch (IOException e) {
|
||||
// // never thrown
|
||||
// }
|
||||
// Packet250CustomPayload pkt = new Packet250CustomPayload();
|
||||
// pkt.channel = PacketHandler.CHANNEL;
|
||||
// pkt.data = bos.toByteArray();
|
||||
// pkt.length = bos.size();
|
||||
// pkt.isChunkDataPacket = true;
|
||||
// return pkt;
|
||||
// }
|
||||
//
|
||||
// private void processAuthModePacket(DataInputStream data, Player player) throws IOException {
|
||||
// if(!(player instanceof EntityPlayer)) {
|
||||
// return;
|
||||
// }
|
||||
// EntityPlayer ep = (EntityPlayer) player;
|
||||
// int x = data.readInt();
|
||||
// int y = data.readInt();
|
||||
// int z = data.readInt();
|
||||
// AccessMode mode = AccessMode.values()[data.readShort()];
|
||||
//
|
||||
// TileEntity te = ep.worldObj.getTileEntity(x, y, z);
|
||||
// if(te instanceof TileTravelAnchor) {
|
||||
// ((TileTravelAnchor) te).setAccessMode(mode);
|
||||
// ep.worldObj.markBlockForUpdate(x, y, z);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// public static Packet createOpenAuthGuiPacket(int x, int y, int z) {
|
||||
// ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
// DataOutputStream dos = new DataOutputStream(bos);
|
||||
// try {
|
||||
// dos.writeInt(PacketHandler.ID_TRAVEL_AUTH_GUI);
|
||||
// dos.writeInt(x);
|
||||
// dos.writeInt(y);
|
||||
// dos.writeInt(z);
|
||||
// } catch (IOException e) {
|
||||
// // never thrown
|
||||
// }
|
||||
// Packet250CustomPayload pkt = new Packet250CustomPayload();
|
||||
// pkt.channel = PacketHandler.CHANNEL;
|
||||
// pkt.data = bos.toByteArray();
|
||||
// pkt.length = bos.size();
|
||||
// pkt.isChunkDataPacket = true;
|
||||
// return pkt;
|
||||
// }
|
||||
//
|
||||
// private void processOpenGuiPacket(DataInputStream data, Player player) throws IOException {
|
||||
// if(!(player instanceof EntityPlayer)) {
|
||||
// return;
|
||||
// }
|
||||
// EntityPlayer ep = (EntityPlayer) player;
|
||||
// int x = data.readInt();
|
||||
// int y = data.readInt();
|
||||
// int z = data.readInt();
|
||||
// ep.openGui(EnderIO.instance, GuiHandler.GUI_ID_TRAVEL_AUTH, ep.worldObj, x, y, z);
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// public static Packet createTravelSettingsPacket() {
|
||||
// ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
// DataOutputStream dos = new DataOutputStream(bos);
|
||||
// try {
|
||||
// dos.writeInt(PacketHandler.ID_TRAVEL_SETTINGS);
|
||||
// dos.writeBoolean(Config.travelAnchorEnabled);
|
||||
// dos.writeInt(Config.travelAnchorMaxDistance);
|
||||
//
|
||||
// dos.writeBoolean(Config.travelStaffEnabled);
|
||||
// dos.writeBoolean(Config.travelStaffBlinkEnabled);
|
||||
// dos.writeBoolean(Config.travelStaffBlinkThroughSolidBlocksEnabled);
|
||||
// dos.writeBoolean(Config.travelStaffBlinkThroughClearBlocksEnabled);
|
||||
//
|
||||
// dos.writeInt(Config.travelStaffBlinkPauseTicks);
|
||||
// dos.writeInt(Config.travelStaffMaxDistance);
|
||||
// dos.writeInt(Config.travelStaffMaxPowerIo);
|
||||
// dos.writeInt(Config.travelStaffMaxBlinkDistance);
|
||||
// dos.writeFloat(Config.travelStaffPowerPerBlock);
|
||||
//
|
||||
// } catch (IOException e) {
|
||||
// // never thrown
|
||||
// }
|
||||
// Packet250CustomPayload pkt = new Packet250CustomPayload();
|
||||
// pkt.channel = PacketHandler.CHANNEL;
|
||||
// pkt.data = bos.toByteArray();
|
||||
// pkt.length = bos.size();
|
||||
// pkt.isChunkDataPacket = true;
|
||||
// return pkt;
|
||||
// }
|
||||
//
|
||||
// private void processSettingsPacket(DataInputStream data, Player player) throws IOException {
|
||||
// Config.travelAnchorEnabled = data.readBoolean();
|
||||
// Config.travelAnchorMaxDistance = data.readInt();
|
||||
//
|
||||
// Config.travelStaffEnabled = data.readBoolean();
|
||||
// Config.travelStaffBlinkEnabled = data.readBoolean();
|
||||
// Config.travelStaffBlinkThroughSolidBlocksEnabled = data.readBoolean();
|
||||
// Config.travelStaffBlinkThroughClearBlocksEnabled = data.readBoolean();
|
||||
// Config.travelStaffBlinkPauseTicks = data.readInt();
|
||||
// Config.travelStaffMaxDistance = data.readInt();
|
||||
// Config.travelStaffMaxPowerIo = data.readInt();
|
||||
// Config.travelStaffMaxBlinkDistance = data.readInt();
|
||||
// Config.travelStaffPowerPerBlock = data.readFloat();
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void playerLoggedIn(Player player, NetHandler netHandler, INetworkManager manager) {
|
||||
// //send config values to players when they log in
|
||||
// PacketDispatcher.sendPacketToPlayer(createTravelSettingsPacket(), player);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String connectionReceived(NetLoginHandler netHandler, INetworkManager manager) {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager) {
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void connectionOpened(NetHandler netClientHandler, MinecraftServer server, INetworkManager manager) {
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void connectionClosed(INetworkManager manager) {
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void clientLoggedIn(NetHandler clientHandler, INetworkManager manager, Packet1Login login) {
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package crazypants.enderio.teleport.packet;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import crazypants.enderio.Config;
|
||||
import crazypants.enderio.network.IPacketEio;
|
||||
|
||||
public class PacketConfigSync implements IPacketEio {
|
||||
|
||||
@Override
|
||||
public void encode(ChannelHandlerContext ctx, ByteBuf dos) {
|
||||
dos.writeBoolean(Config.travelAnchorEnabled);
|
||||
dos.writeInt(Config.travelAnchorMaxDistance);
|
||||
dos.writeBoolean(Config.travelStaffEnabled);
|
||||
dos.writeBoolean(Config.travelStaffBlinkEnabled);
|
||||
dos.writeBoolean(Config.travelStaffBlinkThroughSolidBlocksEnabled);
|
||||
dos.writeBoolean(Config.travelStaffBlinkThroughClearBlocksEnabled);
|
||||
dos.writeInt(Config.travelStaffBlinkPauseTicks);
|
||||
dos.writeInt(Config.travelStaffMaxDistance);
|
||||
dos.writeInt(Config.travelStaffMaxPowerIo);
|
||||
dos.writeInt(Config.travelStaffMaxBlinkDistance);
|
||||
dos.writeFloat(Config.travelStaffPowerPerBlock);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decode(ChannelHandlerContext ctx, ByteBuf data) {
|
||||
Config.travelAnchorEnabled = data.readBoolean();
|
||||
Config.travelAnchorMaxDistance = data.readInt();
|
||||
Config.travelStaffEnabled = data.readBoolean();
|
||||
Config.travelStaffBlinkEnabled = data.readBoolean();
|
||||
Config.travelStaffBlinkThroughSolidBlocksEnabled = data.readBoolean();
|
||||
Config.travelStaffBlinkThroughClearBlocksEnabled = data.readBoolean();
|
||||
Config.travelStaffBlinkPauseTicks = data.readInt();
|
||||
Config.travelStaffMaxDistance = data.readInt();
|
||||
Config.travelStaffMaxPowerIo = data.readInt();
|
||||
Config.travelStaffMaxBlinkDistance = data.readInt();
|
||||
Config.travelStaffPowerPerBlock = data.readFloat();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleClientSide(EntityPlayer player) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleServerSide(EntityPlayer player) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user