Removed "upgrade dump" configurator mode, upgrades can now be removed in GUIs
This commit is contained in:
parent
0fb90be4c7
commit
37e442c17b
8 changed files with 205 additions and 43 deletions
|
@ -47,7 +47,7 @@ public class ClientPlayerTickHandler implements ITickHandler
|
||||||
{
|
{
|
||||||
if(!lastTickConfiguratorChange)
|
if(!lastTickConfiguratorChange)
|
||||||
{
|
{
|
||||||
item.setState(stack, (byte)(item.getState(stack) < 3 ? item.getState(stack)+1 : 0));
|
item.setState(stack, (byte)(item.getState(stack) < 2 ? item.getState(stack)+1 : 0));
|
||||||
PacketHandler.sendPacket(Transmission.SERVER, new PacketConfiguratorState().setParams(item.getState(stack)));
|
PacketHandler.sendPacket(Transmission.SERVER, new PacketConfiguratorState().setParams(item.getState(stack)));
|
||||||
entityPlayer.sendChatToPlayer(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + "Configure State: " + item.getColor(item.getState(stack)) + item.getState(item.getState(stack)));
|
entityPlayer.sendChatToPlayer(EnumColor.DARK_BLUE + "[Mekanism] " + EnumColor.GREY + "Configure State: " + item.getColor(item.getState(stack)) + item.getState(item.getState(stack)));
|
||||||
lastTickConfiguratorChange = true;
|
lastTickConfiguratorChange = true;
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
package mekanism.client;
|
package mekanism.client;
|
||||||
|
|
||||||
|
import mekanism.api.Object3D;
|
||||||
import mekanism.common.ContainerAdvancedElectricMachine;
|
import mekanism.common.ContainerAdvancedElectricMachine;
|
||||||
|
import mekanism.common.PacketHandler;
|
||||||
import mekanism.common.TileEntityAdvancedElectricMachine;
|
import mekanism.common.TileEntityAdvancedElectricMachine;
|
||||||
|
import mekanism.common.PacketHandler.Transmission;
|
||||||
|
import mekanism.common.network.PacketRemoveUpgrade;
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
|
||||||
|
@ -39,6 +43,16 @@ public class GuiAdvancedElectricMachine extends GuiContainer
|
||||||
{
|
{
|
||||||
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(tileEntity.electricityStored, ElectricUnit.JOULES), xAxis, yAxis);
|
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(tileEntity.electricityStored, ElectricUnit.JOULES), xAxis, yAxis);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(xAxis >= 179 && xAxis <= 198 && yAxis >= 47 && yAxis <= 54)
|
||||||
|
{
|
||||||
|
drawCreativeTabHoveringText("Remove speed upgrade", xAxis, yAxis);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(xAxis >= 179 && xAxis <= 198 && yAxis >= 57 && yAxis <= 64)
|
||||||
|
{
|
||||||
|
drawCreativeTabHoveringText("Remove energy upgrade", xAxis, yAxis);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -63,4 +77,28 @@ public class GuiAdvancedElectricMachine extends GuiContainer
|
||||||
displayInt = tileEntity.getScaledUpgradeProgress(14);
|
displayInt = tileEntity.getScaledUpgradeProgress(14);
|
||||||
drawTexturedModalRect(guiWidth + 180, guiHeight + 30, 176 + 26, 71, 10, displayInt);
|
drawTexturedModalRect(guiWidth + 180, guiHeight + 30, 176 + 26, 71, 10, displayInt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mouseClicked(int mouseX, int mouseY, int button)
|
||||||
|
{
|
||||||
|
super.mouseClicked(mouseX, mouseY, button);
|
||||||
|
|
||||||
|
if(button == 0)
|
||||||
|
{
|
||||||
|
int xAxis = (mouseX - (width - xSize) / 2);
|
||||||
|
int yAxis = (mouseY - (height - ySize) / 2);
|
||||||
|
|
||||||
|
if(xAxis >= 179 && xAxis <= 198 && yAxis >= 47 && yAxis <= 54)
|
||||||
|
{
|
||||||
|
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||||
|
PacketHandler.sendPacket(Transmission.SERVER, new PacketRemoveUpgrade().setParams(Object3D.get(tileEntity), (byte)0));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(xAxis >= 179 && xAxis <= 198 && yAxis >= 57 && yAxis <= 64)
|
||||||
|
{
|
||||||
|
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||||
|
PacketHandler.sendPacket(Transmission.SERVER, new PacketRemoveUpgrade().setParams(Object3D.get(tileEntity), (byte)1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,11 @@
|
||||||
package mekanism.client;
|
package mekanism.client;
|
||||||
|
|
||||||
|
import mekanism.api.Object3D;
|
||||||
import mekanism.common.ContainerElectricMachine;
|
import mekanism.common.ContainerElectricMachine;
|
||||||
|
import mekanism.common.PacketHandler;
|
||||||
import mekanism.common.TileEntityElectricMachine;
|
import mekanism.common.TileEntityElectricMachine;
|
||||||
|
import mekanism.common.PacketHandler.Transmission;
|
||||||
|
import mekanism.common.network.PacketRemoveUpgrade;
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
|
||||||
|
@ -9,7 +13,6 @@ import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import universalelectricity.core.electricity.ElectricityDisplay;
|
import universalelectricity.core.electricity.ElectricityDisplay;
|
||||||
import universalelectricity.core.electricity.ElectricityDisplay.ElectricUnit;
|
import universalelectricity.core.electricity.ElectricityDisplay.ElectricUnit;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
@ -40,6 +43,16 @@ public class GuiElectricMachine extends GuiContainer
|
||||||
{
|
{
|
||||||
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(tileEntity.electricityStored, ElectricUnit.JOULES), xAxis, yAxis);
|
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(tileEntity.electricityStored, ElectricUnit.JOULES), xAxis, yAxis);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(xAxis >= 179 && xAxis <= 198 && yAxis >= 47 && yAxis <= 54)
|
||||||
|
{
|
||||||
|
drawCreativeTabHoveringText("Remove speed upgrade", xAxis, yAxis);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(xAxis >= 179 && xAxis <= 198 && yAxis >= 57 && yAxis <= 64)
|
||||||
|
{
|
||||||
|
drawCreativeTabHoveringText("Remove energy upgrade", xAxis, yAxis);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -61,4 +74,28 @@ public class GuiElectricMachine extends GuiContainer
|
||||||
displayInt = tileEntity.getScaledUpgradeProgress(14);
|
displayInt = tileEntity.getScaledUpgradeProgress(14);
|
||||||
drawTexturedModalRect(guiWidth + 180, guiHeight + 30, 176 + 26, 59, 10, displayInt);
|
drawTexturedModalRect(guiWidth + 180, guiHeight + 30, 176 + 26, 59, 10, displayInt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mouseClicked(int mouseX, int mouseY, int button)
|
||||||
|
{
|
||||||
|
super.mouseClicked(mouseX, mouseY, button);
|
||||||
|
|
||||||
|
if(button == 0)
|
||||||
|
{
|
||||||
|
int xAxis = (mouseX - (width - xSize) / 2);
|
||||||
|
int yAxis = (mouseY - (height - ySize) / 2);
|
||||||
|
|
||||||
|
if(xAxis >= 179 && xAxis <= 198 && yAxis >= 47 && yAxis <= 54)
|
||||||
|
{
|
||||||
|
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||||
|
PacketHandler.sendPacket(Transmission.SERVER, new PacketRemoveUpgrade().setParams(Object3D.get(tileEntity), (byte)0));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(xAxis >= 179 && xAxis <= 198 && yAxis >= 57 && yAxis <= 64)
|
||||||
|
{
|
||||||
|
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||||
|
PacketHandler.sendPacket(Transmission.SERVER, new PacketRemoveUpgrade().setParams(Object3D.get(tileEntity), (byte)1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,9 +1,13 @@
|
||||||
package mekanism.client;
|
package mekanism.client;
|
||||||
|
|
||||||
|
import mekanism.api.Object3D;
|
||||||
import mekanism.common.ContainerFactory;
|
import mekanism.common.ContainerFactory;
|
||||||
import mekanism.common.TileEntityFactory;
|
|
||||||
import mekanism.common.IFactory.RecipeType;
|
import mekanism.common.IFactory.RecipeType;
|
||||||
|
import mekanism.common.PacketHandler;
|
||||||
|
import mekanism.common.PacketHandler.Transmission;
|
||||||
import mekanism.common.Tier.FactoryTier;
|
import mekanism.common.Tier.FactoryTier;
|
||||||
|
import mekanism.common.TileEntityFactory;
|
||||||
|
import mekanism.common.network.PacketRemoveUpgrade;
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
|
||||||
|
@ -11,7 +15,6 @@ import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import universalelectricity.core.electricity.ElectricityDisplay;
|
import universalelectricity.core.electricity.ElectricityDisplay;
|
||||||
import universalelectricity.core.electricity.ElectricityDisplay.ElectricUnit;
|
import universalelectricity.core.electricity.ElectricityDisplay.ElectricUnit;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
@ -43,6 +46,16 @@ public class GuiFactory extends GuiContainer
|
||||||
{
|
{
|
||||||
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(tileEntity.electricityStored, ElectricUnit.JOULES), xAxis, yAxis);
|
drawCreativeTabHoveringText(ElectricityDisplay.getDisplayShort(tileEntity.electricityStored, ElectricUnit.JOULES), xAxis, yAxis);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(xAxis >= 179 && xAxis <= 198 && yAxis >= 47 && yAxis <= 54)
|
||||||
|
{
|
||||||
|
drawCreativeTabHoveringText("Remove speed upgrade", xAxis, yAxis);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(xAxis >= 179 && xAxis <= 198 && yAxis >= 57 && yAxis <= 64)
|
||||||
|
{
|
||||||
|
drawCreativeTabHoveringText("Remove energy upgrade", xAxis, yAxis);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -96,4 +109,28 @@ public class GuiFactory extends GuiContainer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mouseClicked(int mouseX, int mouseY, int button)
|
||||||
|
{
|
||||||
|
super.mouseClicked(mouseX, mouseY, button);
|
||||||
|
|
||||||
|
if(button == 0)
|
||||||
|
{
|
||||||
|
int xAxis = (mouseX - (width - xSize) / 2);
|
||||||
|
int yAxis = (mouseY - (height - ySize) / 2);
|
||||||
|
|
||||||
|
if(xAxis >= 179 && xAxis <= 198 && yAxis >= 47 && yAxis <= 54)
|
||||||
|
{
|
||||||
|
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||||
|
PacketHandler.sendPacket(Transmission.SERVER, new PacketRemoveUpgrade().setParams(Object3D.get(tileEntity), (byte)0));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(xAxis >= 179 && xAxis <= 198 && yAxis >= 57 && yAxis <= 64)
|
||||||
|
{
|
||||||
|
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
|
||||||
|
PacketHandler.sendPacket(Transmission.SERVER, new PacketRemoveUpgrade().setParams(Object3D.get(tileEntity), (byte)1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import java.util.Random;
|
||||||
|
|
||||||
import mekanism.api.EnumColor;
|
import mekanism.api.EnumColor;
|
||||||
import mekanism.api.IConfigurable;
|
import mekanism.api.IConfigurable;
|
||||||
import mekanism.api.IUpgradeManagement;
|
|
||||||
import mekanism.api.Object3D;
|
import mekanism.api.Object3D;
|
||||||
import mekanism.common.PacketHandler.Transmission;
|
import mekanism.common.PacketHandler.Transmission;
|
||||||
import mekanism.common.network.PacketTileEntity;
|
import mekanism.common.network.PacketTileEntity;
|
||||||
|
@ -147,37 +146,6 @@ public class ItemConfigurator extends ItemEnergized
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(getState(stack) == 2)
|
else if(getState(stack) == 2)
|
||||||
{
|
|
||||||
if(world.getBlockTileEntity(x, y, z) instanceof IUpgradeManagement)
|
|
||||||
{
|
|
||||||
Random random = new Random();
|
|
||||||
IUpgradeManagement management = (IUpgradeManagement)world.getBlockTileEntity(x, y, z);
|
|
||||||
ItemStack[] upgradeStacks = new ItemStack[] {new ItemStack(Mekanism.SpeedUpgrade, management.getSpeedMultiplier()), new ItemStack(Mekanism.EnergyUpgrade, management.getEnergyMultiplier())};
|
|
||||||
|
|
||||||
for(ItemStack upgrade : upgradeStacks)
|
|
||||||
{
|
|
||||||
if(upgrade.stackSize > 0)
|
|
||||||
{
|
|
||||||
float xRandom = random.nextFloat() * 0.8F + 0.1F;
|
|
||||||
float yRandom = random.nextFloat() * 0.8F + 0.1F;
|
|
||||||
float zRandom = random.nextFloat() * 0.8F + 0.1F;
|
|
||||||
|
|
||||||
EntityItem item = new EntityItem(world, x + xRandom, y + yRandom, z + zRandom, upgrade);
|
|
||||||
|
|
||||||
float k = 0.05F;
|
|
||||||
item.motionX = random.nextGaussian() * k;
|
|
||||||
item.motionY = random.nextGaussian() * k + 0.2F;
|
|
||||||
item.motionZ = random.nextGaussian() * k;
|
|
||||||
world.spawnEntityInWorld(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
management.setSpeedMultiplier(0);
|
|
||||||
management.setEnergyMultiplier(0);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if(getState(stack) == 3)
|
|
||||||
{
|
{
|
||||||
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||||
|
|
||||||
|
@ -217,8 +185,6 @@ public class ItemConfigurator extends ItemEnergized
|
||||||
case 1:
|
case 1:
|
||||||
return "empty";
|
return "empty";
|
||||||
case 2:
|
case 2:
|
||||||
return "upgrade dump";
|
|
||||||
case 3:
|
|
||||||
return "wrench";
|
return "wrench";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,8 +201,6 @@ public class ItemConfigurator extends ItemEnergized
|
||||||
return EnumColor.AQUA;
|
return EnumColor.AQUA;
|
||||||
case 2:
|
case 2:
|
||||||
return EnumColor.YELLOW;
|
return EnumColor.YELLOW;
|
||||||
case 3:
|
|
||||||
return EnumColor.ORANGE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return EnumColor.GREY;
|
return EnumColor.GREY;
|
||||||
|
|
|
@ -30,6 +30,7 @@ import mekanism.common.network.PacketElectricBowState;
|
||||||
import mekanism.common.network.PacketElectricChest;
|
import mekanism.common.network.PacketElectricChest;
|
||||||
import mekanism.common.network.PacketPortableTeleport;
|
import mekanism.common.network.PacketPortableTeleport;
|
||||||
import mekanism.common.network.PacketPortalFX;
|
import mekanism.common.network.PacketPortalFX;
|
||||||
|
import mekanism.common.network.PacketRemoveUpgrade;
|
||||||
import mekanism.common.network.PacketRobit;
|
import mekanism.common.network.PacketRobit;
|
||||||
import mekanism.common.network.PacketStatusUpdate;
|
import mekanism.common.network.PacketStatusUpdate;
|
||||||
import mekanism.common.network.PacketTileEntity;
|
import mekanism.common.network.PacketTileEntity;
|
||||||
|
@ -1192,6 +1193,7 @@ public class Mekanism
|
||||||
PacketHandler.registerPacket(PacketStatusUpdate.class);
|
PacketHandler.registerPacket(PacketStatusUpdate.class);
|
||||||
PacketHandler.registerPacket(PacketDigitUpdate.class);
|
PacketHandler.registerPacket(PacketDigitUpdate.class);
|
||||||
PacketHandler.registerPacket(PacketPortableTeleport.class);
|
PacketHandler.registerPacket(PacketPortableTeleport.class);
|
||||||
|
PacketHandler.registerPacket(PacketRemoveUpgrade.class);
|
||||||
|
|
||||||
//Donators
|
//Donators
|
||||||
donators.add("mrgreaper");
|
donators.add("mrgreaper");
|
||||||
|
|
84
common/mekanism/common/network/PacketRemoveUpgrade.java
Normal file
84
common/mekanism/common/network/PacketRemoveUpgrade.java
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
package mekanism.common.network;
|
||||||
|
|
||||||
|
import java.io.DataOutputStream;
|
||||||
|
|
||||||
|
import mekanism.api.IUpgradeManagement;
|
||||||
|
import mekanism.api.Object3D;
|
||||||
|
import mekanism.common.Mekanism;
|
||||||
|
import mekanism.common.TileEntityBasicBlock;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import com.google.common.io.ByteArrayDataInput;
|
||||||
|
|
||||||
|
public class PacketRemoveUpgrade implements IMekanismPacket
|
||||||
|
{
|
||||||
|
public Object3D object3D;
|
||||||
|
|
||||||
|
public byte upgradeType;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName()
|
||||||
|
{
|
||||||
|
return "RemoveUpgrade";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IMekanismPacket setParams(Object... data)
|
||||||
|
{
|
||||||
|
object3D = (Object3D)data[0];
|
||||||
|
upgradeType = (Byte)data[1];
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void read(ByteArrayDataInput dataStream, EntityPlayer player, World world) throws Exception
|
||||||
|
{
|
||||||
|
int x = dataStream.readInt();
|
||||||
|
int y = dataStream.readInt();
|
||||||
|
int z = dataStream.readInt();
|
||||||
|
|
||||||
|
byte type = dataStream.readByte();
|
||||||
|
|
||||||
|
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
||||||
|
|
||||||
|
if(tileEntity instanceof IUpgradeManagement && tileEntity instanceof TileEntityBasicBlock)
|
||||||
|
{
|
||||||
|
IUpgradeManagement upgradeTile = (IUpgradeManagement)tileEntity;
|
||||||
|
|
||||||
|
if(type == 0)
|
||||||
|
{
|
||||||
|
if(upgradeTile.getSpeedMultiplier() > 0)
|
||||||
|
{
|
||||||
|
if(player.inventory.addItemStackToInventory(new ItemStack(Mekanism.SpeedUpgrade)))
|
||||||
|
{
|
||||||
|
upgradeTile.setSpeedMultiplier(upgradeTile.getSpeedMultiplier()-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(type == 1)
|
||||||
|
{
|
||||||
|
if(upgradeTile.getEnergyMultiplier() > 0)
|
||||||
|
{
|
||||||
|
if(player.inventory.addItemStackToInventory(new ItemStack(Mekanism.EnergyUpgrade)))
|
||||||
|
{
|
||||||
|
upgradeTile.setEnergyMultiplier(upgradeTile.getEnergyMultiplier()-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(DataOutputStream dataStream) throws Exception
|
||||||
|
{
|
||||||
|
dataStream.writeInt(object3D.xCoord);
|
||||||
|
dataStream.writeInt(object3D.yCoord);
|
||||||
|
dataStream.writeInt(object3D.zCoord);
|
||||||
|
|
||||||
|
dataStream.writeByte(upgradeType);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue