Bugfixes 9

This commit is contained in:
Muramasa 2016-08-14 08:36:42 +01:00
parent 5e5fa8cf38
commit 0307f682b5
8 changed files with 72 additions and 61 deletions

View file

@ -303,7 +303,7 @@ public class GregTech_API {
if (GregTech_API.sThaumcraftCompat != null)
GregTech_API.sThaumcraftCompat.registerPortholeBlacklistedBlock(aBlock);
int rMeta = 0;
for (byte i = 0; i < aMeta.length && i < 16; i++) if (aMeta[i]) rMeta |= B[i];
for (byte i = 0; i < 16 && i < aMeta.length; i++) if (aMeta[i]) rMeta |= B[i];
sMachineIDs.put(aBlock, rMeta);
return true;
}

View file

@ -228,11 +228,11 @@ public class GT_Container extends Container {
var9 |= tTempStackSize > -1;
}
if (aSlot.getHasStack() && var9) {
if (var9 && aSlot.getHasStack()) {
aHoldStack = aSlot.getStack();
aPlayerInventory.setInventorySlotContents(aMouseclick, aHoldStack);
if ((aSlot.inventory != aPlayerInventory || !aSlot.isItemValid(tTempStack)) && tTempStack != null) {
if (tTempStack != null && (aSlot.inventory != aPlayerInventory || !aSlot.isItemValid(tTempStack))) {
if (tTempStackSize > -1) {
aPlayerInventory.addItemStackToInventory(tTempStack);
aSlot.decrStackSize(aHoldStack.stackSize);
@ -244,7 +244,7 @@ public class GT_Container extends Container {
aSlot.putStack(tTempStack);
aSlot.onPickupFromSlot(aPlayer, aHoldStack);
}
} else if (!aSlot.getHasStack() && tTempStack != null && aSlot.isItemValid(tTempStack)) {
} else if (tTempStack != null && !aSlot.getHasStack() && aSlot.isItemValid(tTempStack)) {
aPlayerInventory.setInventorySlotContents(aMouseclick, (ItemStack) null);
aSlot.putStack(tTempStack);
}
@ -267,8 +267,7 @@ public class GT_Container extends Container {
mTileEntity.markDirty();
//null checks and checks if the item can be stacked (maxStackSize > 1)
if (getSlotCount() > 0 && slotObject != null && slotObject.getHasStack() && !(slotObject instanceof GT_Slot_Holo)) {
if (getSlotCount() > 0 && !(slotObject instanceof GT_Slot_Holo) && slotObject.getHasStack()) {
ItemStack stackInSlot = slotObject.getStack();
stack = GT_Utility.copy(stackInSlot);

View file

@ -309,7 +309,7 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
public final void receiveMetaTileEntityData(short aID, int aCover0, int aCover1, int aCover2, int aCover3, int aCover4, int aCover5, byte aTextureData, byte aUpdateData, byte aRedstoneData, byte aColorData) {
issueTextureUpdate();
if (mID != aID && aID > 0) {
if (aID > 0 && mID != aID) {
mID = aID;
createNewMetatileEntity(mID);
}
@ -729,7 +729,7 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
}
protected boolean canAccessData() {
return !isDead && hasValidMetaTileEntity();
return hasValidMetaTileEntity() && !isDead;
}
@Override

View file

@ -249,6 +249,8 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
mRunningThroughTick = true;
long tTime = System.currentTimeMillis();
int tCode = 0;
boolean sidetypeS = isServerSide() ? true : false;
boolean sidetypeC = isClientSide() ? true : false;
try { for (tCode = 0; hasValidMetaTileEntity() && tCode >= 0; ) {
switch (tCode) {
@ -258,7 +260,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
oX = xCoord;
oY = yCoord;
oZ = zCoord;
if (isServerSide()) for (byte i = 0; i < 6; i++)
if (sidetypeS) for (byte i = 0; i < 6; i++)
if (getCoverIDAtSide(i) != 0)
if (!mMetaTileEntity.allowCoverOnSide(i, new GT_ItemStack(getCoverIDAtSide(i))))
dropCover(i, i, true);
@ -302,7 +304,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
case 5:
case 6:
case 7:
if (isServerSide() && mTickTimer > 10) {
if (sidetypeS && mTickTimer > 10) {
for (byte i = (byte) (tCode - 2); i < 6; i++)
if (getCoverIDAtSide(i) != 0) {
tCode++;
@ -320,7 +322,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
}
case 8:
tCode = 9;
if (isServerSide()) {
if (sidetypeS) {
if (++mAverageEUInputIndex >= mAverageEUInput.length) mAverageEUInputIndex = 0;
if (++mAverageEUOutputIndex >= mAverageEUOutput.length) mAverageEUOutputIndex = 0;
@ -336,7 +338,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
}
case 10:
tCode++;
if (isServerSide()) {
if (sidetypeS) {
if (mRedstone != oRedstone || mTickTimer == 10) {
for (byte i = 0; i < 6; i++)
mCoverBehaviors[i] = GregTech_API.getCoverBehavior(mCoverSides[i]);
@ -433,7 +435,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
}
case 11:
tCode++;
if (isServerSide()) {
if (sidetypeS) {
if (mMetaTileEntity.dechargerSlotCount() > 0 && getStoredEU() < getEUCapacity()) {
for (int i = mMetaTileEntity.dechargerSlotStartIndex(), k = mMetaTileEntity.dechargerSlotCount() + i; i < k; i++) {
if (mMetaTileEntity.mInventory[i] != null && getStoredEU() < getEUCapacity()) {
@ -447,7 +449,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
}
case 12:
tCode++;
if (isServerSide()) {
if (sidetypeS) {
if (mMetaTileEntity.rechargerSlotCount() > 0 && getStoredEU() > 0) {
for (int i = mMetaTileEntity.rechargerSlotStartIndex(), k = mMetaTileEntity.rechargerSlotCount() + i; i < k; i++) {
if (getStoredEU() > 0 && mMetaTileEntity.mInventory[i] != null) {
@ -475,7 +477,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
}
case 15:
tCode++;
if (isServerSide()) {
if (sidetypeS) {
if (mTickTimer % 10 == 0) {
if (mSendClientData) {
NW.sendPacketToAllPlayersInRange(worldObj, new GT_Packet_TileEntity(xCoord, (short) yCoord, zCoord, mID, mCoverSides[0], mCoverSides[1], mCoverSides[2], mCoverSides[3], mCoverSides[4], mCoverSides[5], oTextureData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0)), oUpdateData = hasValidMetaTileEntity() ? mMetaTileEntity.getUpdateData() : 0, oRedstoneData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)), oColor = mColor), xCoord, zCoord);
@ -519,7 +521,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
e.printStackTrace(gregtech.api.util.GT_Log.err);
}
if (isServerSide() && hasValidMetaTileEntity()) {
if (sidetypeS && hasValidMetaTileEntity()) {
tTime = System.currentTimeMillis() - tTime;
if (mTimeStatistics.length > 0)
mTimeStatistics[mTimeStatisticsIndex = (mTimeStatisticsIndex + 1) % mTimeStatistics.length] = (int) tTime;

View file

@ -70,10 +70,11 @@ public class GT_RenderedTexture implements ITexture, IColorModulationContainer {
Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.5F), (int) (mRGBa[1] * 0.5F), (int) (mRGBa[2] * 0.5F), mAllowAlpha ? 255 - mRGBa[3] : 255);
IIcon aIcon = mIconContainer.getIcon();
double d3 = aIcon.getInterpolatedU(aRenderer.renderMaxX * 16.0D);
double d4 = aIcon.getInterpolatedU(aRenderer.renderMinX * 16.0D);
double d5 = aIcon.getInterpolatedV(aRenderer.renderMinZ * 16.0D);
double d6 = aIcon.getInterpolatedV(aRenderer.renderMaxZ * 16.0D);
float d_16 = 16.0F;
float d3 = (float)aIcon.getInterpolatedU(aRenderer.renderMaxX * d_16);
float d4 = (float)aIcon.getInterpolatedU(aRenderer.renderMinX * d_16);
float d5 = (float)aIcon.getInterpolatedV(aRenderer.renderMinZ * d_16);
float d6 = (float)aIcon.getInterpolatedV(aRenderer.renderMaxZ * d_16);
if (aRenderer.renderMinX < 0.0D || aRenderer.renderMaxX > 1.0D) {
d3 = aIcon.getMaxU();
@ -85,24 +86,24 @@ public class GT_RenderedTexture implements ITexture, IColorModulationContainer {
d6 = aIcon.getMaxV();
}
double d11 = aX + aRenderer.renderMinX;
double d12 = aX + aRenderer.renderMaxX;
double d13 = aY + aRenderer.renderMinY;
double d14 = aZ + aRenderer.renderMinZ;
double d15 = aZ + aRenderer.renderMaxZ;
float d11 = aX + (float)aRenderer.renderMinX;
float d12 = aX + (float)aRenderer.renderMaxX;
float d13 = aY + (float)aRenderer.renderMinY;
float d14 = aZ + (float)aRenderer.renderMinZ;
float d15 = aZ + (float)aRenderer.renderMaxZ;
Tessellator.instance.addVertexWithUV(d11, d13, d15, d3, d6);
Tessellator.instance.addVertexWithUV(d11, d13, d14, d3, d5);
Tessellator.instance.addVertexWithUV(d12, d13, d14, d4, d5);
Tessellator.instance.addVertexWithUV(d12, d13, d15, d4, d6);
Tessellator.instance.addVertexWithUV((double)d11, (double)d13, (double)d15, (double)d3, (double)d6);
Tessellator.instance.addVertexWithUV((double)d11, (double)d13, (double)d14, (double)d3, (double)d5);
Tessellator.instance.addVertexWithUV((double)d12, (double)d13, (double)d14, (double)d4, (double)d5);
Tessellator.instance.addVertexWithUV((double)d12, (double)d13, (double)d15, (double)d4, (double)d6);
if ((aIcon = mIconContainer.getOverlayIcon()) != null) {
Tessellator.instance.setColorRGBA(128, 128, 128, 255);
Tessellator.instance.addVertexWithUV(d11, d13, d15, d3, d6);
Tessellator.instance.addVertexWithUV(d11, d13, d14, d3, d5);
Tessellator.instance.addVertexWithUV(d12, d13, d14, d4, d5);
Tessellator.instance.addVertexWithUV(d12, d13, d15, d4, d6);
Tessellator.instance.addVertexWithUV((double)d11, (double)d13, (double)d15, (double)d3, (double)d6);
Tessellator.instance.addVertexWithUV((double)d11, (double)d13, (double)d14, (double)d3, (double)d5);
Tessellator.instance.addVertexWithUV((double)d12, (double)d13, (double)d14, (double)d4, (double)d5);
Tessellator.instance.addVertexWithUV((double)d12, (double)d13, (double)d15, (double)d4, (double)d6);
}
}

View file

@ -78,10 +78,11 @@ public class GT_SidedTexture implements ITexture, IColorModulationContainer {
Tessellator.instance.setColorRGBA((int) (mRGBa[0] * 0.5F), (int) (mRGBa[1] * 0.5F), (int) (mRGBa[2] * 0.5F), mAllowAlpha ? 255 - mRGBa[3] : 255);
IIcon aIcon = mIconContainer[0].getIcon();
double d3 = aIcon.getInterpolatedU(aRenderer.renderMaxX * 16.0D);
double d4 = aIcon.getInterpolatedU(aRenderer.renderMinX * 16.0D);
double d5 = aIcon.getInterpolatedV(aRenderer.renderMinZ * 16.0D);
double d6 = aIcon.getInterpolatedV(aRenderer.renderMaxZ * 16.0D);
float d_16 = 16.0F;
float d3 = (float)aIcon.getInterpolatedU(aRenderer.renderMaxX * d_16);
float d4 = (float)aIcon.getInterpolatedU(aRenderer.renderMinX * d_16);
float d5 = (float)aIcon.getInterpolatedV(aRenderer.renderMinZ * d_16);
float d6 = (float)aIcon.getInterpolatedV(aRenderer.renderMaxZ * d_16);
if (aRenderer.renderMinX < 0.0D || aRenderer.renderMaxX > 1.0D) {
d3 = aIcon.getMaxU();
@ -93,24 +94,24 @@ public class GT_SidedTexture implements ITexture, IColorModulationContainer {
d6 = aIcon.getMaxV();
}
double d11 = aX + aRenderer.renderMinX;
double d12 = aX + aRenderer.renderMaxX;
double d13 = aY + aRenderer.renderMinY;
double d14 = aZ + aRenderer.renderMinZ;
double d15 = aZ + aRenderer.renderMaxZ;
float d11 = aX + (float)aRenderer.renderMinX;
float d12 = aX + (float)aRenderer.renderMaxX;
float d13 = aY + (float)aRenderer.renderMinY;
float d14 = aZ + (float)aRenderer.renderMinZ;
float d15 = aZ + (float)aRenderer.renderMaxZ;
Tessellator.instance.addVertexWithUV(d11, d13, d15, d3, d6);
Tessellator.instance.addVertexWithUV(d11, d13, d14, d3, d5);
Tessellator.instance.addVertexWithUV(d12, d13, d14, d4, d5);
Tessellator.instance.addVertexWithUV(d12, d13, d15, d4, d6);
Tessellator.instance.addVertexWithUV((double)d11, (double)d13, (double)d15, (double)d3, (double)d6);
Tessellator.instance.addVertexWithUV((double)d11, (double)d13, (double)d14, (double)d3, (double)d5);
Tessellator.instance.addVertexWithUV((double)d12, (double)d13, (double)d14, (double)d4, (double)d5);
Tessellator.instance.addVertexWithUV((double)d12, (double)d13, (double)d15, (double)d4, (double)d6);
if ((aIcon = mIconContainer[0].getOverlayIcon()) != null) {
Tessellator.instance.setColorRGBA(128, 128, 128, 255);
d3 = aIcon.getInterpolatedU(aRenderer.renderMaxX * 16.0D);
d4 = aIcon.getInterpolatedU(aRenderer.renderMinX * 16.0D);
d5 = aIcon.getInterpolatedV(aRenderer.renderMinZ * 16.0D);
d6 = aIcon.getInterpolatedV(aRenderer.renderMaxZ * 16.0D);
d3 = (float)aIcon.getInterpolatedU(aRenderer.renderMaxX * d_16);
d4 = (float)aIcon.getInterpolatedU(aRenderer.renderMinX * d_16);
d5 = (float)aIcon.getInterpolatedV(aRenderer.renderMinZ * d_16);
d6 = (float)aIcon.getInterpolatedV(aRenderer.renderMaxZ * d_16);
if (aRenderer.renderMinX < 0.0D || aRenderer.renderMaxX > 1.0D) {
d3 = aIcon.getMaxU();
@ -122,16 +123,16 @@ public class GT_SidedTexture implements ITexture, IColorModulationContainer {
d6 = aIcon.getMaxV();
}
d11 = aX + aRenderer.renderMinX;
d12 = aX + aRenderer.renderMaxX;
d13 = aY + aRenderer.renderMinY;
d14 = aZ + aRenderer.renderMinZ;
d15 = aZ + aRenderer.renderMaxZ;
d11 = aX + (float)aRenderer.renderMinX;
d12 = aX + (float)aRenderer.renderMaxX;
d13 = aY + (float)aRenderer.renderMinY;
d14 = aZ + (float)aRenderer.renderMinZ;
d15 = aZ + (float)aRenderer.renderMaxZ;
Tessellator.instance.addVertexWithUV(d11, d13, d15, d3, d6);
Tessellator.instance.addVertexWithUV(d11, d13, d14, d3, d5);
Tessellator.instance.addVertexWithUV(d12, d13, d14, d4, d5);
Tessellator.instance.addVertexWithUV(d12, d13, d15, d4, d6);
Tessellator.instance.addVertexWithUV((double)d11, (double)d13, (double)d15, (double)d3, (double)d6);
Tessellator.instance.addVertexWithUV((double)d11, (double)d13, (double)d14, (double)d3, (double)d5);
Tessellator.instance.addVertexWithUV((double)d12, (double)d13, (double)d14, (double)d4, (double)d5);
Tessellator.instance.addVertexWithUV((double)d12, (double)d13, (double)d15, (double)d4, (double)d6);
}
}

View file

@ -119,6 +119,6 @@ public class ItemData {
@Override
public String toString() {
if (mPrefix == null || mMaterial == null || mMaterial.mMaterial == null) return "";
return mPrefix.name() + mMaterial.mMaterial.name();
return String.valueOf(new StringBuilder().append(mPrefix.name()).append(mMaterial.mMaterial.name()));
}
}

View file

@ -33,7 +33,15 @@ public class MaterialStack implements Cloneable {
@Override
public String toString() {
return (mMaterial.mMaterialList.size() > 1 && mAmount > 1 ? "(" : "") + mMaterial.getToolTip(true) + (mMaterial.mMaterialList.size() > 1 && mAmount > 1 ? ")" : "") + (mAmount > 1 ? mAmount : "");
String temp1 = "", temp2 = mMaterial.getToolTip(true), temp3 = "", temp4 = "";
if (mAmount > 1) {
temp4 = String.valueOf(mAmount);
if (mMaterial.mMaterialList.size() > 1) {
temp1 = "(";
temp3 = ")";
}
}
return String.valueOf(new StringBuilder().append(temp1).append(temp2).append(temp3).append(temp4));
}
@Override