Crash Fix

This commit is contained in:
Muramasa 2016-05-24 00:05:20 +01:00
parent 680676e411
commit 3c32671623

View file

@ -26,25 +26,27 @@ public class GT_Cover_Fluidfilter
} }
public boolean onCoverRightclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) { public boolean onCoverRightclick(byte aSide, int aCoverID, int aCoverVariable, ICoverable aTileEntity, EntityPlayer aPlayer, float aX, float aY, float aZ) {
System.out.println("rightclick"); //System.out.println("rightclick");
if (((aX > 0.375D) && (aX < 0.625D)) || ((aSide > 3) && (((aY > 0.375D) && (aY < 0.625D)) || ((aSide < 2) && (((aZ > 0.375D) && (aZ < 0.625D)) || (aSide == 2) || (aSide == 3)))))) { if (((aX > 0.375D) && (aX < 0.625D)) || ((aSide > 3) && (((aY > 0.375D) && (aY < 0.625D)) || ((aSide < 2) && (((aZ > 0.375D) && (aZ < 0.625D)) || (aSide == 2) || (aSide == 3)))))) {
ItemStack tStack = aPlayer.inventory.getCurrentItem(); ItemStack tStack = aPlayer.inventory.getCurrentItem();
if(tStack!=null){ if(tStack!=null){
FluidStack tFluid = FluidContainerRegistry.getFluidForFilledItem(tStack); FluidStack tFluid = FluidContainerRegistry.getFluidForFilledItem(tStack);
if(tFluid!=null){ if(tFluid!=null){
System.out.println(tFluid.getLocalizedName()+" "+tFluid.getFluidID()); //System.out.println(tFluid.getLocalizedName()+" "+tFluid.getFluidID());
aCoverVariable = tFluid.getFluidID(); aCoverVariable = tFluid.getFluidID();
aTileEntity.setCoverDataAtSide(aSide, aCoverVariable); aTileEntity.setCoverDataAtSide(aSide, aCoverVariable);
FluidStack sFluid = new FluidStack(FluidRegistry.getFluid(aCoverVariable),1000); FluidStack sFluid = new FluidStack(FluidRegistry.getFluid(aCoverVariable),1000);
GT_Utility.sendChatToPlayer(aPlayer, "Filter Fluid: " + sFluid.getLocalizedName()); GT_Utility.sendChatToPlayer(aPlayer, "Filter Fluid: " + sFluid.getLocalizedName());
}else if(tStack.getItem() instanceof IFluidContainerItem){ }else if(tStack.getItem() instanceof IFluidContainerItem){
IFluidContainerItem tContainer = (IFluidContainerItem)tStack.getItem(); IFluidContainerItem tContainer = (IFluidContainerItem)tStack.getItem();
if(tContainer.getFluid(tStack) != null) {
aCoverVariable = tContainer.getFluid(tStack).getFluidID(); aCoverVariable = tContainer.getFluid(tStack).getFluidID();
System.out.println("fluidcontainer " + aCoverVariable); //System.out.println("fluidcontainer " + aCoverVariable);
FluidStack sFluid = new FluidStack(FluidRegistry.getFluid(aCoverVariable),1000); FluidStack sFluid = new FluidStack(FluidRegistry.getFluid(aCoverVariable), 1000);
GT_Utility.sendChatToPlayer(aPlayer, "Filter Fluid: " + sFluid.getLocalizedName()); GT_Utility.sendChatToPlayer(aPlayer, "Filter Fluid: " + sFluid.getLocalizedName());
} }
} }
}
return true; return true;
} }
return false; return false;