Fixed a Laser Amplifier & Laser Tractor Beam inventory crash, fixed missing sounds for Chargepad, Chemical Crystallzer, Chemical Washer & Metallurgic Infuser

This commit is contained in:
Aidan C. Brady 2015-03-20 01:30:11 -04:00
parent c3ef938166
commit 8d83ada60f
8 changed files with 104 additions and 9 deletions

View file

@ -210,7 +210,7 @@ public class ClientTickHandler
}
}
if(isFlamethrowerOn(mc.thePlayer) != Mekanism.flamethrowerActive.contains(mc.thePlayer.getCommandSenderName()))
if(Mekanism.flamethrowerActive.contains(mc.thePlayer.getCommandSenderName()) != isFlamethrowerOn(mc.thePlayer))
{
if(isFlamethrowerOn(mc.thePlayer))
{

View file

@ -47,6 +47,8 @@ public class CommonPlayerTracker
public void onPlayerDimChangedEvent(PlayerChangedDimensionEvent event)
{
Mekanism.jetpackOn.remove(event.player);
Mekanism.gasmaskOn.remove(event.player);
Mekanism.flamethrowerActive.remove(event.player);
if(!event.player.worldObj.isRemote)
{

View file

@ -1,11 +1,11 @@
package mekanism.common.inventory.container;
import mekanism.common.tile.TileEntityLaserAmplifier;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerLaserAmplifier extends Container
{
@ -48,4 +48,55 @@ public class ContainerLaserAmplifier extends Container
{
return tileEntity.isUseableByPlayer(entityplayer);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
{
ItemStack stack = null;
Slot currentSlot = (Slot)inventorySlots.get(slotID);
if(currentSlot != null && currentSlot.getHasStack())
{
ItemStack slotStack = currentSlot.getStack();
stack = slotStack.copy();
if(slotID >= 0 && slotID <= 26)
{
if(!mergeItemStack(slotStack, 27, inventorySlots.size(), false))
{
return null;
}
}
else if(slotID > 26)
{
if(!mergeItemStack(slotStack, 0, 26, false))
{
return null;
}
}
else {
if(!mergeItemStack(slotStack, 0, inventorySlots.size(), true))
{
return null;
}
}
if(slotStack.stackSize == 0)
{
currentSlot.putStack((ItemStack)null);
}
else {
currentSlot.onSlotChanged();
}
if(slotStack.stackSize == stack.stackSize)
{
return null;
}
currentSlot.onPickupFromSlot(player, slotStack);
}
return stack;
}
}

View file

@ -1,11 +1,11 @@
package mekanism.common.inventory.container;
import mekanism.common.tile.TileEntityLaserTractorBeam;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerLaserTractorBeam extends Container
{
@ -16,9 +16,9 @@ public class ContainerLaserTractorBeam extends Container
tileEntity = tentity;
int slotX;
for (slotX = 0; slotX < 9; slotX++)
for(slotX = 0; slotX < 9; slotX++)
{
for (int slotY = 0; slotY < 3; slotY++)
for(int slotY = 0; slotY < 3; slotY++)
{
addSlotToContainer(new Slot(tentity, slotX + slotY * 9, 8 + slotX * 18, 16 + slotY * 18));
}
@ -55,4 +55,46 @@ public class ContainerLaserTractorBeam extends Container
{
return tileEntity.isUseableByPlayer(entityplayer);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
{
ItemStack stack = null;
Slot currentSlot = (Slot)inventorySlots.get(slotID);
if(currentSlot != null && currentSlot.getHasStack())
{
ItemStack slotStack = currentSlot.getStack();
stack = slotStack.copy();
if(slotID < 27)
{
if(!mergeItemStack(slotStack, 27, inventorySlots.size(), true))
{
return null;
}
}
else if(!mergeItemStack(slotStack, 0, 27, false))
{
return null;
}
if(slotStack.stackSize == 0)
{
currentSlot.putStack((ItemStack)null);
}
else {
currentSlot.onSlotChanged();
}
if(slotStack.stackSize == stack.stackSize)
{
return null;
}
currentSlot.onPickupFromSlot(player, slotStack);
}
return stack;
}
}

View file

@ -42,7 +42,7 @@ public class TileEntityChargepad extends TileEntityNoisyElectricBlock
public TileEntityChargepad()
{
super("chargepad", "Chargepad", MachineType.CHARGEPAD.baseEnergy);
super("machine.chargepad", "Chargepad", MachineType.CHARGEPAD.baseEnergy);
inventory = new ItemStack[0];
}

View file

@ -84,7 +84,7 @@ public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock
public TileEntityChemicalCrystallizer()
{
super("crystallizer", "ChemicalCrystallizer", MachineType.CHEMICAL_CRYSTALLIZER.baseEnergy);
super("machine.crystallizer", "ChemicalCrystallizer", MachineType.CHEMICAL_CRYSTALLIZER.baseEnergy);
configComponent = new TileComponentConfig(this, TransmissionType.ITEM, TransmissionType.ENERGY, TransmissionType.GAS);

View file

@ -83,7 +83,7 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple
public TileEntityChemicalWasher()
{
super("washer", "ChemicalWasher", MachineType.CHEMICAL_WASHER.baseEnergy);
super("machine.washer", "ChemicalWasher", MachineType.CHEMICAL_WASHER.baseEnergy);
inventory = new ItemStack[5];
}

View file

@ -88,7 +88,7 @@ public class TileEntityMetallurgicInfuser extends TileEntityNoisyElectricBlock i
public TileEntityMetallurgicInfuser()
{
super("metalinfuser", "MetallurgicInfuser", MachineType.METALLURGIC_INFUSER.baseEnergy);
super("machine.metalinfuser", "MetallurgicInfuser", MachineType.METALLURGIC_INFUSER.baseEnergy);
configComponent = new TileComponentConfig(this, TransmissionType.ITEM, TransmissionType.ENERGY);