Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d3dd137570 | |||
| 78e1126c38 | |||
| ebe3ff045d | |||
| 6291a545c3 | |||
| 99fd5a9d53 | |||
| 416c7d2683 | |||
| 0c88d1e7ee | |||
| d88f550eb0 | |||
| e21c59b326 | |||
| d8af8d26be | |||
| 02426bc101 | |||
| 11f8471772 | |||
| d35b720a16 | |||
| 7a5b84c10a | |||
| 800860d4e6 |
@@ -0,0 +1,30 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: You found a bug or encountered a crash? Please report it here.
|
||||
|
||||
---
|
||||
|
||||
<!-- Provide a summary of the issue in the Title above, please do not "[Tag]" it. -->
|
||||
|
||||
**Describe the bug**
|
||||
<!-- Always use the most recent version from ae-mod.info, it might already be fixed. -->
|
||||
|
||||
**To Reproduce**
|
||||
<!-- Please provide the steps to reproduce it, otherwise we might not be able to fix it. -->
|
||||
|
||||
**Expected behavior**
|
||||
<!-- A clear and concise description of what you expected to happen. -->
|
||||
|
||||
**Additional context**
|
||||
<!-- Screenshots, crashlogs, etc. -->
|
||||
<!-- A complete crashlog is required when reporting a crash. No excerpts. -->
|
||||
<!-- Please use pastebin or gist for posting the complete crashlog. -->
|
||||
|
||||
**Environment**
|
||||
<!-- Include as many relevant details about the environment -->
|
||||
<!-- Like the used version, SP/MP, other mods and their version -->
|
||||
<!-- The following ones are required, please note "latest" is not a version -->
|
||||
|
||||
- Minecraft Version:
|
||||
- AE2 Version:
|
||||
- Forge Version:
|
||||
@@ -0,0 +1,17 @@
|
||||
---
|
||||
name: Feature Request
|
||||
about: A feature request or suggestion to improve Applied Energistics 2
|
||||
|
||||
---
|
||||
|
||||
<!-- Provide a summary of the issue in the Title above, please do not "[Tag]" it. -->
|
||||
|
||||
**Describe the feature**
|
||||
<!-- Tell us how it should work. -->
|
||||
|
||||
**Reasons why it should be considered**
|
||||
<!-- This can help us in various degrees, e.g. to determine if it fits our design ideas. -->
|
||||
|
||||
**Additional Context**
|
||||
<!-- Use this for further details, e.g. screenshots, links to mods for integrations. -->
|
||||
<!-- Features will only be considered for the latest/next version. -->
|
||||
+2
-2
@@ -9,7 +9,7 @@ aebasename=appliedenergistics2
|
||||
#########################################################
|
||||
minecraft_version=1.12.2
|
||||
mcp_mappings=snapshot_20171003
|
||||
forge_version=14.23.3.2655
|
||||
forge_version=14.23.5.2768
|
||||
|
||||
#########################################################
|
||||
# Installable #
|
||||
@@ -19,7 +19,7 @@ hwyla_version=1.8.26-B41_1.12.2
|
||||
#########################################################
|
||||
# Provided APIs #
|
||||
#########################################################
|
||||
jei_version=4.10.0.198
|
||||
jei_version=4.13.0.219
|
||||
tesla_version=1.0.63
|
||||
ic2_version=2.8.73-ex112
|
||||
top_version=1.12-1.4.23-16
|
||||
|
||||
@@ -29,5 +29,5 @@ package appeng.api.implementations.items;
|
||||
*/
|
||||
public enum MemoryCardMessages
|
||||
{
|
||||
INVALID_MACHINE, SETTINGS_LOADED, SETTINGS_SAVED, SETTINGS_CLEARED
|
||||
INVALID_MACHINE, SETTINGS_LOADED, SETTINGS_SAVED, SETTINGS_RESET, SETTINGS_CLEARED
|
||||
}
|
||||
|
||||
@@ -67,8 +67,8 @@ import appeng.thirdparty.codechicken.lib.model.pipeline.transformers.QuadTinter;
|
||||
public class FacadeBuilder
|
||||
{
|
||||
|
||||
public static double THICK_THICKNESS = 2D / 16D;
|
||||
public static double THIN_THICKNESS = 1D / 16D;
|
||||
public static final double THICK_THICKNESS = 2D / 16D;
|
||||
public static final double THIN_THICKNESS = 1D / 16D;
|
||||
|
||||
public static final AxisAlignedBB[] THICK_FACADE_BOXES = new AxisAlignedBB[] {
|
||||
new AxisAlignedBB( 0.0, 0.0, 0.0, 1.0, THICK_THICKNESS, 1.0 ),
|
||||
@@ -141,7 +141,7 @@ public class FacadeBuilder
|
||||
|
||||
IBlockState blockState = facadeRenderState.getSourceBlock();
|
||||
// If we aren't forcing transparency let the block decide if it should render.
|
||||
if( !transparent )
|
||||
if( !transparent && layer != null )
|
||||
{
|
||||
if( !blockState.getBlock().canRenderInLayer( blockState, layer ) )
|
||||
{
|
||||
@@ -224,7 +224,7 @@ public class FacadeBuilder
|
||||
|
||||
List<BakedQuad> modelQuads = new ArrayList<>();
|
||||
// If we are forcing transparent facades, fake the render layer, and grab all quads.
|
||||
if( transparent )
|
||||
if( transparent || layer == null )
|
||||
{
|
||||
for( BlockRenderLayer forcedLayer : BlockRenderLayer.values() )
|
||||
{
|
||||
|
||||
@@ -100,15 +100,18 @@ class GlassBakedModel implements IBakedModel
|
||||
@Override
|
||||
public List<BakedQuad> getQuads( @Nullable IBlockState state, @Nullable EnumFacing side, long rand )
|
||||
{
|
||||
|
||||
if( !( state instanceof IExtendedBlockState ) || side == null )
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
IExtendedBlockState extState = (IExtendedBlockState) state;
|
||||
final IExtendedBlockState extState = (IExtendedBlockState) state;
|
||||
final GlassState glassState = extState.getValue( BlockQuartzGlass.GLASS_STATE );
|
||||
|
||||
GlassState glassState = extState.getValue( BlockQuartzGlass.GLASS_STATE );
|
||||
if( glassState == null )
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
final int cx = Math.abs( glassState.getX() % 10 );
|
||||
final int cy = Math.abs( glassState.getY() % 10 );
|
||||
@@ -125,12 +128,12 @@ class GlassBakedModel implements IBakedModel
|
||||
v /= 2;
|
||||
}
|
||||
|
||||
TextureAtlasSprite glassTexture = this.glassTextures[texIdx];
|
||||
final TextureAtlasSprite glassTexture = this.glassTextures[texIdx];
|
||||
|
||||
// Render the glass side
|
||||
List<BakedQuad> quads = new ArrayList<>( 5 ); // At most 5
|
||||
final List<BakedQuad> quads = new ArrayList<>( 5 ); // At most 5
|
||||
|
||||
List<Vec3d> corners = RenderHelper.getFaceCorners( side );
|
||||
final List<Vec3d> corners = RenderHelper.getFaceCorners( side );
|
||||
quads.add( this.createQuad( side, corners, glassTexture, u, v ) );
|
||||
|
||||
/*
|
||||
@@ -143,8 +146,9 @@ class GlassBakedModel implements IBakedModel
|
||||
* Converted to a number, this bitmask is 5. So the texture at index 5 is used.
|
||||
* That texture had "0101" in its filename to indicate this.
|
||||
*/
|
||||
int edgeBitmask = makeBitmask( glassState, side );
|
||||
TextureAtlasSprite sideSprite = this.frameTextures[edgeBitmask];
|
||||
final int edgeBitmask = makeBitmask( glassState, side );
|
||||
final TextureAtlasSprite sideSprite = this.frameTextures[edgeBitmask];
|
||||
|
||||
if( sideSprite != null )
|
||||
{
|
||||
quads.add( this.createQuad( side, corners, sideSprite, 0, 0 ) );
|
||||
|
||||
@@ -462,7 +462,6 @@ public abstract class AEBaseContainer extends Container
|
||||
else if( destination.isEmpty() )
|
||||
{
|
||||
cs.putStack( tis.copy() );
|
||||
cs.onSlotChanged();
|
||||
this.updateSlot( cs );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public class AppEngSlot extends Slot
|
||||
{
|
||||
if( this.isSlotEnabled() )
|
||||
{
|
||||
return ItemHandlerUtil.isItemValidForSlot( this.itemHandler, this.index, par1ItemStack );
|
||||
return this.itemHandler.isItemValid( this.index, par1ItemStack );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -121,7 +121,6 @@ public class AppEngSlot extends Slot
|
||||
if( this.isSlotEnabled() )
|
||||
{
|
||||
ItemHandlerUtil.setStackInSlot( this.itemHandler, this.index, stack );
|
||||
this.onSlotChanged();
|
||||
|
||||
if( this.getContainer() != null )
|
||||
{
|
||||
@@ -138,7 +137,6 @@ public class AppEngSlot extends Slot
|
||||
@Override
|
||||
public void onSlotChanged()
|
||||
{
|
||||
ItemHandlerUtil.markDirty( this.itemHandler, this.index );
|
||||
this.setIsValid( hasCalculatedValidness.NotAvailable );
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ public enum PlayerMessages
|
||||
InvalidMachine,
|
||||
LoadedSettings,
|
||||
SavedSettings,
|
||||
ResetSettings,
|
||||
MachineNotPowered,
|
||||
|
||||
isNowLocked,
|
||||
|
||||
@@ -85,11 +85,11 @@ public class FluidCellConfig extends CellConfig
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot( int slot, ItemStack stack )
|
||||
public boolean isItemValid( int slot, ItemStack stack )
|
||||
{
|
||||
if( stack.isEmpty() || stack.getItem() instanceof FluidDummyItem )
|
||||
{
|
||||
super.isItemValidForSlot( slot, stack );
|
||||
super.isItemValid( slot, stack );
|
||||
}
|
||||
FluidStack fluid = FluidUtil.getFluidContained( stack );
|
||||
if( fluid == null || !Api.INSTANCE.definitions().items().dummyFluidItem().maybeStack( 1 ).isPresent() )
|
||||
@@ -100,7 +100,7 @@ public class FluidCellConfig extends CellConfig
|
||||
ItemStack is = Api.INSTANCE.definitions().items().dummyFluidItem().maybeStack( 1 ).get();
|
||||
FluidDummyItem item = (FluidDummyItem) is.getItem();
|
||||
item.setFluidStack( is, fluid );
|
||||
return super.isItemValidForSlot( slot, is );
|
||||
return super.isItemValid( slot, is );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,10 +17,10 @@ public class AEFluidInventory implements IAEFluidTank
|
||||
{
|
||||
private final IAEFluidStack[] fluids;
|
||||
private final IAEFluidInventory handler;
|
||||
private final long capacity;
|
||||
private final int capacity;
|
||||
private IFluidTankProperties[] props = null;
|
||||
|
||||
public AEFluidInventory( final IAEFluidInventory handler, final int slots, final long capcity )
|
||||
public AEFluidInventory( final IAEFluidInventory handler, final int slots, final int capcity )
|
||||
{
|
||||
this.fluids = new IAEFluidStack[slots];
|
||||
this.handler = handler;
|
||||
@@ -29,7 +29,7 @@ public class AEFluidInventory implements IAEFluidTank
|
||||
|
||||
public AEFluidInventory( final IAEFluidInventory handler, final int slots )
|
||||
{
|
||||
this( handler, slots, Long.MAX_VALUE );
|
||||
this( handler, slots, Integer.MAX_VALUE );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -110,45 +110,34 @@ public class AEFluidInventory implements IAEFluidTank
|
||||
|
||||
final IAEFluidStack fluid = this.fluids[slot];
|
||||
|
||||
if( !doFill )
|
||||
{
|
||||
if( fluid == null )
|
||||
{
|
||||
return resource.amount;
|
||||
}
|
||||
|
||||
if( !fluid.equals( resource ) )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (int) Math.min( Math.min( this.capacity - fluid.getStackSize(), resource.amount ), Integer.MAX_VALUE );
|
||||
}
|
||||
|
||||
if( fluid == null )
|
||||
{
|
||||
this.setFluidInSlot( slot, AEFluidStack.fromFluidStack( resource ) );
|
||||
return resource.amount;
|
||||
}
|
||||
|
||||
if( !fluid.equals( resource ) )
|
||||
if( fluid != null && !fluid.equals( resource ) )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
long filled = this.capacity - fluid.getStackSize();
|
||||
|
||||
if( resource.amount < filled )
|
||||
int amountToStore = this.capacity;
|
||||
|
||||
if( fluid != null )
|
||||
{
|
||||
fluid.setStackSize( fluid.getStackSize() + resource.amount );
|
||||
filled = resource.amount;
|
||||
}
|
||||
else
|
||||
{
|
||||
fluid.setStackSize( this.capacity );
|
||||
amountToStore -= fluid.getStackSize();
|
||||
}
|
||||
|
||||
this.onContentChanged( slot );
|
||||
return (int) filled;
|
||||
amountToStore = Math.min( amountToStore, resource.amount );
|
||||
|
||||
if( doFill )
|
||||
{
|
||||
if( fluid == null )
|
||||
{
|
||||
this.setFluidInSlot( slot, AEFluidStack.fromFluidStack( resource ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
fluid.setStackSize( fluid.getStackSize() + amountToStore );
|
||||
this.onContentChanged( slot );
|
||||
}
|
||||
}
|
||||
|
||||
return amountToStore;
|
||||
}
|
||||
|
||||
public FluidStack drain( final int slot, final FluidStack resource, final boolean doDrain )
|
||||
@@ -363,7 +352,7 @@ public class AEFluidInventory implements IAEFluidTank
|
||||
@Override
|
||||
public int getCapacity()
|
||||
{
|
||||
return (int) Math.min( AEFluidInventory.this.capacity, Integer.MAX_VALUE );
|
||||
return Math.min( AEFluidInventory.this.capacity, Integer.MAX_VALUE );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -49,37 +49,41 @@ import appeng.util.item.AEStack;
|
||||
public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFluidStack, Comparable<AEFluidStack>
|
||||
{
|
||||
|
||||
private final int myHash;
|
||||
private final Fluid fluid;
|
||||
private NBTTagCompound tagCompound;
|
||||
|
||||
private AEFluidStack( final AEFluidStack is )
|
||||
private AEFluidStack( final AEFluidStack fluidStack )
|
||||
{
|
||||
|
||||
this.fluid = is.fluid;
|
||||
this.setStackSize( is.getStackSize() );
|
||||
this.fluid = fluidStack.fluid;
|
||||
this.setStackSize( fluidStack.getStackSize() );
|
||||
|
||||
// priority = is.priority;
|
||||
this.setCraftable( is.isCraftable() );
|
||||
this.setCountRequestable( is.getCountRequestable() );
|
||||
this.setCraftable( fluidStack.isCraftable() );
|
||||
this.setCountRequestable( fluidStack.getCountRequestable() );
|
||||
|
||||
this.myHash = is.myHash;
|
||||
if( fluidStack.hasTagCompound() )
|
||||
{
|
||||
this.tagCompound = fluidStack.tagCompound.copy();
|
||||
}
|
||||
}
|
||||
|
||||
private AEFluidStack( @Nonnull final FluidStack is )
|
||||
private AEFluidStack( @Nonnull final FluidStack fluidStack )
|
||||
{
|
||||
this.fluid = is.getFluid();
|
||||
this.fluid = fluidStack.getFluid();
|
||||
|
||||
if( this.fluid == null )
|
||||
{
|
||||
throw new IllegalArgumentException( "Fluid is null." );
|
||||
}
|
||||
|
||||
this.setStackSize( is.amount );
|
||||
this.setStackSize( fluidStack.amount );
|
||||
this.setCraftable( false );
|
||||
this.setCountRequestable( 0 );
|
||||
|
||||
this.myHash = this.fluid.hashCode() ^ ( this.tagCompound == null ? 0 : System.identityHashCode( this.tagCompound ) );
|
||||
if( fluidStack.tag != null )
|
||||
{
|
||||
this.tagCompound = fluidStack.tag.copy();
|
||||
}
|
||||
}
|
||||
|
||||
public static AEFluidStack fromFluidStack( final FluidStack input )
|
||||
@@ -92,9 +96,9 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
|
||||
return new AEFluidStack( input );
|
||||
}
|
||||
|
||||
public static IAEFluidStack fromNBT( final NBTTagCompound i )
|
||||
public static IAEFluidStack fromNBT( final NBTTagCompound data )
|
||||
{
|
||||
final FluidStack fluidStack = FluidStack.loadFluidStackFromNBT( i );
|
||||
final FluidStack fluidStack = FluidStack.loadFluidStackFromNBT( data );
|
||||
|
||||
if( fluidStack == null )
|
||||
{
|
||||
@@ -102,15 +106,21 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
|
||||
}
|
||||
|
||||
final AEFluidStack fluid = AEFluidStack.fromFluidStack( fluidStack );
|
||||
fluid.setStackSize( i.getLong( "Cnt" ) );
|
||||
fluid.setCountRequestable( i.getLong( "Req" ) );
|
||||
fluid.setCraftable( i.getBoolean( "Craft" ) );
|
||||
fluid.setStackSize( data.getLong( "Cnt" ) );
|
||||
fluid.setCountRequestable( data.getLong( "Req" ) );
|
||||
fluid.setCraftable( data.getBoolean( "Craft" ) );
|
||||
|
||||
if( fluid.hasTagCompound() )
|
||||
{
|
||||
fluid.tagCompound = fluid.tagCompound.copy();
|
||||
}
|
||||
|
||||
return fluid;
|
||||
}
|
||||
|
||||
public static IAEFluidStack fromPacket( final ByteBuf data ) throws IOException
|
||||
public static IAEFluidStack fromPacket( final ByteBuf buffer ) throws IOException
|
||||
{
|
||||
final byte mask = data.readByte();
|
||||
final byte mask = buffer.readByte();
|
||||
final byte stackType = (byte) ( ( mask & 0x0C ) >> 2 );
|
||||
final byte countReqType = (byte) ( ( mask & 0x30 ) >> 4 );
|
||||
final boolean isCraftable = ( mask & 0x40 ) > 0;
|
||||
@@ -119,26 +129,26 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
|
||||
// don't send this...
|
||||
final NBTTagCompound d = new NBTTagCompound();
|
||||
|
||||
final byte len2 = data.readByte();
|
||||
final byte len2 = buffer.readByte();
|
||||
final byte[] name = new byte[len2];
|
||||
data.readBytes( name, 0, len2 );
|
||||
buffer.readBytes( name, 0, len2 );
|
||||
|
||||
d.setString( "FluidName", new String( name, "UTF-8" ) );
|
||||
d.setByte( "Count", (byte) 0 );
|
||||
|
||||
if( hasTagCompound )
|
||||
{
|
||||
final int len = data.readInt();
|
||||
final int len = buffer.readInt();
|
||||
|
||||
final byte[] bd = new byte[len];
|
||||
data.readBytes( bd );
|
||||
buffer.readBytes( bd );
|
||||
|
||||
final DataInputStream di = new DataInputStream( new ByteArrayInputStream( bd ) );
|
||||
d.setTag( "tag", CompressedStreamTools.read( di ) );
|
||||
d.setTag( "Tag", CompressedStreamTools.read( di ) );
|
||||
}
|
||||
|
||||
final long stackSize = getPacketValue( stackType, data );
|
||||
final long countRequestable = getPacketValue( countReqType, data );
|
||||
final long stackSize = getPacketValue( stackType, buffer );
|
||||
final long countRequestable = getPacketValue( countReqType, buffer );
|
||||
|
||||
final FluidStack fluidStack = FluidStack.loadFluidStackFromNBT( d );
|
||||
|
||||
@@ -168,51 +178,21 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT( final NBTTagCompound i )
|
||||
public void writeToNBT( final NBTTagCompound data )
|
||||
{
|
||||
/*
|
||||
* Mojang Fucked this over ; GC Optimization - Ugly Yes, but it saves a lot in the memory department.
|
||||
*/
|
||||
data.setString( "FluidName", this.fluid.getName() );
|
||||
data.setByte( "Count", (byte) 0 );
|
||||
data.setLong( "Cnt", this.getStackSize() );
|
||||
data.setLong( "Req", this.getCountRequestable() );
|
||||
data.setBoolean( "Craft", this.isCraftable() );
|
||||
|
||||
/*
|
||||
* NBTBase FluidName = i.getTag( "FluidName" ); NBTBase Count = i.getTag( "Count" ); NBTBase Cnt = i.getTag(
|
||||
* "Cnt" ); NBTBase Req = i.getTag( "Req" ); NBTBase Craft = i.getTag( "Craft" );
|
||||
*/
|
||||
|
||||
/*
|
||||
* if ( FluidName != null && FluidName instanceof NBTTagString ) ((NBTTagString) FluidName).data = (String)
|
||||
* this.fluid.getName(); else
|
||||
*/
|
||||
i.setString( "FluidName", this.fluid.getName() );
|
||||
|
||||
/*
|
||||
* if ( Count != null && Count instanceof NBTTagByte ) ((NBTTagByte) Count).data = (byte) 0; else
|
||||
*/
|
||||
i.setByte( "Count", (byte) 0 );
|
||||
|
||||
/*
|
||||
* if ( Cnt != null && Cnt instanceof NBTTagLong ) ((NBTTagLong) Cnt).data = this.stackSize; else
|
||||
*/
|
||||
i.setLong( "Cnt", this.getStackSize() );
|
||||
|
||||
/*
|
||||
* if ( Req != null && Req instanceof NBTTagLong ) ((NBTTagLong) Req).data = this.stackSize; else
|
||||
*/
|
||||
i.setLong( "Req", this.getCountRequestable() );
|
||||
|
||||
/*
|
||||
* if ( Craft != null && Craft instanceof NBTTagByte ) ((NBTTagByte) Craft).data = (byte) (this.isCraftable() ?
|
||||
* 1 : 0); else
|
||||
*/
|
||||
i.setBoolean( "Craft", this.isCraftable() );
|
||||
|
||||
if( this.tagCompound != null )
|
||||
if( this.hasTagCompound() )
|
||||
{
|
||||
i.setTag( "tag", this.tagCompound );
|
||||
data.setTag( "Tag", this.tagCompound );
|
||||
}
|
||||
else
|
||||
{
|
||||
i.removeTag( "tag" );
|
||||
data.removeTag( "Tag" );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,29 +235,43 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo( final AEFluidStack b )
|
||||
public int compareTo( final AEFluidStack other )
|
||||
{
|
||||
final int diff = this.hashCode() - b.hashCode();
|
||||
return diff > 0 ? 1 : ( diff < 0 ? -1 : 0 );
|
||||
if( this.fluid != other.fluid )
|
||||
{
|
||||
return this.fluid.getName().compareTo( other.fluid.getName() );
|
||||
}
|
||||
|
||||
if( Platform.itemComparisons().isNbtTagEqual( this.tagCompound, other.tagCompound ) )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return this.tagCompound.hashCode() - other.tagCompound.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return this.myHash;
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ( ( this.fluid == null ) ? 0 : this.fluid.hashCode() );
|
||||
result = prime * result + ( ( this.tagCompound == null ) ? 0 : this.tagCompound.hashCode() );
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals( final Object ia )
|
||||
public boolean equals( final Object other )
|
||||
{
|
||||
if( ia instanceof AEFluidStack )
|
||||
if( other instanceof AEFluidStack )
|
||||
{
|
||||
final AEFluidStack is = (AEFluidStack) ia;
|
||||
final AEFluidStack is = (AEFluidStack) other;
|
||||
return is.fluid == this.fluid && Platform.itemComparisons().isNbtTagEqual( this.tagCompound, is.tagCompound );
|
||||
}
|
||||
else if( ia instanceof FluidStack )
|
||||
else if( other instanceof FluidStack )
|
||||
{
|
||||
final FluidStack is = (FluidStack) ia;
|
||||
final FluidStack is = (FluidStack) other;
|
||||
return is.getFluid() == this.fluid && Platform.itemComparisons().isNbtTagEqual( this.tagCompound, is.tag );
|
||||
}
|
||||
return false;
|
||||
@@ -286,7 +280,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return this.getFluidStack().toString();
|
||||
return this.getStackSize() + "x" + this.getFluidStack().getFluid().getName() + " " + this.tagCompound;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -298,11 +292,8 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
|
||||
@Override
|
||||
public FluidStack getFluidStack()
|
||||
{
|
||||
final FluidStack is = new FluidStack( this.fluid, (int) Math.min( Integer.MAX_VALUE, this.getStackSize() ) );
|
||||
if( this.tagCompound != null )
|
||||
{
|
||||
is.tag = this.tagCompound.copy();
|
||||
}
|
||||
final int amount = (int) Math.min( Integer.MAX_VALUE, this.getStackSize() );
|
||||
final FluidStack is = new FluidStack( this.fluid, amount, this.tagCompound );
|
||||
|
||||
return is;
|
||||
}
|
||||
@@ -327,24 +318,24 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToPacket( final ByteBuf i ) throws IOException
|
||||
public void writeToPacket( final ByteBuf buffer ) throws IOException
|
||||
{
|
||||
final byte mask = (byte) ( ( this.getType( this.getStackSize() ) << 2 ) | ( this
|
||||
.getType( this.getCountRequestable() ) << 4 ) | ( (byte) ( this.isCraftable() ? 1 : 0 ) << 6 ) | ( this.hasTagCompound() ? 1 : 0 ) << 7 );
|
||||
|
||||
i.writeByte( mask );
|
||||
buffer.writeByte( mask );
|
||||
|
||||
this.writeToStream( i );
|
||||
this.writeToStream( buffer );
|
||||
|
||||
this.putPacketValue( i, this.getStackSize() );
|
||||
this.putPacketValue( i, this.getCountRequestable() );
|
||||
this.putPacketValue( buffer, this.getStackSize() );
|
||||
this.putPacketValue( buffer, this.getCountRequestable() );
|
||||
}
|
||||
|
||||
private void writeToStream( final ByteBuf i ) throws IOException
|
||||
private void writeToStream( final ByteBuf buffer ) throws IOException
|
||||
{
|
||||
final byte[] name = this.fluid.getName().getBytes( "UTF-8" );
|
||||
i.writeByte( (byte) name.length );
|
||||
i.writeBytes( name );
|
||||
buffer.writeByte( (byte) name.length );
|
||||
buffer.writeBytes( name );
|
||||
if( this.hasTagCompound() )
|
||||
{
|
||||
final ByteArrayOutputStream bytes = new ByteArrayOutputStream();
|
||||
@@ -355,8 +346,8 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
|
||||
final byte[] tagBytes = bytes.toByteArray();
|
||||
final int size = tagBytes.length;
|
||||
|
||||
i.writeInt( size );
|
||||
i.writeBytes( tagBytes );
|
||||
buffer.writeInt( size );
|
||||
buffer.writeBytes( tagBytes );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import net.minecraft.item.ItemStack;
|
||||
import mezz.jei.api.IJeiRuntime;
|
||||
import mezz.jei.api.IModPlugin;
|
||||
import mezz.jei.api.IModRegistry;
|
||||
import mezz.jei.api.ISubtypeRegistry;
|
||||
import mezz.jei.api.recipe.IRecipeCategoryRegistration;
|
||||
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
|
||||
|
||||
@@ -54,6 +55,12 @@ import appeng.items.parts.ItemFacade;
|
||||
@mezz.jei.api.JEIPlugin
|
||||
public class JEIPlugin implements IModPlugin
|
||||
{
|
||||
@Override
|
||||
public void registerItemSubtypes( ISubtypeRegistry subtypeRegistry )
|
||||
{
|
||||
final Optional<Item> maybeFacade = AEApi.instance().definitions().items().facade().maybeItem();
|
||||
maybeFacade.ifPresent( subtypeRegistry::useNbtForSubtypes );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerCategories( IRecipeCategoryRegistration registry )
|
||||
|
||||
@@ -25,6 +25,7 @@ import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
@@ -174,6 +175,9 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
||||
case SETTINGS_SAVED:
|
||||
player.sendMessage( PlayerMessages.SavedSettings.get() );
|
||||
break;
|
||||
case SETTINGS_RESET:
|
||||
player.sendMessage( PlayerMessages.ResetSettings.get() );
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
@@ -185,9 +189,7 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
||||
{
|
||||
if( !w.isRemote )
|
||||
{
|
||||
final IMemoryCard mem = (IMemoryCard) player.getHeldItem( hand ).getItem();
|
||||
mem.notifyUser( player, MemoryCardMessages.SETTINGS_CLEARED );
|
||||
player.getHeldItem( hand ).setTagCompound( null );
|
||||
this.clearCard( player, w, hand );
|
||||
}
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
@@ -197,9 +199,31 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick( World w, EntityPlayer player, EnumHand hand )
|
||||
{
|
||||
if( player.isSneaking() )
|
||||
{
|
||||
if( !w.isRemote )
|
||||
{
|
||||
this.clearCard( player, w, hand );
|
||||
}
|
||||
}
|
||||
|
||||
return super.onItemRightClick( w, player, hand );
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesSneakBypassUse( final ItemStack itemstack, final IBlockAccess world, final BlockPos pos, final EntityPlayer player )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
private void clearCard( final EntityPlayer player, final World w, final EnumHand hand )
|
||||
{
|
||||
final IMemoryCard mem = (IMemoryCard) player.getHeldItem( hand ).getItem();
|
||||
mem.notifyUser( player, MemoryCardMessages.SETTINGS_CLEARED );
|
||||
player.getHeldItem( hand ).setTagCompound( null );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,15 +336,18 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
}
|
||||
|
||||
final IMemoryCard mc = (IMemoryCard) is.getItem();
|
||||
final NBTTagCompound data = new NBTTagCompound();
|
||||
final NBTTagCompound data = mc.getData( is );
|
||||
final short storedFrequency = data.getShort( "freq" );
|
||||
|
||||
short newFreq = this.getFrequency();
|
||||
final boolean wasOutput = this.isOutput();
|
||||
this.setOutput( false );
|
||||
|
||||
final boolean needsNewFrequency = wasOutput || this.getFrequency() == 0 || storedFrequency == newFreq;
|
||||
|
||||
try
|
||||
{
|
||||
if( wasOutput || this.getFrequency() == 0 )
|
||||
if( needsNewFrequency )
|
||||
{
|
||||
newFreq = this.getProxy().getP2P().newFrequency();
|
||||
}
|
||||
@@ -373,7 +376,14 @@ public abstract class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicSt
|
||||
data.setIntArray( "colorCode", colorCode );
|
||||
|
||||
mc.setMemoryCardContents( is, type + ".name", data );
|
||||
mc.notifyUser( player, MemoryCardMessages.SETTINGS_SAVED );
|
||||
if( needsNewFrequency )
|
||||
{
|
||||
mc.notifyUser( player, MemoryCardMessages.SETTINGS_RESET );
|
||||
}
|
||||
else
|
||||
{
|
||||
mc.notifyUser( player, MemoryCardMessages.SETTINGS_SAVED );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -20,15 +20,18 @@ package appeng.tile.crafting;
|
||||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Optional;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.implementations.tiles.IColorableTile;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.AEColor;
|
||||
@@ -183,4 +186,12 @@ public class TileCraftingMonitorTile extends TileCraftingTile implements IColora
|
||||
{
|
||||
this.updateList = updateList;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack getItemFromTile( final Object obj )
|
||||
{
|
||||
final Optional<ItemStack> is = AEApi.instance().definitions().blocks().craftingMonitor().maybeStack( 1 );
|
||||
|
||||
return is.orElseGet( () -> super.getItemFromTile( obj ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,9 @@ public class TileCraftingStorageTile extends TileCraftingTile
|
||||
|
||||
switch( storage )
|
||||
{
|
||||
case 1:
|
||||
is = blocks.craftingStorage1k().maybeStack( 1 );
|
||||
break;
|
||||
case 4:
|
||||
is = blocks.craftingStorage4k().maybeStack( 1 );
|
||||
break;
|
||||
|
||||
@@ -85,6 +85,10 @@ public class TileCraftingTile extends AENetworkTile implements IAEMultiBlock, IP
|
||||
{
|
||||
is = AEApi.instance().definitions().blocks().craftingAccelerator().maybeStack( 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
is = AEApi.instance().definitions().blocks().craftingUnit().maybeStack( 1 );
|
||||
}
|
||||
|
||||
return is.orElseGet( () -> super.getItemFromTile( obj ) );
|
||||
}
|
||||
|
||||
@@ -3,15 +3,15 @@ package appeng.tile.inventory;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
|
||||
import appeng.api.storage.ICellInventory;
|
||||
import appeng.api.storage.ICellInventoryHandler;
|
||||
import appeng.util.inv.IAEAppEngInventory;
|
||||
import appeng.util.inv.IInternalItemHandler;
|
||||
import appeng.util.inv.filter.IAEItemFilter;
|
||||
|
||||
|
||||
public class AppEngCellInventory implements IInternalItemHandler
|
||||
public class AppEngCellInventory implements IItemHandlerModifiable
|
||||
{
|
||||
private final AppEngInternalInventory inv;
|
||||
private final ICellInventoryHandler handlerForSlot[];
|
||||
@@ -78,17 +78,9 @@ public class AppEngCellInventory implements IInternalItemHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot( int slot, ItemStack stack )
|
||||
public boolean isItemValid( int slot, ItemStack stack )
|
||||
{
|
||||
return this.inv.isItemValidForSlot( slot, stack );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty( int slot )
|
||||
{
|
||||
this.persist( slot );
|
||||
this.inv.markDirty( slot );
|
||||
this.cleanup( slot );
|
||||
return this.inv.isItemValid( slot, stack );
|
||||
}
|
||||
|
||||
public void persist()
|
||||
|
||||
@@ -25,6 +25,7 @@ import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
@@ -33,14 +34,13 @@ import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.core.AELog;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.inv.IAEAppEngInventory;
|
||||
import appeng.util.inv.IInternalItemHandler;
|
||||
import appeng.util.inv.InvOperation;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import appeng.util.iterators.AEInvIterator;
|
||||
import appeng.util.iterators.InvIterator;
|
||||
|
||||
|
||||
public class AppEngInternalAEInventory implements IInternalItemHandler, Iterable<ItemStack>
|
||||
public class AppEngInternalAEInventory implements IItemHandlerModifiable, Iterable<ItemStack>
|
||||
{
|
||||
private final IAEAppEngInventory te;
|
||||
private final IAEItemStack[] inv;
|
||||
@@ -254,7 +254,7 @@ public class AppEngInternalAEInventory implements IInternalItemHandler, Iterable
|
||||
|
||||
private void fireOnChangeInventory( int slot, InvOperation op, ItemStack removed, ItemStack inserted )
|
||||
{
|
||||
if( this.te != null && Platform.isServer() )
|
||||
if( this.te != null && Platform.isServer() && !this.dirtyFlag )
|
||||
{
|
||||
this.dirtyFlag = true;
|
||||
this.te.onChangeInventory( this, slot, op, removed, inserted );
|
||||
@@ -281,17 +281,8 @@ public class AppEngInternalAEInventory implements IInternalItemHandler, Iterable
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot( int slot, ItemStack stack )
|
||||
public boolean isItemValid( int slot, ItemStack stack )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty( int slot )
|
||||
{
|
||||
if( !this.dirtyFlag )
|
||||
{
|
||||
this.fireOnChangeInventory( slot, InvOperation.DIRTY, ItemStack.EMPTY, ItemStack.EMPTY );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,12 +31,11 @@ import net.minecraftforge.items.ItemStackHandler;
|
||||
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.inv.IAEAppEngInventory;
|
||||
import appeng.util.inv.IInternalItemHandler;
|
||||
import appeng.util.inv.InvOperation;
|
||||
import appeng.util.inv.filter.IAEItemFilter;
|
||||
|
||||
|
||||
public class AppEngInternalInventory extends ItemStackHandler implements IInternalItemHandler, Iterable<ItemStack>
|
||||
public class AppEngInternalInventory extends ItemStackHandler implements Iterable<ItemStack>
|
||||
{
|
||||
private boolean enableClientEvents = false;
|
||||
private IAEAppEngInventory te;
|
||||
@@ -117,7 +116,7 @@ public class AppEngInternalInventory extends ItemStackHandler implements IIntern
|
||||
@Override
|
||||
protected void onContentsChanged( int slot )
|
||||
{
|
||||
if( this.getTileEntity() != null && this.eventsEnabled() )
|
||||
if( this.getTileEntity() != null && this.eventsEnabled() && !this.dirtyFlag )
|
||||
{
|
||||
this.dirtyFlag = true;
|
||||
ItemStack newStack = this.getStackInSlot( slot ).copy();
|
||||
@@ -159,19 +158,7 @@ public class AppEngInternalInventory extends ItemStackHandler implements IIntern
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty( final int slot )
|
||||
{
|
||||
if( this.getTileEntity() != null && this.eventsEnabled() && !this.dirtyFlag )
|
||||
{
|
||||
this.dirtyFlag = true;
|
||||
this.getTileEntity().onChangeInventory( this, slot, InvOperation.DIRTY, ItemStack.EMPTY, ItemStack.EMPTY );
|
||||
this.getTileEntity().saveChanges();
|
||||
this.dirtyFlag = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot( int slot, ItemStack stack )
|
||||
public boolean isItemValid( int slot, ItemStack stack )
|
||||
{
|
||||
if( this.maxStack[slot] == 0 )
|
||||
{
|
||||
|
||||
@@ -266,7 +266,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
|
||||
@Override
|
||||
public TickingRequest getTickingRequest( final IGridNode node )
|
||||
{
|
||||
return new TickingRequest( TickRates.IOPort.getMin(), TickRates.IOPort.getMax(), this.hasWork(), false );
|
||||
return new TickingRequest( TickRates.IOPort.getMin(), TickRates.IOPort.getMax(), !this.hasWork(), false );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,8 +24,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
|
||||
import appeng.util.inv.IInternalItemHandler;
|
||||
|
||||
|
||||
public class ItemHandlerUtil
|
||||
{
|
||||
@@ -66,37 +64,6 @@ public class ItemHandlerUtil
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void markDirty( final IItemHandler inv, final int slot )
|
||||
{
|
||||
if( inv instanceof IInternalItemHandler )
|
||||
{
|
||||
( (IInternalItemHandler) inv ).markDirty( slot );
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isItemValidForSlot( final IItemHandler inv, int slot, ItemStack stack )
|
||||
{
|
||||
if( stack.isEmpty() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if( inv instanceof IInternalItemHandler )
|
||||
{
|
||||
return ( (IInternalItemHandler) inv ).isItemValidForSlot( slot, stack );
|
||||
}
|
||||
|
||||
// empty slot
|
||||
ItemStack currentStack = inv.getStackInSlot( slot );
|
||||
setStackInSlot( inv, slot, ItemStack.EMPTY );
|
||||
// test insert
|
||||
ItemStack remainder = inv.insertItem( slot, stack, true );
|
||||
// restore slot
|
||||
setStackInSlot( inv, slot, currentStack );
|
||||
|
||||
return remainder.isEmpty() || remainder.getCount() < stack.getCount();
|
||||
}
|
||||
|
||||
public static void copy( final IItemHandler from, final IItemHandler to, boolean deepCopy )
|
||||
{
|
||||
for( int i = 0; i < Math.min( from.getSlots(), to.getSlots() ); ++i )
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2017, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.util.inv;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
|
||||
|
||||
public interface IInternalItemHandler extends IItemHandlerModifiable
|
||||
{
|
||||
boolean isItemValidForSlot( int slot, ItemStack stack );
|
||||
|
||||
void markDirty( int slot );
|
||||
}
|
||||
@@ -21,5 +21,5 @@ package appeng.util.inv;
|
||||
|
||||
public enum InvOperation
|
||||
{
|
||||
EXTRACT, INSERT, SET, DIRTY
|
||||
EXTRACT, INSERT, SET
|
||||
}
|
||||
|
||||
@@ -25,12 +25,13 @@ import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
import net.minecraftforge.items.wrapper.EmptyHandler;
|
||||
|
||||
import appeng.util.helpers.ItemHandlerUtil;
|
||||
|
||||
|
||||
public class WrapperChainedItemHandler implements IInternalItemHandler
|
||||
public class WrapperChainedItemHandler implements IItemHandlerModifiable
|
||||
{
|
||||
private IItemHandler[] itemHandler; // the handlers
|
||||
private int[] baseIndex; // index-offsets of the different handlers
|
||||
@@ -159,20 +160,11 @@ public class WrapperChainedItemHandler implements IInternalItemHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot( int slot, ItemStack stack )
|
||||
public boolean isItemValid( int slot, ItemStack stack )
|
||||
{
|
||||
int index = this.getIndexForSlot( slot );
|
||||
IItemHandler handler = this.getHandlerFromIndex( index );
|
||||
int targetSlot = this.getSlotFromIndex( slot, index );
|
||||
return ItemHandlerUtil.isItemValidForSlot( handler, targetSlot, stack );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty( int slot )
|
||||
{
|
||||
int index = this.getIndexForSlot( slot );
|
||||
IItemHandler handler = this.getHandlerFromIndex( index );
|
||||
int targetSlot = this.getSlotFromIndex( slot, index );
|
||||
ItemHandlerUtil.markDirty( handler, targetSlot );
|
||||
return handler.isItemValid( targetSlot, stack );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,12 +23,13 @@ import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
|
||||
import appeng.util.helpers.ItemHandlerUtil;
|
||||
import appeng.util.inv.filter.IAEItemFilter;
|
||||
|
||||
|
||||
public class WrapperFilteredItemHandler implements IInternalItemHandler
|
||||
public class WrapperFilteredItemHandler implements IItemHandlerModifiable
|
||||
{
|
||||
private final IItemHandler handler;
|
||||
private final IAEItemFilter filter;
|
||||
@@ -86,18 +87,12 @@ public class WrapperFilteredItemHandler implements IInternalItemHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot( int slot, ItemStack stack )
|
||||
public boolean isItemValid( int slot, ItemStack stack )
|
||||
{
|
||||
if( !this.filter.allowInsert( this.handler, slot, stack ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return ItemHandlerUtil.isItemValidForSlot( this.handler, slot, stack );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty( int slot )
|
||||
{
|
||||
ItemHandlerUtil.markDirty( this.handler, slot );
|
||||
return this.handler.isItemValid( slot, stack );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ public class WrapperInvItemHandler implements IInventory
|
||||
@Override
|
||||
public void markDirty()
|
||||
{
|
||||
ItemHandlerUtil.markDirty( this.inv, -1 );
|
||||
// NOP
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -129,7 +129,7 @@ public class WrapperInvItemHandler implements IInventory
|
||||
@Override
|
||||
public boolean isItemValidForSlot( int index, ItemStack stack )
|
||||
{
|
||||
return ItemHandlerUtil.isItemValidForSlot( this.inv, index, stack );
|
||||
return this.inv.isItemValid( index, stack );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,12 +23,13 @@ import java.util.function.Supplier;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
|
||||
import appeng.util.Lazy;
|
||||
import appeng.util.helpers.ItemHandlerUtil;
|
||||
|
||||
|
||||
public class WrapperLazyItemHandler implements IInternalItemHandler
|
||||
public class WrapperLazyItemHandler implements IItemHandlerModifiable
|
||||
{
|
||||
private final Lazy<IItemHandler> sourceHandler;
|
||||
|
||||
@@ -74,14 +75,8 @@ public class WrapperLazyItemHandler implements IInternalItemHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot( int slot, ItemStack stack )
|
||||
public boolean isItemValid( int slot, ItemStack stack )
|
||||
{
|
||||
return ItemHandlerUtil.isItemValidForSlot( this.sourceHandler.get(), slot, stack );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty( int slot )
|
||||
{
|
||||
ItemHandlerUtil.markDirty( this.sourceHandler.get(), slot );
|
||||
return this.sourceHandler.get().isItemValid( slot, stack );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,11 +23,12 @@ import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.IItemHandlerModifiable;
|
||||
|
||||
import appeng.util.helpers.ItemHandlerUtil;
|
||||
|
||||
|
||||
public class WrapperRangeItemHandler implements IInternalItemHandler
|
||||
public class WrapperRangeItemHandler implements IItemHandlerModifiable
|
||||
{
|
||||
private final IItemHandler compose;
|
||||
private final int minSlot;
|
||||
@@ -108,22 +109,12 @@ public class WrapperRangeItemHandler implements IInternalItemHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot( int slot, ItemStack stack )
|
||||
public boolean isItemValid( int slot, ItemStack stack )
|
||||
{
|
||||
if( this.checkSlot( slot ) )
|
||||
{
|
||||
return ItemHandlerUtil.isItemValidForSlot( this.compose, slot + this.minSlot, stack );
|
||||
return this.compose.isItemValid( slot + this.minSlot, stack );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty( int slot )
|
||||
{
|
||||
if( this.checkSlot( slot ) )
|
||||
{
|
||||
ItemHandlerUtil.markDirty( this.compose, slot + this.minSlot );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -84,7 +84,8 @@ chat.appliedenergistics2.DeviceNotLinked=Device is not linked.
|
||||
chat.appliedenergistics2.StationCanNotBeLocated=Station can not be located.
|
||||
chat.appliedenergistics2.MachineNotPowered=Machine is not powered.
|
||||
chat.appliedenergistics2.CommunicationError=Error Communicating with Network.
|
||||
chat.appliedenergistics2.SavedSettings=Copied device configuration to memory card.
|
||||
chat.appliedenergistics2.SavedSettings=Copied current device configuration to memory card.
|
||||
chat.appliedenergistics2.ResetSettings=New device configuration created and copied to memory card.
|
||||
chat.appliedenergistics2.AmmoDepleted=Ammo Depleted.
|
||||
chat.appliedenergistics2.isNowLocked=Monitor is now Locked.
|
||||
chat.appliedenergistics2.isNowUnlocked=Monitor is now Unlocked.
|
||||
|
||||
@@ -39,6 +39,25 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "appliedenergistics2:knife",
|
||||
"conditions": [
|
||||
{
|
||||
"type": "appliedenergistics2:features",
|
||||
"features": "quartz_knife"
|
||||
}
|
||||
],
|
||||
"ingredient": [
|
||||
{
|
||||
"item": "appliedenergistics2:certus_quartz_cutting_knife",
|
||||
"data": 32767
|
||||
},
|
||||
{
|
||||
"item": "appliedenergistics2:nether_quartz_cutting_knife",
|
||||
"data": 32767
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "appliedenergistics2:cable",
|
||||
"ingredient": [
|
||||
|
||||
+1
-2
@@ -9,8 +9,7 @@
|
||||
"item": "#appliedenergistics2:metalIngots"
|
||||
},
|
||||
{
|
||||
"type": "forge:ore_dict",
|
||||
"ore": "itemQuartzKnife"
|
||||
"item": "#appliedenergistics2:knife"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user