fixed battery and SILEX handler

This commit is contained in:
Boblet 2021-11-04 14:32:36 +01:00
parent 49369733f4
commit ea3862c84e
2 changed files with 17 additions and 30 deletions

View File

@ -141,7 +141,7 @@ public class SILEXRecipeHandler extends TemplateRecipeHandler {
if(recipe.getKey() instanceof ItemStack) {
if (NEIServerUtils.areStacksSameType(ingredient, (ItemStack)recipe.getKey()))
if (NEIServerUtils.areStacksSameTypeCrafting(ingredient, (ItemStack)recipe.getKey()))
this.arecipes.add(new RecipeSet(recipe.getKey(), recipe.getValue()));
} else if (recipe.getKey() instanceof ArrayList) {
@ -149,7 +149,7 @@ public class SILEXRecipeHandler extends TemplateRecipeHandler {
for(Object o : (ArrayList)recipe.getKey()) {
ItemStack stack = (ItemStack)o;
if (NEIServerUtils.areStacksSameType(ingredient, stack))
if (NEIServerUtils.areStacksSameTypeCrafting(ingredient, stack))
this.arecipes.add(new RecipeSet(stack, recipe.getValue()));
}
}
@ -174,12 +174,6 @@ public class SILEXRecipeHandler extends TemplateRecipeHandler {
RecipeSet rec = (RecipeSet) this.arecipes.get(recipe);
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
/*int index = 0;
for(Double chance : rec.chances) {
fontRenderer.drawString(((int)(chance * 10D) / 10D) + "%", 84, 28 + index * 18 - 9 * ((rec.chances.size() + 1) / 2), 0x404040);
index++;
}*/
for(int i = 0; i < rec.chances.size(); i++) {

View File

@ -72,8 +72,8 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
@Override
public boolean isItemValidForSlot(int i, ItemStack stack) {
switch(i)
{
switch(i) {
case 0:
if(stack.getItem() instanceof IBatteryItem)
return true;
@ -98,12 +98,10 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
slots = new ItemStack[getSizeInventory()];
for(int i = 0; i < list.tagCount(); i++)
{
for(int i = 0; i < list.tagCount(); i++) {
NBTTagCompound nbt1 = list.getCompoundTagAt(i);
byte b0 = nbt1.getByte("slot");
if(b0 >= 0 && b0 < slots.length)
{
if(b0 >= 0 && b0 < slots.length) {
slots[b0] = ItemStack.loadItemStackFromNBT(nbt1);
}
}
@ -119,12 +117,10 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
NBTTagList list = new NBTTagList();
for(int i = 0; i < slots.length; i++)
{
if(slots[i] != null)
{
for(int i = 0; i < slots.length; i++) {
if(slots[i] != null) {
NBTTagCompound nbt1 = new NBTTagCompound();
nbt1.setByte("slot", (byte)i);
nbt1.setByte("slot", (byte) i);
slots[i].writeToNBT(nbt1);
list.appendTag(nbt1);
}
@ -133,10 +129,9 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
}
@Override
public int[] getAccessibleSlotsFromSide(int p_94128_1_)
{
return p_94128_1_ == 0 ? slots_bottom : (p_94128_1_ == 1 ? slots_top : slots_side);
}
public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
return p_94128_1_ == 0 ? slots_bottom : (p_94128_1_ == 1 ? slots_top : slots_side);
}
@Override
public boolean canInsertItem(int i, ItemStack itemStack, int j) {
@ -199,19 +194,17 @@ public class TileEntityMachineBattery extends TileEntityMachineBase implements I
if(con.getPowerNet() != null && !con.getPowerNet().isSubscribed(this))
con.getPowerNet().subscribe(this);
}
}
}*/
//////////////////////////////////////////////////////////////////////
this.maxPower = ((MachineBattery)worldObj.getBlock(xCoord, yCoord, zCoord)).maxPower;*/
this.maxPower = ((MachineBattery)worldObj.getBlock(xCoord, yCoord, zCoord)).maxPower;
if(mode == 1 || mode == 2)
{
if(mode == 1 || mode == 2) {
age++;
if(age >= 20)
{
if(age >= 20) {
age = 0;
}
if(age == 9 || age == 19)
ffgeuaInit();
}