Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7dbea08961 | |||
| 685bf7c6d2 | |||
| 7c937afe7a | |||
| 7854673b45 | |||
| 69cad513f3 | |||
| ff82fb6f4c | |||
| b018985a54 | |||
| 0c9544b5fb | |||
| b2bbcfbf93 | |||
| 48da4eaa06 | |||
| 2a466a0e66 | |||
| cfb6b28a33 | |||
| 058e91b7e4 | |||
| 67bdd885d5 | |||
| 188e3a75cc | |||
| b9f6029005 | |||
| b607e018e6 | |||
| e6ccc24ae0 | |||
| 2cb452fd9e | |||
| 855c6f61a9 | |||
| 89a5ba46b1 | |||
| 69a3268549 | |||
| 4b42e478f1 | |||
| 6d03c860c5 |
+1
-1
@@ -3,7 +3,7 @@ aechannel=stable
|
|||||||
aebuild=7
|
aebuild=7
|
||||||
aegroup=appeng
|
aegroup=appeng
|
||||||
aebasename=appliedenergistics2
|
aebasename=appliedenergistics2
|
||||||
trousers=omni-fixes-v43h
|
trousers=omni-fixes-v47i
|
||||||
|
|
||||||
#########################################################
|
#########################################################
|
||||||
# Versions #
|
# Versions #
|
||||||
|
|||||||
@@ -237,7 +237,11 @@ public class GuiInterfaceTerminal extends AEBaseGui
|
|||||||
int interfaceDim = dimHashMap.get( guiButtonHashMap.get( this.selectedButton ) );
|
int interfaceDim = dimHashMap.get( guiButtonHashMap.get( this.selectedButton ) );
|
||||||
if( playerDim != interfaceDim )
|
if( playerDim != interfaceDim )
|
||||||
{
|
{
|
||||||
mc.player.sendStatusMessage( new TextComponentString( "Interface located at dimension: " + interfaceDim + " [" + DimensionManager.getWorld( interfaceDim ).provider.getDimensionType().getName() + "] and cant be highlighted" ), false );
|
try {
|
||||||
|
mc.player.sendStatusMessage( new TextComponentString( "Interface located at dimension: " + interfaceDim + " [" + DimensionManager.getWorld( interfaceDim ).provider.getDimensionType().getName() + "] and cant be highlighted" ), false );
|
||||||
|
} catch(Exception e){
|
||||||
|
mc.player.sendStatusMessage( new TextComponentString( "Interface is located in another dimension and cannot be highlighted" ), false );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -270,12 +270,15 @@ public class GuiUpgradeable extends AEBaseGui implements IJEIGhostIngredients
|
|||||||
@Override
|
@Override
|
||||||
public Rectangle getArea()
|
public Rectangle getArea()
|
||||||
{
|
{
|
||||||
if( slot instanceof SlotFake )
|
if( slot instanceof SlotFake && ( (SlotFake) slot ).isSlotEnabled() )
|
||||||
|
{
|
||||||
return new Rectangle( getGuiLeft() + ( (SlotFake) slot ).xPos, getGuiTop() + ( (SlotFake) slot ).yPos, 16, 16 );
|
return new Rectangle( getGuiLeft() + ( (SlotFake) slot ).xPos, getGuiTop() + ( (SlotFake) slot ).yPos, 16, 16 );
|
||||||
else
|
}
|
||||||
|
else if( slot instanceof GuiFluidSlot && ( (GuiFluidSlot) slot ).isSlotEnabled() )
|
||||||
{
|
{
|
||||||
return new Rectangle( getGuiLeft() + ( (GuiFluidSlot) slot ).xPos(), getGuiTop() + ( (GuiFluidSlot) slot ).yPos(), 16, 16 );
|
return new Rectangle( getGuiLeft() + ( (GuiFluidSlot) slot ).xPos(), getGuiTop() + ( (GuiFluidSlot) slot ).yPos(), 16, 16 );
|
||||||
}
|
}
|
||||||
|
return new Rectangle();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -284,7 +287,7 @@ public class GuiUpgradeable extends AEBaseGui implements IJEIGhostIngredients
|
|||||||
PacketInventoryAction p = null;
|
PacketInventoryAction p = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if( slot instanceof SlotFake )
|
if( slot instanceof SlotFake && ( (SlotFake) slot ).isSlotEnabled() )
|
||||||
{
|
{
|
||||||
if( finalItemStack.isEmpty() && finalFluidStack != null )
|
if( finalItemStack.isEmpty() && finalFluidStack != null )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ import net.minecraft.item.ItemStack;
|
|||||||
|
|
||||||
public abstract class GuiCustomSlot extends Gui implements ITooltip
|
public abstract class GuiCustomSlot extends Gui implements ITooltip
|
||||||
{
|
{
|
||||||
private final int x;
|
protected final int x;
|
||||||
private final int y;
|
protected final int y;
|
||||||
private final int id;
|
protected final int id;
|
||||||
|
|
||||||
public GuiCustomSlot( final int id, final int x, final int y )
|
public GuiCustomSlot( final int id, final int x, final int y )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -22,9 +22,10 @@ package appeng.client.render;
|
|||||||
import appeng.api.storage.data.IAEFluidStack;
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.FontRenderer;
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.*;
|
||||||
import net.minecraft.client.renderer.OpenGlHelper;
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
import net.minecraft.client.renderer.RenderItem;
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
|
||||||
@@ -32,6 +33,7 @@ import appeng.api.storage.data.IAEItemStack;
|
|||||||
import appeng.util.IWideReadableNumberConverter;
|
import appeng.util.IWideReadableNumberConverter;
|
||||||
import appeng.util.ReadableNumberConverter;
|
import appeng.util.ReadableNumberConverter;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -121,6 +123,49 @@ public class TesrRenderHelper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void renderFluid2d( FluidStack fluidStack, float scale )
|
||||||
|
{
|
||||||
|
if( fluidStack != null )
|
||||||
|
{
|
||||||
|
GlStateManager.pushMatrix();
|
||||||
|
int color = fluidStack.getFluid().getColor( fluidStack );
|
||||||
|
float r = ( color >> 16 & 255 ) / 255.0f;
|
||||||
|
float g = ( color >> 8 & 255 ) / 255.0f;
|
||||||
|
float b = ( color & 255 ) / 255.0f;
|
||||||
|
TextureAtlasSprite sprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite( fluidStack.getFluid().getStill( fluidStack ).toString() );
|
||||||
|
GlStateManager.enableBlend();
|
||||||
|
GlStateManager.blendFunc( GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA );
|
||||||
|
GlStateManager.disableAlpha();
|
||||||
|
GlStateManager.disableLighting();
|
||||||
|
Minecraft.getMinecraft().getTextureManager().bindTexture( TextureMap.LOCATION_BLOCKS_TEXTURE );
|
||||||
|
Tessellator tess = Tessellator.getInstance();
|
||||||
|
BufferBuilder buf = tess.getBuffer();
|
||||||
|
|
||||||
|
float width = 0.4f;
|
||||||
|
float height = 0.4f;
|
||||||
|
float alpha = 1.0f;
|
||||||
|
float z = 0.0001f;
|
||||||
|
float x = -0.20f;
|
||||||
|
float y = -0.25f;
|
||||||
|
|
||||||
|
buf.begin( GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR );
|
||||||
|
double uMin = sprite.getInterpolatedU( 16D - width * 16D ), uMax = sprite.getInterpolatedU( width * 16D );
|
||||||
|
double vMin = sprite.getMinV(), vMax = sprite.getInterpolatedV( height * 16D );
|
||||||
|
buf.pos( x, y, z ).tex( uMin, vMin ).color( r, g, b, alpha ).endVertex();
|
||||||
|
buf.pos( x, y + height, z ).tex( uMin, vMax ).color( r, g, b, alpha ).endVertex();
|
||||||
|
buf.pos( x + width, y + height, z ).tex( uMax, vMax ).color( r, g, b, alpha ).endVertex();
|
||||||
|
buf.pos( x + width, y, z ).tex( uMax, vMin ).color( r, g, b, alpha ).endVertex();
|
||||||
|
|
||||||
|
tess.draw();
|
||||||
|
GlStateManager.enableLighting();
|
||||||
|
GlStateManager.enableAlpha();
|
||||||
|
GlStateManager.disableBlend();
|
||||||
|
GlStateManager.color( 1F, 1F, 1F, 1F );
|
||||||
|
GlStateManager.popMatrix();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render an item in 2D and the given text below it.
|
* Render an item in 2D and the given text below it.
|
||||||
*
|
*
|
||||||
@@ -147,9 +192,9 @@ public class TesrRenderHelper
|
|||||||
|
|
||||||
public static void renderFluid2dWithAmount( IAEFluidStack fluidStack, float scale, float spacing )
|
public static void renderFluid2dWithAmount( IAEFluidStack fluidStack, float scale, float spacing )
|
||||||
{
|
{
|
||||||
final ItemStack renderStack = fluidStack.asItemStackRepresentation();
|
final FluidStack renderStack = fluidStack.getFluidStack();
|
||||||
|
|
||||||
TesrRenderHelper.renderItem2d( renderStack, scale );
|
TesrRenderHelper.renderFluid2d( renderStack, scale );
|
||||||
|
|
||||||
final long stackSize = fluidStack.getStackSize() / 1000;
|
final long stackSize = fluidStack.getStackSize() / 1000;
|
||||||
final String renderedStackSize = NUMBER_CONVERTER.toWideReadableForm( stackSize ) + "B";
|
final String renderedStackSize = NUMBER_CONVERTER.toWideReadableForm( stackSize ) + "B";
|
||||||
|
|||||||
@@ -245,7 +245,10 @@ public class PacketJEIRecipe extends AppEngPacket
|
|||||||
|
|
||||||
if( out != null )
|
if( out != null )
|
||||||
{
|
{
|
||||||
out.setStackSize( recipe[x][y].getCount() );
|
if (!cct.useRealItems())
|
||||||
|
{
|
||||||
|
out.setStackSize( recipe[x][y].getCount() );
|
||||||
|
}
|
||||||
currentItem = out.createItemStack();
|
currentItem = out.createItemStack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
package appeng.core.sync.packets;
|
package appeng.core.sync.packets;
|
||||||
|
|
||||||
|
|
||||||
|
import appeng.fluids.container.ContainerFluidInterface;
|
||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.buffer.Unpooled;
|
import io.netty.buffer.Unpooled;
|
||||||
|
|
||||||
@@ -90,5 +91,9 @@ public class PacketTargetFluidStack extends AppEngPacket
|
|||||||
{
|
{
|
||||||
( (ContainerFluidTerminal) player.openContainer ).setTargetStack( this.stack );
|
( (ContainerFluidTerminal) player.openContainer ).setTargetStack( this.stack );
|
||||||
}
|
}
|
||||||
|
else if( player.openContainer instanceof ContainerFluidInterface )
|
||||||
|
{
|
||||||
|
( (ContainerFluidInterface) player.openContainer ).setTargetStack( this.stack );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
|
import net.minecraft.util.text.TextComponentString;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
@@ -123,18 +124,43 @@ public class CraftingTreeNode
|
|||||||
final List<IAEItemStack> thingsUsed = new ArrayList<>();
|
final List<IAEItemStack> thingsUsed = new ArrayList<>();
|
||||||
|
|
||||||
this.what.setStackSize( l );
|
this.what.setStackSize( l );
|
||||||
if( this.getSlot() >= 0 && this.parent != null && this.parent.details.isCraftable() )
|
IAEItemStack available = inv.extractItems( this.what, Actionable.MODULATE, src );
|
||||||
|
|
||||||
|
if( available != null )
|
||||||
|
{
|
||||||
|
if( !this.exhausted )
|
||||||
|
{
|
||||||
|
final IAEItemStack is = this.job.checkUse( available );
|
||||||
|
|
||||||
|
if( is != null )
|
||||||
|
{
|
||||||
|
thingsUsed.add( is.copy() );
|
||||||
|
this.used.add( is );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.bytes += available.getStackSize();
|
||||||
|
l -= available.getStackSize();
|
||||||
|
|
||||||
|
if( l == 0 )
|
||||||
|
{
|
||||||
|
return available;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if( this.getSlot() >= 0 && this.parent != null && this.parent.details.isCraftable() )
|
||||||
{
|
{
|
||||||
final Collection<IAEItemStack> itemList;
|
final Collection<IAEItemStack> itemList;
|
||||||
final IItemList<IAEItemStack> inventoryList = inv.getItemList();
|
final IItemList<IAEItemStack> inventoryList = inv.getItemList();
|
||||||
|
|
||||||
if( this.parent.details.canSubstitute() )
|
if( this.parent.details.canSubstitute() )
|
||||||
{
|
{
|
||||||
final List<IAEItemStack> substitutes = this.parent.details.getSubstituteInputs(this.slot);
|
final List<IAEItemStack> substitutes = this.parent.details.getSubstituteInputs( this.slot );
|
||||||
itemList = new ArrayList<>(substitutes.size());
|
itemList = new ArrayList<>( substitutes.size() );
|
||||||
|
|
||||||
for (IAEItemStack stack : substitutes) {
|
for( IAEItemStack stack : substitutes )
|
||||||
itemList.addAll(inventoryList.findFuzzy(stack, FuzzyMode.IGNORE_ALL));
|
{
|
||||||
|
itemList.addAll( inventoryList.findFuzzy( stack, FuzzyMode.IGNORE_ALL ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -156,7 +182,7 @@ public class CraftingTreeNode
|
|||||||
fuzz = fuzz.copy();
|
fuzz = fuzz.copy();
|
||||||
fuzz.setStackSize( l );
|
fuzz.setStackSize( l );
|
||||||
|
|
||||||
final IAEItemStack available = inv.extractItems( fuzz, Actionable.MODULATE, src );
|
available = inv.extractItems( fuzz, Actionable.MODULATE, src );
|
||||||
|
|
||||||
if( available != null )
|
if( available != null )
|
||||||
{
|
{
|
||||||
@@ -182,32 +208,6 @@ public class CraftingTreeNode
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
final IAEItemStack available = inv.extractItems( this.what, Actionable.MODULATE, src );
|
|
||||||
|
|
||||||
if( available != null )
|
|
||||||
{
|
|
||||||
if( !this.exhausted )
|
|
||||||
{
|
|
||||||
final IAEItemStack is = this.job.checkUse( available );
|
|
||||||
|
|
||||||
if( is != null )
|
|
||||||
{
|
|
||||||
thingsUsed.add( is.copy() );
|
|
||||||
this.used.add( is );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.bytes += available.getStackSize();
|
|
||||||
l -= available.getStackSize();
|
|
||||||
|
|
||||||
if( l == 0 )
|
|
||||||
{
|
|
||||||
return available;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( this.canEmit )
|
if( this.canEmit )
|
||||||
{
|
{
|
||||||
@@ -226,7 +226,7 @@ public class CraftingTreeNode
|
|||||||
{
|
{
|
||||||
final CraftingTreeProcess pro = this.nodes.get( 0 );
|
final CraftingTreeProcess pro = this.nodes.get( 0 );
|
||||||
|
|
||||||
while( pro.possible && l > 0 )
|
while ( pro.possible && l > 0 )
|
||||||
{
|
{
|
||||||
final IAEItemStack madeWhat = pro.getAmountCrafted( this.what );
|
final IAEItemStack madeWhat = pro.getAmountCrafted( this.what );
|
||||||
|
|
||||||
@@ -234,7 +234,7 @@ public class CraftingTreeNode
|
|||||||
|
|
||||||
madeWhat.setStackSize( l );
|
madeWhat.setStackSize( l );
|
||||||
|
|
||||||
final IAEItemStack available = inv.extractItems( madeWhat, Actionable.MODULATE, src );
|
available = inv.extractItems( madeWhat, Actionable.MODULATE, src );
|
||||||
|
|
||||||
if( available != null )
|
if( available != null )
|
||||||
{
|
{
|
||||||
@@ -258,13 +258,13 @@ public class CraftingTreeNode
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
while( pro.possible && l > 0 )
|
while ( pro.possible && l > 0 )
|
||||||
{
|
{
|
||||||
final MECraftingInventory subInv = new MECraftingInventory( inv, true, true, true );
|
final MECraftingInventory subInv = new MECraftingInventory( inv, true, true, true );
|
||||||
pro.request( subInv, 1, src );
|
pro.request( subInv, 1, src );
|
||||||
|
|
||||||
this.what.setStackSize( l );
|
this.what.setStackSize( l );
|
||||||
final IAEItemStack available = subInv.extractItems( this.what, Actionable.MODULATE, src );
|
available = subInv.extractItems( this.what, Actionable.MODULATE, src );
|
||||||
|
|
||||||
if( available != null )
|
if( available != null )
|
||||||
{
|
{
|
||||||
@@ -321,7 +321,7 @@ public class CraftingTreeNode
|
|||||||
}
|
}
|
||||||
// missing = 0;
|
// missing = 0;
|
||||||
|
|
||||||
job.addBytes( 8 + this.bytes );
|
job.addBytes( this.bytes );
|
||||||
|
|
||||||
for( final CraftingTreeProcess pro : this.nodes )
|
for( final CraftingTreeProcess pro : this.nodes )
|
||||||
{
|
{
|
||||||
@@ -358,6 +358,10 @@ public class CraftingTreeNode
|
|||||||
|
|
||||||
if( ex == null || ex.getStackSize() != i.getStackSize() )
|
if( ex == null || ex.getStackSize() != i.getStackSize() )
|
||||||
{
|
{
|
||||||
|
if( src.player().isPresent() )
|
||||||
|
{
|
||||||
|
src.player().get().sendStatusMessage( new TextComponentString( "System reported " + i.getStackSize() + " " + i.getDefinition().getItem().getItemStackDisplayName( i.getDefinition() ) + " available but could not extract anything" ), false );
|
||||||
|
}
|
||||||
throw new CraftBranchFailure( i, i.getStackSize() );
|
throw new CraftBranchFailure( i, i.getStackSize() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -241,7 +241,6 @@ public class CraftingTreeProcess
|
|||||||
o.setStackSize( o.getStackSize() * i );
|
o.setStackSize( o.getStackSize() * i );
|
||||||
inv.injectItems( o, Actionable.MODULATE, src );
|
inv.injectItems( o, Actionable.MODULATE, src );
|
||||||
}
|
}
|
||||||
|
|
||||||
this.crafts += i;
|
this.crafts += i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,7 +252,7 @@ public class CraftingTreeProcess
|
|||||||
pro.dive( job );
|
pro.dive( job );
|
||||||
}
|
}
|
||||||
|
|
||||||
job.addBytes( 8 + this.crafts + this.bytes );
|
job.addBytes( this.crafts + 8 + this.bytes );
|
||||||
}
|
}
|
||||||
|
|
||||||
IAEItemStack getAmountCrafted( IAEItemStack what2 )
|
IAEItemStack getAmountCrafted( IAEItemStack what2 )
|
||||||
@@ -305,7 +304,7 @@ public class CraftingTreeProcess
|
|||||||
|
|
||||||
void getPlan( final IItemList<IAEItemStack> plan )
|
void getPlan( final IItemList<IAEItemStack> plan )
|
||||||
{
|
{
|
||||||
for( IAEItemStack i : this.details.getCondensedOutputs() )
|
for( IAEItemStack i : this.details.getOutputs() )
|
||||||
{
|
{
|
||||||
i = i.copy();
|
i = i.copy();
|
||||||
i.setCountRequestable( i.getStackSize() * this.crafts );
|
i.setCountRequestable( i.getStackSize() * this.crafts );
|
||||||
|
|||||||
@@ -312,9 +312,13 @@ public class MECraftingInventory implements IMEInventory<IAEItemStack>
|
|||||||
if( src.player().isPresent() )
|
if( src.player().isPresent() )
|
||||||
{
|
{
|
||||||
if( result == null )
|
if( result == null )
|
||||||
src.player().get().sendStatusMessage( new TextComponentString( "System reported " + extra.getStackSize() + " " + extra.getDefinition().getDisplayName() + " available but could not extract anything" ), false );
|
{
|
||||||
|
src.player().get().sendStatusMessage( new TextComponentString( "System reported " + extra.getStackSize() + " " + extra.getDefinition().getItem().getItemStackDisplayName( extra.getDefinition() ) + " available but could not extract anything" ), false );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
src.player().get().sendStatusMessage( new TextComponentString( "System reported " + extra.getStackSize() + " " + extra.getDefinition().getDisplayName() + " available but could only extract " + result.getStackSize() ), false );
|
{
|
||||||
|
src.player().get().sendStatusMessage( new TextComponentString( "System reported " + extra.getStackSize() + " " + extra.getDefinition().getItem().getItemStackDisplayName( extra.getDefinition() ) + " available but could only extract " + result.getStackSize() ), false );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
failed = true;
|
failed = true;
|
||||||
if( !src.player().isPresent() ) break;
|
if( !src.player().isPresent() ) break;
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ package appeng.fluids.client.gui;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import appeng.api.util.IConfigManager;
|
||||||
|
import appeng.client.gui.widgets.GuiCustomSlot;
|
||||||
|
import appeng.util.IConfigManagerHost;
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
|
||||||
@@ -38,11 +41,12 @@ import appeng.fluids.helper.IFluidInterfaceHost;
|
|||||||
import appeng.fluids.util.IAEFluidTank;
|
import appeng.fluids.util.IAEFluidTank;
|
||||||
|
|
||||||
|
|
||||||
public class GuiFluidInterface extends GuiUpgradeable
|
public class GuiFluidInterface extends GuiUpgradeable implements IConfigManagerHost
|
||||||
{
|
{
|
||||||
public final static int ID_BUTTON_TANK = 222;
|
public final static int ID_BUTTON_TANK = 222;
|
||||||
|
|
||||||
private final IFluidInterfaceHost host;
|
private final IFluidInterfaceHost host;
|
||||||
|
private final ContainerFluidInterface container;
|
||||||
private GuiTabButton priority;
|
private GuiTabButton priority;
|
||||||
|
|
||||||
public GuiFluidInterface( final InventoryPlayer ip, final IFluidInterfaceHost te )
|
public GuiFluidInterface( final InventoryPlayer ip, final IFluidInterfaceHost te )
|
||||||
@@ -50,6 +54,8 @@ public class GuiFluidInterface extends GuiUpgradeable
|
|||||||
super( new ContainerFluidInterface( ip, te ) );
|
super( new ContainerFluidInterface( ip, te ) );
|
||||||
this.ySize = 231;
|
this.ySize = 231;
|
||||||
this.host = te;
|
this.host = te;
|
||||||
|
( this.container = (ContainerFluidInterface) this.inventorySlots ).setGui( this );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -62,9 +68,7 @@ public class GuiFluidInterface extends GuiUpgradeable
|
|||||||
|
|
||||||
for( int i = 0; i < DualityFluidInterface.NUMBER_OF_TANKS; ++i )
|
for( int i = 0; i < DualityFluidInterface.NUMBER_OF_TANKS; ++i )
|
||||||
{
|
{
|
||||||
final GuiFluidTank guiTank = new GuiFluidTank( fluidTank, i, DualityFluidInterface.NUMBER_OF_TANKS + i, this.getGuiLeft() + 35 + 18 * i, this
|
this.guiSlots.add( new GuiFluidTank( fluidTank, i, DualityFluidInterface.NUMBER_OF_TANKS + i, 36 + 18 * i, 53, 16, 68 ) );
|
||||||
.getGuiTop() + 53, 16, 68 );
|
|
||||||
this.buttonList.add( guiTank );
|
|
||||||
this.guiSlots.add( new GuiFluidSlot( configFluids, i, i, 35 + 18 * i, 35 ) );
|
this.guiSlots.add( new GuiFluidSlot( configFluids, i, i, 35 + 18 * i, 35 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,9 +108,33 @@ public class GuiFluidInterface extends GuiUpgradeable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mouseClicked( int xCoord, int yCoord, int btn ) throws IOException
|
||||||
|
{
|
||||||
|
for( GuiCustomSlot slot : this.guiSlots )
|
||||||
|
{
|
||||||
|
if( slot instanceof GuiFluidTank )
|
||||||
|
{
|
||||||
|
if( this.isPointInRegion( slot.xPos(), slot.yPos(), slot.getWidth(), slot.getHeight(), xCoord, yCoord ) && slot.canClick( this.mc.player ) )
|
||||||
|
{
|
||||||
|
this.container.setTargetStack( ( (GuiFluidTank) slot ).getFluidStack() );
|
||||||
|
slot.slotClicked( this.mc.player.inventory.getItemStack(), btn );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
super.mouseClicked( xCoord, yCoord, btn );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean drawUpgrades()
|
protected boolean drawUpgrades()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateSetting( IConfigManager manager, Enum settingName, Enum newValue )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,42 +19,50 @@
|
|||||||
package appeng.fluids.client.gui.widgets;
|
package appeng.fluids.client.gui.widgets;
|
||||||
|
|
||||||
|
|
||||||
|
import appeng.client.gui.widgets.GuiCustomSlot;
|
||||||
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
|
import appeng.core.sync.packets.PacketInventoryAction;
|
||||||
|
import appeng.helpers.InventoryAction;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiButton;
|
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
import net.minecraft.client.renderer.texture.TextureMap;
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
import appeng.api.storage.data.IAEFluidStack;
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
import appeng.api.util.AEColor;
|
|
||||||
import appeng.client.gui.widgets.ITooltip;
|
import appeng.client.gui.widgets.ITooltip;
|
||||||
import appeng.fluids.util.IAEFluidTank;
|
import appeng.fluids.util.IAEFluidTank;
|
||||||
|
|
||||||
|
|
||||||
@SideOnly( Side.CLIENT )
|
@SideOnly( Side.CLIENT )
|
||||||
public class GuiFluidTank extends GuiButton implements ITooltip
|
public class GuiFluidTank extends GuiCustomSlot implements ITooltip
|
||||||
{
|
{
|
||||||
private final IAEFluidTank tank;
|
private final IAEFluidTank tank;
|
||||||
private final int slot;
|
private final int slot;
|
||||||
|
private final int width;
|
||||||
|
private final int height;
|
||||||
|
|
||||||
public GuiFluidTank( IAEFluidTank tank, int slot, int id, int x, int y, int w, int h )
|
public GuiFluidTank( IAEFluidTank tank, int slot, int id, int x, int y, int w, int h )
|
||||||
{
|
{
|
||||||
super( id, x, y, w, h, "" );
|
super( id, x, y );
|
||||||
this.tank = tank;
|
this.tank = tank;
|
||||||
this.slot = slot;
|
this.slot = slot;
|
||||||
|
this.width = w;
|
||||||
|
this.height = h;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawButton( final Minecraft mc, final int mouseX, final int mouseY, final float partialTicks )
|
public void drawContent( Minecraft mc, int mouseX, int mouseY, float partialTicks )
|
||||||
{
|
{
|
||||||
if( this.visible )
|
final IAEFluidStack fs = this.getFluidStack();
|
||||||
|
if( fs != null )
|
||||||
{
|
{
|
||||||
GlStateManager.disableBlend();
|
GlStateManager.disableBlend();
|
||||||
GlStateManager.disableLighting();
|
GlStateManager.disableLighting();
|
||||||
|
|
||||||
drawRect( this.x, this.y, this.x + this.width, this.y + this.height, AEColor.GRAY.blackVariant | 0xFF000000 );
|
//drawRect( this.x, this.y, this.x + this.width, this.y + this.height, AEColor.GRAY.blackVariant | 0xFF000000 );
|
||||||
|
|
||||||
final IAEFluidStack fluid = this.tank.getFluidInSlot( this.slot );
|
final IAEFluidStack fluid = this.tank.getFluidInSlot( this.slot );
|
||||||
if( fluid != null && fluid.getStackSize() > 0 )
|
if( fluid != null && fluid.getStackSize() > 0 )
|
||||||
@@ -69,17 +77,16 @@ public class GuiFluidTank extends GuiButton implements ITooltip
|
|||||||
TextureAtlasSprite sprite = mc.getTextureMapBlocks().getAtlasSprite( fluid.getFluid().getStill().toString() );
|
TextureAtlasSprite sprite = mc.getTextureMapBlocks().getAtlasSprite( fluid.getFluid().getStill().toString() );
|
||||||
final int scaledHeight = (int) ( this.height * ( (float) fluid.getStackSize() / this.tank.getTankProperties()[this.slot].getCapacity() ) );
|
final int scaledHeight = (int) ( this.height * ( (float) fluid.getStackSize() / this.tank.getTankProperties()[this.slot].getCapacity() ) );
|
||||||
|
|
||||||
int iconHeightRemainder = scaledHeight % 16;
|
int iconHeightRemainder = scaledHeight % this.getHeight();
|
||||||
if( iconHeightRemainder > 0 )
|
if( iconHeightRemainder > 0 )
|
||||||
{
|
{
|
||||||
this.drawTexturedModalRect( this.x, this.y + this.height - iconHeightRemainder, sprite, 16, iconHeightRemainder );
|
this.drawTexturedModalRect( this.xPos(), this.yPos() + this.getHeight() - iconHeightRemainder, sprite, this.getWidth(), iconHeightRemainder );
|
||||||
}
|
}
|
||||||
for( int i = 0; i < scaledHeight / 16; i++ )
|
for( int i = 0; i < scaledHeight / this.getHeight(); i++ )
|
||||||
{
|
{
|
||||||
this.drawTexturedModalRect( this.x, this.y + this.height - iconHeightRemainder - ( i + 1 ) * 16, sprite, 16, 16 );
|
this.drawTexturedModalRect( this.xPos(), this.yPos() + this.getHeight() - iconHeightRemainder - ( i + 1 ) * 16, sprite, this.getWidth(), this.getHeight() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,25 +107,25 @@ public class GuiFluidTank extends GuiButton implements ITooltip
|
|||||||
@Override
|
@Override
|
||||||
public int xPos()
|
public int xPos()
|
||||||
{
|
{
|
||||||
return this.x - 2;
|
return this.x - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int yPos()
|
public int yPos()
|
||||||
{
|
{
|
||||||
return this.y - 2;
|
return this.y - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getWidth()
|
public int getWidth()
|
||||||
{
|
{
|
||||||
return this.width + 4;
|
return this.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getHeight()
|
public int getHeight()
|
||||||
{
|
{
|
||||||
return this.height + 4;
|
return this.height + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -127,4 +134,24 @@ public class GuiFluidTank extends GuiButton implements ITooltip
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IAEFluidStack getFluidStack()
|
||||||
|
{
|
||||||
|
return this.tank.getFluidInSlot( this.slot );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void slotClicked( ItemStack clickStack, final int mouseButton )
|
||||||
|
{
|
||||||
|
|
||||||
|
if( getFluidStack() != null )
|
||||||
|
{
|
||||||
|
NetworkHandler.instance().sendToServer( new PacketInventoryAction( InventoryAction.FILL_ITEM, slot, 0 ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NetworkHandler.instance().sendToServer( new PacketInventoryAction( InventoryAction.EMPTY_ITEM, slot, 0 ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,9 +19,17 @@
|
|||||||
package appeng.fluids.container;
|
package appeng.fluids.container;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
|
import appeng.core.sync.packets.PacketTargetFluidStack;
|
||||||
|
import appeng.fluids.util.AEFluidStack;
|
||||||
|
import appeng.helpers.InventoryAction;
|
||||||
|
import appeng.util.IConfigManagerHost;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import net.minecraft.inventory.IContainerListener;
|
import net.minecraft.inventory.IContainerListener;
|
||||||
|
|
||||||
@@ -33,12 +41,19 @@ import appeng.fluids.helper.FluidSyncHelper;
|
|||||||
import appeng.fluids.helper.IFluidInterfaceHost;
|
import appeng.fluids.helper.IFluidInterfaceHost;
|
||||||
import appeng.fluids.util.IAEFluidTank;
|
import appeng.fluids.util.IAEFluidTank;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
import net.minecraftforge.fluids.FluidUtil;
|
||||||
|
import net.minecraftforge.fluids.capability.IFluidHandlerItem;
|
||||||
|
|
||||||
|
|
||||||
public class ContainerFluidInterface extends ContainerFluidConfigurable
|
public class ContainerFluidInterface extends ContainerFluidConfigurable implements IConfigManagerHost
|
||||||
{
|
{
|
||||||
private final DualityFluidInterface myDuality;
|
private final DualityFluidInterface myDuality;
|
||||||
private final FluidSyncHelper tankSync;
|
private final FluidSyncHelper tankSync;
|
||||||
|
private IConfigManagerHost gui;
|
||||||
|
// Holds the fluid the client wishes to extract, or null for insert
|
||||||
|
private IAEFluidStack clientRequestedTargetFluid = null;
|
||||||
|
|
||||||
public ContainerFluidInterface( final InventoryPlayer ip, final IFluidInterfaceHost te )
|
public ContainerFluidInterface( final InventoryPlayer ip, final IFluidInterfaceHost te )
|
||||||
{
|
{
|
||||||
@@ -60,6 +75,15 @@ public class ContainerFluidInterface extends ContainerFluidConfigurable
|
|||||||
return this.myDuality.getConfig();
|
return this.myDuality.getConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateSetting( IConfigManager manager, Enum settingName, Enum newValue )
|
||||||
|
{
|
||||||
|
if( this.getGui() != null )
|
||||||
|
{
|
||||||
|
this.getGui().updateSetting( manager, settingName, newValue );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void detectAndSendChanges()
|
public void detectAndSendChanges()
|
||||||
{
|
{
|
||||||
@@ -97,6 +121,126 @@ public class ContainerFluidInterface extends ContainerFluidConfigurable
|
|||||||
this.tankSync.readPacket( fluids );
|
this.tankSync.readPacket( fluids );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IConfigManagerHost getGui()
|
||||||
|
{
|
||||||
|
return this.gui;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGui( @Nonnull final IConfigManagerHost gui )
|
||||||
|
{
|
||||||
|
this.gui = gui;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void doAction( EntityPlayerMP player, InventoryAction action, int slot, long id )
|
||||||
|
{
|
||||||
|
if( action != InventoryAction.FILL_ITEM && action != InventoryAction.EMPTY_ITEM )
|
||||||
|
{
|
||||||
|
super.doAction( player, action, slot, id );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
final ItemStack held = player.inventory.getItemStack();
|
||||||
|
ItemStack heldCopy = held.copy();
|
||||||
|
heldCopy.setCount( 1 );
|
||||||
|
IFluidHandlerItem fh = FluidUtil.getFluidHandler( heldCopy );
|
||||||
|
if( fh == null )
|
||||||
|
{
|
||||||
|
// only fluid handlers items
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( action == InventoryAction.FILL_ITEM && this.clientRequestedTargetFluid != null )
|
||||||
|
{
|
||||||
|
final IAEFluidStack stack = this.clientRequestedTargetFluid.copy();
|
||||||
|
|
||||||
|
// Check how much we can store in the item
|
||||||
|
stack.setStackSize( Integer.MAX_VALUE );
|
||||||
|
int amountAllowed = fh.fill( stack.getFluidStack(), false );
|
||||||
|
int heldAmount = held.getCount();
|
||||||
|
for( int i = 0; i < heldAmount; i++ )
|
||||||
|
{
|
||||||
|
ItemStack copiedFluidContainer = held.copy();
|
||||||
|
copiedFluidContainer.setCount( 1 );
|
||||||
|
fh = FluidUtil.getFluidHandler( copiedFluidContainer );
|
||||||
|
|
||||||
|
FluidStack extractableFluid = this.myDuality.getTanks().drain( stack.setStackSize( amountAllowed ).getFluidStack(), false );
|
||||||
|
if( extractableFluid == null || extractableFluid.amount == 0 )
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
int fillableAmount = fh.fill( extractableFluid, false );
|
||||||
|
if( fillableAmount > 0 )
|
||||||
|
{
|
||||||
|
FluidStack extractedFluid = this.myDuality.getTanks().drain( extractableFluid, true );
|
||||||
|
fh.fill( extractedFluid, true );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( held.getCount() == 1 )
|
||||||
|
{
|
||||||
|
player.inventory.setItemStack( fh.getContainer() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.inventory.getItemStack().shrink( 1 );
|
||||||
|
if( !player.inventory.addItemStackToInventory( fh.getContainer() ) )
|
||||||
|
{
|
||||||
|
player.dropItem( fh.getContainer(), false );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( action == InventoryAction.EMPTY_ITEM )
|
||||||
|
{
|
||||||
|
int heldAmount = held.getCount();
|
||||||
|
for( int i = 0; i < heldAmount; i++ )
|
||||||
|
{
|
||||||
|
ItemStack copiedFluidContainer = held.copy();
|
||||||
|
copiedFluidContainer.setCount( 1 );
|
||||||
|
fh = FluidUtil.getFluidHandler( copiedFluidContainer );
|
||||||
|
|
||||||
|
FluidStack drainable = fh.drain( this.myDuality.getTanks().getTankProperties()[slot].getCapacity(), false );
|
||||||
|
if( drainable != null )
|
||||||
|
{
|
||||||
|
fh.drain( drainable, true );
|
||||||
|
this.myDuality.getTanks().fill( drainable, true );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( held.getCount() == 1 )
|
||||||
|
{
|
||||||
|
player.inventory.setItemStack( fh.getContainer() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
player.inventory.getItemStack().shrink( 1 );
|
||||||
|
if( !player.inventory.addItemStackToInventory( fh.getContainer() ) )
|
||||||
|
{
|
||||||
|
player.dropItem( fh.getContainer(), false );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.updateHeld( player );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTargetStack( final IAEFluidStack stack )
|
||||||
|
{
|
||||||
|
if( Platform.isClient() )
|
||||||
|
{
|
||||||
|
if( stack == null && this.clientRequestedTargetFluid == null )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if( stack != null && this.clientRequestedTargetFluid != null && stack.getFluidStack().isFluidEqual( this.clientRequestedTargetFluid.getFluidStack() ) )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
NetworkHandler.instance().sendToServer( new PacketTargetFluidStack( (AEFluidStack) stack ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
this.clientRequestedTargetFluid = stack == null ? null : stack.copy();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean supportCapacity()
|
protected boolean supportCapacity()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,7 +25,9 @@ import java.util.Objects;
|
|||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
import appeng.api.networking.storage.IStorageGrid;
|
||||||
import appeng.fluids.helper.IConfigurableFluidInventory;
|
import appeng.fluids.helper.IConfigurableFluidInventory;
|
||||||
|
import appeng.me.cache.GridStorageCache;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
@@ -207,7 +209,7 @@ public class PartFluidStorageBus extends PartSharedStorageBus implements IMEMoni
|
|||||||
{
|
{
|
||||||
this.resetCacheLogic = 2;
|
this.resetCacheLogic = 2;
|
||||||
}
|
}
|
||||||
else
|
else if( resetCacheLogic < 2 )
|
||||||
{
|
{
|
||||||
this.resetCacheLogic = 1;
|
this.resetCacheLogic = 1;
|
||||||
}
|
}
|
||||||
@@ -374,7 +376,7 @@ public class PartFluidStorageBus extends PartSharedStorageBus implements IMEMoni
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// force grid to update handlers...
|
// force grid to update handlers...
|
||||||
this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() );
|
(( GridStorageCache ) this.getProxy().getGrid().getCache( IStorageGrid.class )).cellUpdate( null );
|
||||||
}
|
}
|
||||||
catch( final GridAccessException ignore )
|
catch( final GridAccessException ignore )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final int outputLength = this.isCrafting ? CRAFTING_OUTPUT_LIMIT : PROCESSING_OUTPUT_LIMIT;
|
final int outputLength = out.size();
|
||||||
|
|
||||||
this.inputs = in.toArray(new IAEItemStack[ALL_INPUT_LIMIT]);
|
this.inputs = in.toArray(new IAEItemStack[ALL_INPUT_LIMIT]);
|
||||||
this.outputs = out.toArray(new IAEItemStack[outputLength]);
|
this.outputs = out.toArray(new IAEItemStack[outputLength]);
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
|
|||||||
|
|
||||||
final ICraftingPatternDetails details = this.getPatternForItem( item, w );
|
final ICraftingPatternDetails details = this.getPatternForItem( item, w );
|
||||||
|
|
||||||
out = details != null ? details.getCondensedOutputs()[0].createItemStack() : ItemStack.EMPTY;
|
out = details != null ? details.getOutputs()[0].createItemStack() : ItemStack.EMPTY;
|
||||||
|
|
||||||
SIMPLE_CACHE.put( item, out );
|
SIMPLE_CACHE.put( item, out );
|
||||||
return out;
|
return out;
|
||||||
|
|||||||
@@ -403,7 +403,7 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
|
|||||||
}
|
}
|
||||||
else if( pos.entityHit.attackEntityFrom( dmgSrc, dmg ) )
|
else if( pos.entityHit.attackEntityFrom( dmgSrc, dmg ) )
|
||||||
{
|
{
|
||||||
hasDestroyed = true;
|
hasDestroyed = pos.entityHit.isEntityAlive();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( pos.typeOfHit == RayTraceResult.Type.BLOCK )
|
else if( pos.typeOfHit == RayTraceResult.Type.BLOCK )
|
||||||
|
|||||||
+1
-1
@@ -296,7 +296,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
|
|||||||
// new craftables!
|
// new craftables!
|
||||||
for( final ICraftingPatternDetails details : this.craftingMethods.keySet() )
|
for( final ICraftingPatternDetails details : this.craftingMethods.keySet() )
|
||||||
{
|
{
|
||||||
for( IAEItemStack out : details.getCondensedOutputs() )
|
for( IAEItemStack out : details.getOutputs() )
|
||||||
{
|
{
|
||||||
out = out.copy();
|
out = out.copy();
|
||||||
out.reset();
|
out.reset();
|
||||||
|
|||||||
+86
-61
@@ -65,11 +65,9 @@ public class EnergyGridCache implements IEnergyGrid
|
|||||||
{
|
{
|
||||||
|
|
||||||
private static final double MAX_BUFFER_STORAGE = 800;
|
private static final double MAX_BUFFER_STORAGE = 800;
|
||||||
private static final Comparator<IEnergyGridProvider> COMPARATOR_HIGHEST_AMOUNT_STORED_FIRST = ( o1, o2 ) -> Double.compare( o2.getProviderStoredEnergy(),
|
private static final Comparator<IEnergyGridProvider> COMPARATOR_HIGHEST_AMOUNT_STORED_FIRST = ( o1, o2 ) -> Double.compare( o2.getProviderStoredEnergy(), o1.getProviderStoredEnergy() );
|
||||||
o1.getProviderStoredEnergy() );
|
|
||||||
|
|
||||||
private static final Comparator<IEnergyGridProvider> COMPARATOR_LOWEST_PERCENTAGE_FIRST = ( o1, o2 ) ->
|
private static final Comparator<IEnergyGridProvider> COMPARATOR_LOWEST_PERCENTAGE_FIRST = ( o1, o2 ) -> {
|
||||||
{
|
|
||||||
final double percent1 = ( o1.getProviderStoredEnergy() + 1 ) / ( o1.getProviderMaxEnergy() + 1 );
|
final double percent1 = ( o1.getProviderStoredEnergy() + 1 ) / ( o1.getProviderMaxEnergy() + 1 );
|
||||||
final double percent2 = ( o2.getProviderStoredEnergy() + 1 ) / ( o2.getProviderMaxEnergy() + 1 );
|
final double percent2 = ( o2.getProviderStoredEnergy() + 1 ) / ( o2.getProviderMaxEnergy() + 1 );
|
||||||
|
|
||||||
@@ -163,34 +161,33 @@ public class EnergyGridCache implements IEnergyGrid
|
|||||||
{
|
{
|
||||||
if( ev.storage.isAEPublicPowerStorage() )
|
if( ev.storage.isAEPublicPowerStorage() )
|
||||||
{
|
{
|
||||||
switch ( ev.type )
|
if( ev.type == PowerEventType.PROVIDE_POWER )
|
||||||
{
|
{
|
||||||
case PROVIDE_POWER:
|
if( ev.storage.getPowerFlow() != AccessRestriction.WRITE )
|
||||||
if( ev.storage.getPowerFlow() != AccessRestriction.WRITE )
|
{
|
||||||
|
if( !ongoingExtractOperation )
|
||||||
{
|
{
|
||||||
if( !ongoingExtractOperation )
|
addProvider( ev.storage );
|
||||||
{
|
|
||||||
addProvider( ev.storage );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.providersToAdd.add( ev.storage );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
else
|
||||||
case REQUEST_POWER:
|
|
||||||
if( ev.storage.getPowerFlow() != AccessRestriction.READ )
|
|
||||||
{
|
{
|
||||||
if( !ongoingInjectOperation )
|
this.providersToAdd.add( ev.storage );
|
||||||
{
|
|
||||||
addRequester( ev.storage );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.requesterToAdd.add( ev.storage );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
|
}
|
||||||
|
else if( ev.type == PowerEventType.REQUEST_POWER )
|
||||||
|
{
|
||||||
|
if( ev.storage.getPowerFlow() != AccessRestriction.READ )
|
||||||
|
{
|
||||||
|
if( !ongoingInjectOperation )
|
||||||
|
{
|
||||||
|
addRequester( ev.storage );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.requesterToAdd.add( ev.storage );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -231,7 +228,7 @@ public class EnergyGridCache implements IEnergyGrid
|
|||||||
if( this.drainPerTick > 0.0001 )
|
if( this.drainPerTick > 0.0001 )
|
||||||
{
|
{
|
||||||
final double drained = this.extractAEPower( this.getIdlePowerUsage(), Actionable.MODULATE, PowerMultiplier.CONFIG );
|
final double drained = this.extractAEPower( this.getIdlePowerUsage(), Actionable.MODULATE, PowerMultiplier.CONFIG );
|
||||||
currentlyHasPower = drained >= this.drainPerTick - 0.001 && this.getStoredPower() > 0;
|
currentlyHasPower = drained >= this.drainPerTick - 0.001;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -337,30 +334,55 @@ public class EnergyGridCache implements IEnergyGrid
|
|||||||
|
|
||||||
this.providers.addAll( providersToAdd );
|
this.providers.addAll( providersToAdd );
|
||||||
providersToAdd.clear();
|
providersToAdd.clear();
|
||||||
|
providers.removeIf( providerToRemove::contains );
|
||||||
|
this.providerToRemove.clear();
|
||||||
|
|
||||||
final Iterator<IAEPowerStorage> it = this.providers.iterator();
|
final Iterator<IAEPowerStorage> it = this.providers.iterator();
|
||||||
|
|
||||||
ongoingExtractOperation = true;
|
ongoingExtractOperation = true;
|
||||||
|
boolean ls = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
while ( extractedPower < amt && it.hasNext() )
|
while ( extractedPower < amt && it.hasNext() )
|
||||||
{
|
{
|
||||||
final IAEPowerStorage node = it.next();
|
final IAEPowerStorage node = it.next();
|
||||||
|
if( node != null )
|
||||||
|
{
|
||||||
|
if( node == localStorage && mode == Actionable.MODULATE )
|
||||||
|
{
|
||||||
|
ls = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
final double req = amt - extractedPower;
|
final double req = amt - extractedPower;
|
||||||
final double newPower = node.extractAEPower( req, mode, PowerMultiplier.ONE );
|
final double newPower = node.extractAEPower( req, mode, PowerMultiplier.ONE );
|
||||||
extractedPower += newPower;
|
extractedPower += newPower;
|
||||||
|
|
||||||
if( newPower < req && mode == Actionable.MODULATE )
|
if( newPower < req && mode == Actionable.MODULATE )
|
||||||
|
{
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
it.remove();
|
it.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally
|
} finally
|
||||||
{
|
{
|
||||||
providers.removeIf( p -> providerToRemove.contains( p ) );
|
|
||||||
this.providerToRemove.clear();
|
|
||||||
ongoingExtractOperation = false;
|
ongoingExtractOperation = false;
|
||||||
|
if( ls && extractedPower < amt )
|
||||||
|
{
|
||||||
|
final double req = amt - extractedPower;
|
||||||
|
final double newPower = localStorage.extractAEPower( req, mode, PowerMultiplier.ONE );
|
||||||
|
|
||||||
|
extractedPower += newPower;
|
||||||
|
|
||||||
|
if( newPower < req )
|
||||||
|
{
|
||||||
|
providers.remove( localStorage );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final double result = Math.min( extractedPower, amt );
|
final double result = Math.min( extractedPower, amt );
|
||||||
@@ -386,6 +408,8 @@ public class EnergyGridCache implements IEnergyGrid
|
|||||||
|
|
||||||
this.requesters.addAll( requesterToAdd );
|
this.requesters.addAll( requesterToAdd );
|
||||||
requesterToAdd.clear();
|
requesterToAdd.clear();
|
||||||
|
requesters.removeIf( requesterToRemove::contains );
|
||||||
|
this.requesterToRemove.clear();
|
||||||
|
|
||||||
final Iterator<IAEPowerStorage> it = this.requesters.iterator();
|
final Iterator<IAEPowerStorage> it = this.requesters.iterator();
|
||||||
|
|
||||||
@@ -396,17 +420,22 @@ public class EnergyGridCache implements IEnergyGrid
|
|||||||
{
|
{
|
||||||
final IAEPowerStorage node = it.next();
|
final IAEPowerStorage node = it.next();
|
||||||
|
|
||||||
amt = node.injectAEPower( amt, mode );
|
if( node != null )
|
||||||
|
{
|
||||||
|
amt = node.injectAEPower( amt, mode );
|
||||||
|
|
||||||
if( amt > 0 && mode == Actionable.MODULATE )
|
if( amt > 0 && mode == Actionable.MODULATE )
|
||||||
|
{
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
it.remove();
|
it.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally
|
} finally
|
||||||
{
|
{
|
||||||
requesters.removeIf( r -> requesterToRemove.contains( r ) );
|
|
||||||
this.requesterToRemove.clear();
|
|
||||||
ongoingInjectOperation = false;
|
ongoingInjectOperation = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -426,7 +455,7 @@ public class EnergyGridCache implements IEnergyGrid
|
|||||||
double required = 0;
|
double required = 0;
|
||||||
|
|
||||||
final Iterator<IAEPowerStorage> it = this.requesters.iterator();
|
final Iterator<IAEPowerStorage> it = this.requesters.iterator();
|
||||||
while( required < maxRequired && it.hasNext() )
|
while ( required < maxRequired && it.hasNext() )
|
||||||
{
|
{
|
||||||
final IAEPowerStorage node = it.next();
|
final IAEPowerStorage node = it.next();
|
||||||
if( node.getPowerFlow() != AccessRestriction.READ )
|
if( node.getPowerFlow() != AccessRestriction.READ )
|
||||||
@@ -591,28 +620,28 @@ public class EnergyGridCache implements IEnergyGrid
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addRequester(IAEPowerStorage requester) {
|
private void addRequester( IAEPowerStorage requester )
|
||||||
Preconditions.checkState(!ongoingInjectOperation,
|
{
|
||||||
"Cannot modify energy requesters while energy is being injected.");
|
Preconditions.checkState( !ongoingInjectOperation, "Cannot modify energy requesters while energy is being injected." );
|
||||||
this.requesters.add(requester);
|
this.requesters.add( requester );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeRequester(IAEPowerStorage requester) {
|
private void removeRequester( IAEPowerStorage requester )
|
||||||
Preconditions.checkState(!ongoingInjectOperation,
|
{
|
||||||
"Cannot modify energy requesters while energy is being injected.");
|
Preconditions.checkState( !ongoingInjectOperation, "Cannot modify energy requesters while energy is being injected." );
|
||||||
this.requesters.remove(requester);
|
this.requesters.remove( requester );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addProvider(IAEPowerStorage provider) {
|
private void addProvider( IAEPowerStorage provider )
|
||||||
Preconditions.checkState(!ongoingExtractOperation,
|
{
|
||||||
"Cannot modify energy providers while energy is being extracted.");
|
Preconditions.checkState( !ongoingExtractOperation, "Cannot modify energy providers while energy is being extracted." );
|
||||||
this.providers.add(provider);
|
this.providers.add( provider );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeProvider(IAEPowerStorage provider) {
|
private void removeProvider( IAEPowerStorage provider )
|
||||||
Preconditions.checkState(!ongoingExtractOperation,
|
{
|
||||||
"Cannot modify energy providers while energy is being extracted.");
|
Preconditions.checkState( !ongoingExtractOperation, "Cannot modify energy providers while energy is being extracted." );
|
||||||
this.providers.remove(provider);
|
this.providers.remove( provider );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -788,12 +817,8 @@ public class EnergyGridCache implements IEnergyGrid
|
|||||||
|
|
||||||
if( this.stored < 0.01 )
|
if( this.stored < 0.01 )
|
||||||
{
|
{
|
||||||
refreshPower();
|
EnergyGridCache.this.ticksSinceHasPowerChange = 0;
|
||||||
if (globalAvailablePower < MAX_BUFFER_STORAGE - 0.001)
|
EnergyGridCache.this.publicPowerState( false, EnergyGridCache.this.myGrid );
|
||||||
{
|
|
||||||
EnergyGridCache.this.ticksSinceHasPowerChange = 0;
|
|
||||||
EnergyGridCache.this.publicPowerState( false, EnergyGridCache.this.myGrid );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -94,7 +94,7 @@ public class GridStorageCache implements IStorageGrid
|
|||||||
|
|
||||||
this.removeCellProvider( cc, tracker );
|
this.removeCellProvider( cc, tracker );
|
||||||
this.inactiveCellProviders.remove( cc );
|
this.inactiveCellProviders.remove( cc );
|
||||||
this.getGrid().postEvent( new MENetworkCellArrayUpdate() );
|
cellUpdate( null );
|
||||||
|
|
||||||
tracker.applyChanges();
|
tracker.applyChanges();
|
||||||
}
|
}
|
||||||
@@ -119,7 +119,7 @@ public class GridStorageCache implements IStorageGrid
|
|||||||
final ICellContainer cc = (ICellContainer) machine;
|
final ICellContainer cc = (ICellContainer) machine;
|
||||||
this.inactiveCellProviders.add( cc );
|
this.inactiveCellProviders.add( cc );
|
||||||
|
|
||||||
this.getGrid().postEvent( new MENetworkCellArrayUpdate() );
|
cellUpdate( null );
|
||||||
|
|
||||||
if( node.isActive() )
|
if( node.isActive() )
|
||||||
{
|
{
|
||||||
@@ -170,7 +170,7 @@ public class GridStorageCache implements IStorageGrid
|
|||||||
|
|
||||||
private CellChangeTracker addCellProvider( final ICellProvider cc, final CellChangeTracker tracker )
|
private CellChangeTracker addCellProvider( final ICellProvider cc, final CellChangeTracker tracker )
|
||||||
{
|
{
|
||||||
if( this.inactiveCellProviders.contains( cc ) )
|
if( this.inactiveCellProviders.contains( cc ) && !this.activeCellProviders.contains( cc ))
|
||||||
{
|
{
|
||||||
this.inactiveCellProviders.remove( cc );
|
this.inactiveCellProviders.remove( cc );
|
||||||
this.activeCellProviders.add( cc );
|
this.activeCellProviders.add( cc );
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ public class MEMonitorPassThrough<T extends IAEStack<T>> extends MEPassThrough<T
|
|||||||
final IItemList<T> after = this.getInternal() == null ? this.getWrappedChannel().createList() : this.getInternal()
|
final IItemList<T> after = this.getInternal() == null ? this.getWrappedChannel().createList() : this.getInternal()
|
||||||
.getAvailableItems( new ItemListIgnoreCrafting( this.getWrappedChannel().createList() ) );
|
.getAvailableItems( new ItemListIgnoreCrafting( this.getWrappedChannel().createList() ) );
|
||||||
|
|
||||||
if( this.monitor != null )
|
if( this.monitor != null && this.listeners.size() > 0 )
|
||||||
{
|
{
|
||||||
this.monitor.addListener( this, this.monitor );
|
this.monitor.addListener( this, this.monitor );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -180,7 +180,10 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.pushItemIntoTarget( destination, energy, inv, ais );
|
if( inv.getStorageList().findPrecise( ais ) != null )
|
||||||
|
{
|
||||||
|
this.pushItemIntoTarget( destination, energy, inv, ais );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( this.itemToSend == before && this.isCraftingEnabled() )
|
if( this.itemToSend == before && this.isCraftingEnabled() )
|
||||||
|
|||||||
@@ -283,12 +283,12 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
|
|||||||
final ItemStack simResult;
|
final ItemStack simResult;
|
||||||
if( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 )
|
if( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 )
|
||||||
{
|
{
|
||||||
simResult = myAdaptor.simulateSimilarRemove( toSend, itemStackToImport, fzMode, this );
|
simResult = myAdaptor.simulateSimilarRemove( toSend, itemStackToImport, fzMode, null );
|
||||||
itemAmountNotStorable = inv.injectItems( AEItemStack.fromItemStack( simResult ), Actionable.SIMULATE, this.source );
|
itemAmountNotStorable = inv.injectItems( AEItemStack.fromItemStack( simResult ), Actionable.SIMULATE, this.source );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
simResult = myAdaptor.simulateRemove( toSend, itemStackToImport, this );
|
simResult = myAdaptor.simulateRemove( toSend, itemStackToImport, null );
|
||||||
itemAmountNotStorable = inv.injectItems( AEItemStack.fromItemStack( simResult ), Actionable.SIMULATE, this.source );
|
itemAmountNotStorable = inv.injectItems( AEItemStack.fromItemStack( simResult ), Actionable.SIMULATE, this.source );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,8 +22,12 @@ package appeng.parts.misc;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import appeng.fluids.parts.PartFluidInterface;
|
||||||
|
import appeng.fluids.tile.TileFluidInterface;
|
||||||
|
import appeng.tile.networking.TileCableBus;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
|
||||||
@@ -153,7 +157,24 @@ public abstract class PartSharedStorageBus extends PartUpgradeable implements IG
|
|||||||
@Override
|
@Override
|
||||||
public void onNeighborChanged( IBlockAccess w, BlockPos pos, BlockPos neighbor )
|
public void onNeighborChanged( IBlockAccess w, BlockPos pos, BlockPos neighbor )
|
||||||
{
|
{
|
||||||
if( pos.offset( this.getSide().getFacing() ).equals( neighbor ) )
|
|
||||||
|
final TileEntity te = w.getTileEntity( neighbor );
|
||||||
|
|
||||||
|
// In case the TE was destroyed, we have to do a full reset immediately.
|
||||||
|
if( te instanceof TileCableBus )
|
||||||
|
{
|
||||||
|
if( ( (TileCableBus) te ).getPart( this.getSide().getOpposite() ) instanceof PartFluidInterface )
|
||||||
|
{
|
||||||
|
this.resetCache( true );
|
||||||
|
this.resetCache();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( te == null || te instanceof TileFluidInterface )
|
||||||
|
{
|
||||||
|
this.resetCache( true );
|
||||||
|
this.resetCache();
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
this.resetCache( false );
|
this.resetCache( false );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,10 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import appeng.api.networking.storage.IStorageGrid;
|
||||||
|
import appeng.me.cache.GridStorageCache;
|
||||||
|
import appeng.tile.misc.TileInterface;
|
||||||
|
import appeng.tile.networking.TileCableBus;
|
||||||
import com.jaquadro.minecraft.storagedrawers.api.capabilities.IItemRepository;
|
import com.jaquadro.minecraft.storagedrawers.api.capabilities.IItemRepository;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -234,7 +238,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
|||||||
{
|
{
|
||||||
this.resetCacheLogic = 2;
|
this.resetCacheLogic = 2;
|
||||||
}
|
}
|
||||||
else
|
else if( resetCacheLogic < 2 )
|
||||||
{
|
{
|
||||||
this.resetCacheLogic = 1;
|
this.resetCacheLogic = 1;
|
||||||
}
|
}
|
||||||
@@ -296,7 +300,15 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
|||||||
final TileEntity te = w.getTileEntity( neighbor );
|
final TileEntity te = w.getTileEntity( neighbor );
|
||||||
|
|
||||||
// In case the TE was destroyed, we have to do a full reset immediately.
|
// In case the TE was destroyed, we have to do a full reset immediately.
|
||||||
if( te == null )
|
if( te instanceof TileCableBus )
|
||||||
|
{
|
||||||
|
if( ( (TileCableBus) te ).getPart( this.getSide().getOpposite() ) instanceof PartInterface )
|
||||||
|
{
|
||||||
|
this.resetCache( true );
|
||||||
|
this.resetCache();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( te == null || te instanceof TileInterface )
|
||||||
{
|
{
|
||||||
this.resetCache( true );
|
this.resetCache( true );
|
||||||
this.resetCache();
|
this.resetCache();
|
||||||
@@ -434,16 +446,6 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
|||||||
return Objects.hash( target, target.getCapability( Capabilities.STORAGE_MONITORABLE_ACCESSOR, targetSide ) );
|
return Objects.hash( target, target.getCapability( Capabilities.STORAGE_MONITORABLE_ACCESSOR, targetSide ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ITEM_REPOSITORY_CAPABILITY != null && target.hasCapability( ITEM_REPOSITORY_CAPABILITY, targetSide ))
|
|
||||||
{
|
|
||||||
final IItemRepository handlerRepo = target.getCapability( ITEM_REPOSITORY_CAPABILITY, targetSide );
|
|
||||||
|
|
||||||
if( handlerRepo != null )
|
|
||||||
{
|
|
||||||
return Objects.hash( target, handlerRepo, handlerRepo.getAllItems().size() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
final IItemHandler itemHandler = target.getCapability( CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, targetSide );
|
final IItemHandler itemHandler = target.getCapability( CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, targetSide );
|
||||||
|
|
||||||
if( itemHandler != null )
|
if( itemHandler != null )
|
||||||
@@ -557,7 +559,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// force grid to update handlers...
|
// force grid to update handlers...
|
||||||
this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() );
|
(( GridStorageCache ) this.getProxy().getGrid().getCache( IStorageGrid.class )).cellUpdate( null );
|
||||||
}
|
}
|
||||||
catch( final GridAccessException e )
|
catch( final GridAccessException e )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -206,10 +206,17 @@ public abstract class AbstractPartMonitor extends AbstractPartDisplay implements
|
|||||||
fluidInTank = fluidHandlerItem.drain( Integer.MAX_VALUE, false );
|
fluidInTank = fluidHandlerItem.drain( Integer.MAX_VALUE, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fluidInTank == null)
|
if( fluidInTank == null )
|
||||||
{
|
{
|
||||||
this.configuredFluid = null;
|
this.configuredFluid = null;
|
||||||
this.configuredItem = AEItemStack.fromItemStack( eq );
|
if( !eq.isEmpty() )
|
||||||
|
{
|
||||||
|
this.configuredItem = AEItemStack.fromItemStack( eq ).setStackSize( 0 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.configuredItem = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if( fluidInTank.amount > 0 )
|
else if( fluidInTank.amount > 0 )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -170,8 +170,7 @@ public class PartConversionMonitor extends AbstractPartMonitor
|
|||||||
this.insertItem( player, hand, false );
|
this.insertItem( player, hand, false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return super.onPartActivate( player, hand, pos );
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( this.internalCurrentPower < 0.01 && amt > 0.01 )
|
if( this.internalCurrentPower < 0.01 && amt > 0 )
|
||||||
{
|
{
|
||||||
this.getProxy().getNode().getGrid().postEvent( new MENetworkPowerStorage( this, PowerEventType.PROVIDE_POWER ) );
|
this.getProxy().getNode().getGrid().postEvent( new MENetworkPowerStorage( this, PowerEventType.PROVIDE_POWER ) );
|
||||||
}
|
}
|
||||||
@@ -217,7 +217,7 @@ public class TileEnergyCell extends AENetworkTile implements IAEPowerStorage
|
|||||||
|
|
||||||
final boolean wasFull = this.internalCurrentPower >= this.getInternalMaxPower() - 0.001;
|
final boolean wasFull = this.internalCurrentPower >= this.getInternalMaxPower() - 0.001;
|
||||||
|
|
||||||
if( wasFull && amt > 0.001 )
|
if( wasFull && amt > 0 )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user