Compare commits

...

16 Commits

Author SHA1 Message Date
yueh ab89278274 Replaces old fluid handlers with the new capability based ones. (#2727)
* Changed ME Chest and P2P tunnels to use fluid capabilities.
* Renamed all occurrences of liquid to fluids.
2016-12-31 16:01:29 +01:00
yueh 7c5f777e41 Fixes #2713: Call super#onBlockActivated() for wrench interaction. (#2728) 2016-12-31 16:00:45 +01:00
yueh 8b0637d05d Fixes IDE not correctly cleaning up the list of staged files. 2016-12-31 15:21:25 +01:00
yueh 497f1c9ace Fixes #2714: Use a concurrent list to back NetworkList (#2715) 2016-12-29 15:51:17 +01:00
yueh 2ab0528015 Fixes #2724: Use capitalized oredict name for dyes, not uppercase. 2016-12-29 15:50:02 +01:00
yueh 589730bfad Fixes #2707: Calculuate the correct AABB for a rotated skychest. 2016-12-17 23:47:42 +01:00
yueh 8700a79ca6 Fixes #2684: Avoid transforming charged quartz when dead. 2016-12-17 23:04:35 +01:00
yueh a14cf2204d Fixes anchor rendering (#2698)
* Fixes #2680: Use a shorter cable anchor model when blocked by a facade.
* Fixes #2664: Prevent anchors from creating intersection.

Replaced the simple List<ResourceLocation> for the static models with a
new container also indicating a solid part, which can be used to prevent
the creation of an intersection.
2016-12-14 22:37:10 +01:00
yueh 8bed7f223e TheOneProbe integration (#2696)
Displayed information is equal to current the WAILA integration.

Added a preInit stage to IIntegrationModule.
Added a factory method to IntegrationType to avoid touching
IntegrationNode for every new integration.

Fixes #2650
2016-12-14 22:36:40 +01:00
yueh db85419702 Restructured registry packages (#2703)
Moved larger registries together with their related classes instead of putting unrelated classes into the same package.
2016-12-14 22:35:52 +01:00
yueh fb79fd284d Replaced Watcher using Collection with a more fitting interface (#2693)
Replaced the watchers for energy, storage and crafting with a more fitting interface compared to a common collection.

Fixes #229
2016-12-14 18:30:49 +01:00
yueh e3305c1963 Update Forge to latest RB
Updated JEI
2016-12-14 17:46:16 +01:00
yueh a3c85b4a59 Fixes #2699: Do not trust the stackSize in case of internal changes.
An external inventory might change the stacksize of the slot we currently
are extracting from. Thus we have to cache the initial stackSize for a later
calculation of the extracted amount per slot.
As other inventories might NOT change the stacksize after a modification,
we can not use the stack reaching 0 as conditions to break.
2016-12-14 11:25:49 +01:00
yueh a2b20f1d67 Fixes #2689: Do not pass our own blockstate to the adjacent block. 2016-12-08 21:29:46 +01:00
yueh 86908b1ae6 Fixes #2647: Prevent crafting status from crashing due to missing network. 2016-12-08 13:07:25 +01:00
dshadowwolf 6bf52b0b0f Fixes constant reequip animation on portable cells/terminals (#2690)
Fix for portable cell and wireless terminal going into re-equip animations when GUI is open.
2016-12-08 12:34:41 +01:00
137 changed files with 2254 additions and 1074 deletions
+3 -2
View File
@@ -9,7 +9,7 @@ aebasename=appliedenergistics2
#########################################################
minecraft_version=1.10.2
mcp_mappings=snapshot_20161111
forge_version=12.18.2.2139
forge_version=12.18.3.2185
#########################################################
# Installable #
@@ -19,6 +19,7 @@ waila_version=1.7.0-B3_1.9.4
#########################################################
# Provided APIs #
#########################################################
jei_version=3.13.3.373
jei_version=3.13.6.391
tesla_version=1.10.2-1.2.1.50
ic2_version=2.6.99-ex110
top_version=1.10-1.3.3-41
+7
View File
@@ -38,6 +38,11 @@ repositories {
name = "IC2 repo"
url = "http://maven.ic2.player.to"
}
maven { // TheOneProbe
name 'tterrag maven'
url "http://maven.tterrag.com/"
}
}
configurations {
@@ -48,12 +53,14 @@ dependencies {
// installable runtime dependencies
mods "mcp.mobius.waila:Waila:${waila_version}"
mods "net.industrial-craft:industrialcraft-2:${ic2_version}:dev"
mods "mcjty.theoneprobe:TheOneProbe:${top_version}"
// compile against provided APIs
compileOnly "mezz.jei:jei_${minecraft_version}:${jei_version}:api"
compileOnly "mcp.mobius.waila:Waila:${waila_version}"
compileOnly "net.darkhax.tesla:Tesla:${tesla_version}"
compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
compileOnly "mcjty.theoneprobe:TheOneProbe:${top_version}:api"
// at runtime, use the full JEI jar
runtime "mezz.jei:jei_${minecraft_version}:${jei_version}"
+13 -1
View File
@@ -31,7 +31,7 @@ task deinstallWaila(type: Delete) {
delete fileTree(dir: minecraft.runDir + "/mods", include: "*Waila*.jar")
}
// IC²
// IC2
task installIC2(type: Copy, dependsOn: "deinstallIC2") {
from { configurations.mods }
include "**/*industrialcraft-2*.jar"
@@ -41,3 +41,15 @@ task installIC2(type: Copy, dependsOn: "deinstallIC2") {
task deinstallIC2(type: Delete) {
delete fileTree(dir: minecraft.runDir + "/mods", include: "*industrialcraft-2*.jar")
}
// TOP
task installTop(type: Copy, dependsOn: "deinstallTop") {
from { configurations.mods }
include "**/*TheOneProbe*.jar"
into file(minecraft.runDir + "/mods")
}
task deinstallTop(type: Delete) {
delete fileTree(dir: minecraft.runDir + "/mods", include: "*TheOneProbe*.jar")
}
@@ -76,7 +76,7 @@ public interface IParts
IItemDefinition p2PTunnelItems();
IItemDefinition p2PTunnelLiquids();
IItemDefinition p2PTunnelFluids();
IItemDefinition p2PTunnelEU();
@@ -24,12 +24,36 @@
package appeng.api.networking.crafting;
import java.util.Collection;
import appeng.api.storage.data.IAEStack;
public interface ICraftingWatcher extends Collection<IAEStack>
/**
* DO NOT IMPLEMENT.
*
* Will be injected when adding an {@link ICraftingWatcherHost} to a grid.
*/
public interface ICraftingWatcher
{
/**
* Add a specific {@link IAEStack} to watch.
*
* Supports multiple values, duplicate ones will not be added.
*
* @param stack
* @return true, if successfully added.
*/
boolean add( IAEStack<?> stack );
/**
* Remove a specific {@link IAEStack} from the watcher.
*
* @param stack
* @return true, if successfully removed.
*/
boolean remove( IAEStack<?> stack );
/**
* Removes all watched stacks and resets the watcher to a clean state.
*/
void reset();
}
@@ -24,10 +24,34 @@
package appeng.api.networking.energy;
import java.util.Collection;
public interface IEnergyWatcher extends Collection<Double>
/**
* DO NOT IMPLEMENT.
*
* Will be injected when adding an {@link IEnergyWatcherHost} to a grid.
*/
public interface IEnergyWatcher
{
/**
* Add a specific threshold to watch.
*
* Supports multiple values, duplicate ones will not be added.
*
* @param amount
* @return true, if successfully added.
*/
boolean add( double amount );
/**
* Remove a specific threshold from the watcher.
*
* @param amount
* @return true, if successfully removed.
*/
boolean remove( double amount );
/**
* Removes all thresholds and resets the watcher to a clean state.
*/
void reset();
}
@@ -24,12 +24,36 @@
package appeng.api.networking.storage;
import java.util.Collection;
import appeng.api.storage.data.IAEStack;
public interface IStackWatcher extends Collection<IAEStack>
/**
* DO NOT IMPLEMENT.
*
* Will be injected when adding an {@link IStackWatcherHost} to a grid.
*/
public interface IStackWatcher
{
/**
* Add a specific {@link IAEStack} to watch.
*
* Supports multiple values, duplicate ones will not be added.
*
* @param stack
* @return true, if successfully added.
*/
boolean add( IAEStack<?> stack );
/**
* Remove a specific {@link IAEStack} from the watcher.
*
* @param stack
* @return true, if successfully removed.
*/
boolean remove( IAEStack<?> stack );
/**
* Removes all watched stacks and resets the watcher to a clean state.
*/
void reset();
}
+19 -10
View File
@@ -25,10 +25,11 @@ package appeng.api.parts;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import javax.annotation.Nonnull;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.Entity;
@@ -39,7 +40,6 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
@@ -71,7 +71,8 @@ public interface IPart extends IBoxProvider, ICustomCableConnection
ItemStack getItemStack( PartItemStack type );
/**
* Render dynamic portions of this part, as part of the cable bus TESR. This part has to return true for {@link #requireDynamicRender()} in order for
* Render dynamic portions of this part, as part of the cable bus TESR. This part has to return true for
* {@link #requireDynamicRender()} in order for
* this method to be called.
*/
@SideOnly( Side.CLIENT )
@@ -267,8 +268,10 @@ public interface IPart extends IBoxProvider, ICustomCableConnection
boolean canBePlacedOn( BusSupport what );
/**
* This method is used when a chunk is rebuilt to determine how this part should be rendered. The returned models should represent the
* part oriented north. They will be automatically rotated to match the part's actual orientation. Tint indices 1-4 can be used in the
* This method is used when a chunk is rebuilt to determine how this part should be rendered. The returned models
* should represent the
* part oriented north. They will be automatically rotated to match the part's actual orientation. Tint indices 1-4
* can be used in the
* models to access the parts color.
*
* <dl>
@@ -279,18 +282,23 @@ public interface IPart extends IBoxProvider, ICustomCableConnection
* <dt>Tint Index 3</dt>
* <dd>The {@link AEColor#whiteVariant bright variant color} of the cable that this part is attached to.</dd>
* <dt>Tint Index 4</dt>
* <dd>A color variant that is between the cable's {@link AEColor#mediumVariant color} and its {@link AEColor#whiteVariant bright variant}.</dd>
* <dd>A color variant that is between the cable's {@link AEColor#mediumVariant color} and its
* {@link AEColor#whiteVariant bright variant}.</dd>
* </dl>
*
* <b>Important:</b> All models must have been registered via the {@link IPartModels} API before use.
*/
default List<ResourceLocation> getStaticModels()
@Nonnull
default IPartModel getStaticModels()
{
return Collections.emptyList();
return new IPartModel()
{
};
}
/**
* Implement this method if your part exposes capabilitys. Any requests for capabilities on the cable bus will be forwarded to parts on the appropriate
* Implement this method if your part exposes capabilitys. Any requests for capabilities on the cable bus will be
* forwarded to parts on the appropriate
* side.
*
* @see TileEntity#hasCapability(Capability, EnumFacing)
@@ -303,7 +311,8 @@ public interface IPart extends IBoxProvider, ICustomCableConnection
}
/**
* Implement this method if your part exposes capabilitys. Any requests for capabilities on the cable bus will be forwarded to parts on the appropriate
* Implement this method if your part exposes capabilitys. Any requests for capabilities on the cable bus will be
* forwarded to parts on the appropriate
* side.
*
* @see TileEntity#getCapability(Capability, EnumFacing)
@@ -0,0 +1,65 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2013 - 2015 AlgorithmX2
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package appeng.api.parts;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nonnull;
import net.minecraft.util.ResourceLocation;
/**
* A container to store a collection of {@link ResourceLocation} as models for a part as well as other properties.
*/
public interface IPartModel
{
/**
* A solid {@link IPartModel} indicates that the rendering requires a cable connection, which will also result in
* creating an intersection for the cable.
*
* This should be true for pretty much all parts.
*
* @return true for a solid part.
*/
default boolean requireCableConnection()
{
return true;
}
/**
* A collection of {@link ResourceLocation} used as models for a part.
*
* @return a collection of models, never null.
*/
@Nonnull
default List<ResourceLocation> getModels()
{
return Collections.emptyList();
}
}
@@ -31,10 +31,8 @@ import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
@@ -149,6 +149,7 @@ public class BlockCraftingUnit extends AEBaseTileBlock
public boolean onBlockActivated( final World w, final BlockPos pos, final IBlockState state, final EntityPlayer p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
{
final TileCraftingTile tg = this.getTileEntity( w, pos );
if( tg != null && !p.isSneaking() && tg.isFormed() && tg.isActive() )
{
if( Platform.isClient() )
@@ -160,7 +161,7 @@ public class BlockCraftingUnit extends AEBaseTileBlock
return true;
}
return false;
return super.onBlockActivated( w, pos, state, p, hand, heldItem, side, hitX, hitY, hitZ );
}
public enum CraftingUnitType
@@ -107,6 +107,7 @@ public class BlockMolecularAssembler extends AEBaseTileBlock
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_MAC );
return true;
}
return false;
return super.onBlockActivated( w, pos, state, p, hand, heldItem, side, hitX, hitY, hitZ );
}
}
@@ -22,6 +22,7 @@ package appeng.block.misc;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import javax.annotation.Nullable;
import org.apache.commons.lang3.tuple.ImmutablePair;
@@ -22,6 +22,7 @@ package appeng.block.networking;
import java.util.EnumSet;
import java.util.List;
import java.util.Random;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
@@ -21,6 +21,7 @@ package appeng.block.networking;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nullable;
import net.minecraft.block.properties.IProperty;
@@ -46,6 +47,7 @@ import appeng.helpers.ICustomCollision;
import appeng.tile.networking.TileWireless;
import appeng.util.Platform;
public class BlockWireless extends AEBaseTileBlock implements ICustomCollision
{
@@ -62,7 +64,6 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision
}
}
public static final PropertyEnum<State> STATE = PropertyEnum.create( "state", State.class );
public BlockWireless()
@@ -112,13 +113,9 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision
@Override
public boolean onBlockActivated( final World w, final BlockPos pos, final IBlockState state, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
{
if( player.isSneaking() )
{
return false;
}
final TileWireless tg = this.getTileEntity( w, pos );
if( tg != null )
if( tg != null && !player.isSneaking() )
{
if( Platform.isServer() )
{
@@ -126,7 +123,8 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision
}
return true;
}
return false;
return super.onBlockActivated( w, pos, state, player, hand, heldItem, side, hitX, hitY, hitZ );
}
@Override
@@ -4,6 +4,7 @@ package appeng.block.paint;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nullable;
import com.google.common.base.Function;
@@ -4,6 +4,7 @@ package appeng.block.qnb;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
import javax.annotation.Nullable;
import com.google.common.base.Function;
@@ -47,6 +47,10 @@ import appeng.util.Platform;
public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision
{
private static final double AABB_OFFSET_BOTTOM = .0625d;
private static final double AABB_OFFSET_SIDES = 0;
private static final double AABB_OFFSET_TOP = .125d;
public enum SkyChestType
{
STONE, BLOCK
@@ -71,7 +75,6 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision
return EnumBlockRenderType.ENTITYBLOCK_ANIMATED;
}
@Override
public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
{
@@ -85,6 +88,21 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision
@Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( final World w, final BlockPos pos, final Entity thePlayer, final boolean b )
{
final AxisAlignedBB aabb = computeAABB( w, pos );
return Collections.singletonList( aabb );
}
@Override
public void addCollidingBlockToList( final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e )
{
final AxisAlignedBB aabb = computeAABB( w, pos );
out.add( aabb );
}
private AxisAlignedBB computeAABB( final World w, final BlockPos pos )
{
final TileSkyChest sk = this.getTileEntity( w, pos );
EnumFacing o = EnumFacing.UP;
@@ -94,17 +112,19 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision
o = sk.getUp();
}
final double offsetX = o.getFrontOffsetX() == 0 ? 0.06 : 0.0;
final double offsetY = o.getFrontOffsetY() == 0 ? 0.06 : 0.0;
final double offsetZ = o.getFrontOffsetZ() == 0 ? 0.06 : 0.0;
final double offsetX = o.getFrontOffsetX() == 0 ? AABB_OFFSET_BOTTOM : AABB_OFFSET_SIDES;
final double offsetY = o.getFrontOffsetY() == 0 ? AABB_OFFSET_BOTTOM : AABB_OFFSET_SIDES;
final double offsetZ = o.getFrontOffsetZ() == 0 ? AABB_OFFSET_BOTTOM : AABB_OFFSET_SIDES;
final double sc = 0.06;
return Collections.singletonList( new AxisAlignedBB( Math.max( 0.0, offsetX - o.getFrontOffsetX() * sc ), Math.max( 0.0, offsetY - o.getFrontOffsetY() * sc ), Math.max( 0.0, offsetZ - o.getFrontOffsetZ() * sc ), Math.min( 1.0, ( 1.0 - offsetX ) - o.getFrontOffsetX() * sc ), Math.min( 1.0, ( 1.0 - offsetY ) - o.getFrontOffsetY() * sc ), Math.min( 1.0, ( 1.0 - offsetZ ) - o.getFrontOffsetZ() * sc ) ) );
}
// x/z needs to be multiplied by -1, thus we simply add not substract.
final double minX = Math.max( 0.0, offsetX + o.getFrontOffsetX() * AABB_OFFSET_TOP );
final double minY = Math.max( 0.0, offsetY - o.getFrontOffsetY() * AABB_OFFSET_TOP );
final double minZ = Math.max( 0.0, offsetZ + o.getFrontOffsetZ() * AABB_OFFSET_TOP );
@Override
public void addCollidingBlockToList( final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e )
{
out.add( new AxisAlignedBB( 0.05, 0.05, 0.05, 0.95, 0.95, 0.95 ) );
final double maxX = Math.min( 1.0, ( 1.0 - offsetX ) + o.getFrontOffsetX() * AABB_OFFSET_TOP );
final double maxY = Math.min( 1.0, ( 1.0 - offsetY ) - o.getFrontOffsetY() * AABB_OFFSET_TOP );
final double maxZ = Math.min( 1.0, ( 1.0 - offsetZ ) + o.getFrontOffsetZ() * AABB_OFFSET_TOP );
return new AxisAlignedBB( minX, minY, minZ, maxX, maxY, maxZ );
}
}
@@ -26,6 +26,7 @@ import java.util.List;
import java.util.function.BiConsumer;
import java.util.function.Function;
import java.util.function.Supplier;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
@@ -54,7 +54,6 @@ import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.widgets.GuiScrollbar;
@@ -22,6 +22,7 @@ package appeng.client.me;
import java.util.ArrayList;
import java.util.Collections;
import java.util.regex.Pattern;
import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;
@@ -21,6 +21,7 @@ package appeng.client.render;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nullable;
import net.minecraft.block.state.IBlockState;
@@ -22,6 +22,7 @@ package appeng.client.render;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import javax.annotation.Nullable;
import net.minecraft.block.state.IBlockState;
@@ -25,6 +25,8 @@ import java.util.EnumMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import javax.annotation.Nullable;
import net.minecraft.block.state.IBlockState;
@@ -41,6 +43,7 @@ import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.property.IExtendedBlockState;
import appeng.api.parts.IPartModel;
import appeng.api.util.AECableType;
import appeng.api.util.AEColor;
import appeng.block.networking.BlockCableBus;
@@ -81,8 +84,9 @@ public class CableBusBakedModel implements IBakedModel
List<BakedQuad> quads = new ArrayList<>();
// The core parts of the cable will only be rendered in the CUTOUT layer. TRANSLUCENT is used only for translucent facades further down below.
if ( layer == BlockRenderLayer.CUTOUT )
// The core parts of the cable will only be rendered in the CUTOUT layer. TRANSLUCENT is used only for
// translucent facades further down below.
if( layer == BlockRenderLayer.CUTOUT )
{
// First, handle the cable at the center of the cable bus
addCableQuads( renderState, quads );
@@ -90,13 +94,13 @@ public class CableBusBakedModel implements IBakedModel
// Then handle attachments
for( EnumFacing facing : EnumFacing.values() )
{
List<ResourceLocation> models = renderState.getAttachments().get( facing );
if( models == null )
final IPartModel partModel = renderState.getAttachments().get( facing );
if( partModel == null )
{
continue;
}
for( ResourceLocation model : models )
for( ResourceLocation model : partModel.getModels() )
{
IBakedModel bakedModel = partModels.get( model );
@@ -122,8 +126,7 @@ public class CableBusBakedModel implements IBakedModel
renderState.getBoundingBoxes(),
renderState.getAttachments().keySet(),
rand,
quads
);
quads );
return quads;
}
@@ -131,25 +134,30 @@ public class CableBusBakedModel implements IBakedModel
// Determines whether a cable is connected to exactly two sides that are opposite each other
private static boolean isStraightLine( AECableType cableType, EnumMap<EnumFacing, AECableType> sides )
{
Iterator<EnumFacing> it = sides.keySet().iterator();
final Iterator<Entry<EnumFacing, AECableType>> it = sides.entrySet().iterator();
if( !it.hasNext() )
{
return false; // No connections
}
EnumFacing firstSide = it.next();
AECableType firstType = sides.get( firstSide );
final Entry<EnumFacing, AECableType> nextConnection = it.next();
final EnumFacing firstSide = nextConnection.getKey();
final AECableType firstType = nextConnection.getValue();
if( !it.hasNext() )
{
return false; // Only a single connection
}
if( firstSide.getOpposite() != it.next() )
if( firstSide.getOpposite() != it.next().getKey() )
{
return false; // Connected to two sides that are not opposite each other
}
if (it.hasNext()) {
if( it.hasNext() )
{
return false; // Must not have any other connection points
}
AECableType secondType = sides.get( firstSide.getOpposite() );
final AECableType secondType = sides.get( firstSide.getOpposite() );
// Certain cable types have restrictions on when they're rendered as a straight connection
switch( cableType )
@@ -176,8 +184,8 @@ public class CableBusBakedModel implements IBakedModel
// If the connection is straight, no busses are attached, and no covered core has been forced (in case of glass
// cables), then render the cable as a simplified straight line.
boolean noAttachments = renderState.getAttachments().isEmpty();
if( isStraightLine( cableType, connectionTypes ) && noAttachments )
boolean noAttachments = !renderState.getAttachments().values().stream().anyMatch( IPartModel::requireCableConnection );
if( noAttachments && isStraightLine( cableType, connectionTypes ) )
{
EnumFacing facing = connectionTypes.keySet().iterator().next();
@@ -227,11 +235,12 @@ public class CableBusBakedModel implements IBakedModel
}
// Render all outgoing connections using the appropriate type
for( EnumFacing facing : connectionTypes.keySet() )
for( final Entry<EnumFacing, AECableType> connection : connectionTypes.entrySet() )
{
AECableType connectionType = connectionTypes.get( facing );
boolean cableBusAdjacent = renderState.getCableBusAdjacent().contains( facing );
int channels = renderState.getChannelsOnSide().get( facing );
final EnumFacing facing = connection.getKey();
final AECableType connectionType = connection.getValue();
final boolean cableBusAdjacent = renderState.getCableBusAdjacent().contains( facing );
final int channels = renderState.getChannelsOnSide().get( facing );
switch( cableType )
{
@@ -269,9 +278,9 @@ public class CableBusBakedModel implements IBakedModel
// If no core is present, just use the first part that comes into play
for( EnumFacing side : renderState.getAttachments().keySet() )
{
List<ResourceLocation> models = renderState.getAttachments().get( side );
IPartModel partModel = renderState.getAttachments().get( side );
for( ResourceLocation model : models )
for( ResourceLocation model : partModel.getModels() )
{
IBakedModel bakedModel = partModels.get( model );
@@ -282,9 +291,11 @@ public class CableBusBakedModel implements IBakedModel
TextureAtlasSprite particleTexture = bakedModel.getParticleTexture();
// If a part sub-model has no particle texture (indicated by it being the missing texture), don't add it,
// If a part sub-model has no particle texture (indicated by it being the missing texture), don't
// add
// it,
// so we don't get ugly missing texture break particles.
if ( textureMap.getMissingSprite() != particleTexture )
if( textureMap.getMissingSprite() != particleTexture )
{
result.add( particleTexture );
}
@@ -25,9 +25,9 @@ import java.util.EnumSet;
import java.util.List;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import appeng.api.parts.IPartModel;
import appeng.api.util.AECableType;
import appeng.api.util.AEColor;
@@ -60,7 +60,7 @@ public class CableBusRenderState
// connections contains a corresponding entry.
private EnumMap<EnumFacing, Integer> channelsOnSide = new EnumMap<>( EnumFacing.class );
private EnumMap<EnumFacing, List<ResourceLocation>> attachments = new EnumMap<>( EnumFacing.class );
private EnumMap<EnumFacing, IPartModel> attachments = new EnumMap<>( EnumFacing.class );
// For each attachment, this contains the distance from the edge until which a cable connection should be drawn
private EnumMap<EnumFacing, Integer> attachmentConnections = new EnumMap<>( EnumFacing.class );
@@ -68,7 +68,8 @@ public class CableBusRenderState
// Contains the facade to use for each side that has a facade attached
private EnumMap<EnumFacing, FacadeRenderState> facades = new EnumMap<>( EnumFacing.class );
// Contains the bounding boxes of all parts on the cable bus to allow facades to cut out holes for the parts. This list is only populated if there are
// Contains the bounding boxes of all parts on the cable bus to allow facades to cut out holes for the parts. This
// list is only populated if there are
// facades on this cable bus
private List<AxisAlignedBB> boundingBoxes = new ArrayList<>();
@@ -132,7 +133,7 @@ public class CableBusRenderState
this.cableBusAdjacent = cableBusAdjacent;
}
public EnumMap<EnumFacing, List<ResourceLocation>> getAttachments()
public EnumMap<EnumFacing, IPartModel> getAttachments()
{
return attachments;
}
@@ -23,6 +23,7 @@ import java.util.ArrayList;
import java.util.EnumMap;
import java.util.EnumSet;
import java.util.List;
import javax.vecmath.Vector4f;
import com.google.common.base.Preconditions;
@@ -26,6 +26,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.Nullable;
import javax.vecmath.Vector3f;
@@ -2,6 +2,7 @@ package appeng.client.render.crafting;
import java.util.List;
import javax.annotation.Nullable;
import javax.vecmath.Matrix4f;
@@ -21,6 +21,7 @@ package appeng.client.render.model;
import java.util.ArrayList;
import java.util.List;
import javax.vecmath.Vector3f;
import javax.vecmath.Vector4f;
@@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.ExecutionException;
import javax.annotation.Nullable;
import javax.vecmath.Matrix4f;
@@ -4,6 +4,7 @@ package appeng.client.render.model;
import java.util.ArrayList;
import java.util.EnumMap;
import java.util.List;
import javax.annotation.Nullable;
import javax.vecmath.Matrix4f;
@@ -32,6 +32,7 @@ import java.lang.reflect.Type;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Nullable;
import com.google.common.base.Charsets;
@@ -31,6 +31,7 @@ import appeng.api.networking.crafting.ICraftingCPU;
import appeng.api.networking.crafting.ICraftingGrid;
import appeng.api.storage.ITerminalHost;
import appeng.container.guisync.GuiSync;
import appeng.util.Platform;
public class ContainerCraftingStatus extends ContainerCraftingCPU
@@ -52,50 +53,53 @@ public class ContainerCraftingStatus extends ContainerCraftingCPU
@Override
public void detectAndSendChanges()
{
final ICraftingGrid cc = this.getNetwork().getCache( ICraftingGrid.class );
final ImmutableSet<ICraftingCPU> cpuSet = cc.getCpus();
int matches = 0;
boolean changed = false;
for( final ICraftingCPU c : cpuSet )
if( Platform.isServer() && this.getNetwork() != null )
{
boolean found = false;
for( final CraftingCPURecord ccr : this.cpus )
{
if( ccr.getCpu() == c )
{
found = true;
}
}
final ICraftingGrid cc = this.getNetwork().getCache( ICraftingGrid.class );
final ImmutableSet<ICraftingCPU> cpuSet = cc.getCpus();
final boolean matched = this.cpuMatches( c );
if( matched )
{
matches++;
}
if( found == !matched )
{
changed = true;
}
}
if( changed || this.cpus.size() != matches )
{
this.cpus.clear();
int matches = 0;
boolean changed = false;
for( final ICraftingCPU c : cpuSet )
{
if( this.cpuMatches( c ) )
boolean found = false;
for( final CraftingCPURecord ccr : this.cpus )
{
this.cpus.add( new CraftingCPURecord( c.getAvailableStorage(), c.getCoProcessors(), c ) );
if( ccr.getCpu() == c )
{
found = true;
}
}
final boolean matched = this.cpuMatches( c );
if( matched )
{
matches++;
}
if( found == !matched )
{
changed = true;
}
}
this.sendCPUs();
}
if( changed || this.cpus.size() != matches )
{
this.cpus.clear();
for( final ICraftingCPU c : cpuSet )
{
if( this.cpuMatches( c ) )
{
this.cpus.add( new CraftingCPURecord( c.getAvailableStorage(), c.getCoProcessors(), c ) );
}
}
this.noCPU = this.cpus.isEmpty();
this.sendCPUs();
}
this.noCPU = this.cpus.isEmpty();
}
super.detectAndSendChanges();
}
+1
View File
@@ -22,6 +22,7 @@ package appeng.core;
import java.io.File;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.annotation.Nonnull;
import com.google.common.base.Stopwatch;
+3 -2
View File
@@ -22,6 +22,7 @@ package appeng.core;
import java.io.File;
import java.util.HashSet;
import java.util.Set;
import javax.annotation.Nonnull;
import com.google.common.base.Preconditions;
@@ -57,8 +58,8 @@ import appeng.api.parts.IPartHelper;
import appeng.capabilities.Capabilities;
import appeng.core.features.AEFeature;
import appeng.core.features.registries.P2PTunnelRegistry;
import appeng.core.features.registries.entries.BasicCellHandler;
import appeng.core.features.registries.entries.CreativeCellHandler;
import appeng.core.features.registries.cell.BasicCellHandler;
import appeng.core.features.registries.cell.CreativeCellHandler;
import appeng.core.localization.GuiText;
import appeng.core.localization.PlayerMessages;
import appeng.core.stats.PlayerStatsRegistration;
@@ -61,7 +61,7 @@ public final class ApiParts implements IParts
private final IItemDefinition p2PTunnelME;
private final IItemDefinition p2PTunnelRedstone;
private final IItemDefinition p2PTunnelItems;
private final IItemDefinition p2PTunnelLiquids;
private final IItemDefinition p2PTunnelFluids;
private final IItemDefinition p2PTunnelEU;
// private final IItemDefinition p2PTunnelRF;
private final IItemDefinition p2PTunnelLight;
@@ -112,7 +112,7 @@ public final class ApiParts implements IParts
this.p2PTunnelME = new DamagedItemDefinition( "part.tunnel.me", itemPart.createPart( PartType.P2PTunnelME ) );
this.p2PTunnelRedstone = new DamagedItemDefinition( "part.tunnel.redstone", itemPart.createPart( PartType.P2PTunnelRedstone ) );
this.p2PTunnelItems = new DamagedItemDefinition( "part.tunnel.item", itemPart.createPart( PartType.P2PTunnelItems ) );
this.p2PTunnelLiquids = new DamagedItemDefinition( "part.tunnel.fluid", itemPart.createPart( PartType.P2PTunnelLiquids ) );
this.p2PTunnelFluids = new DamagedItemDefinition( "part.tunnel.fluid", itemPart.createPart( PartType.P2PTunnelFluids ) );
this.p2PTunnelEU = new DamagedItemDefinition( "part.tunnel.eu", itemPart.createPart( PartType.P2PTunnelEU ) );
// this.p2PTunnelRF = new DamagedItemDefinition( itemMultiPart.createPart( PartType.P2PTunnelRF ) );
this.p2PTunnelLight = new DamagedItemDefinition( "part.tunnel.light", itemPart.createPart( PartType.P2PTunnelLight ) );
@@ -281,9 +281,9 @@ public final class ApiParts implements IParts
}
@Override
public IItemDefinition p2PTunnelLiquids()
public IItemDefinition p2PTunnelFluids()
{
return this.p2PTunnelLiquids;
return this.p2PTunnelFluids;
}
@Override
@@ -118,7 +118,7 @@ public enum AEFeature
P2P_TUNNEL_ITEMS( "P2PTunnelItems", Constants.CATEGORY_P2P_TUNNELS ),
P2P_TUNNEL_REDSTONE( "P2PTunnelRedstone", Constants.CATEGORY_P2P_TUNNELS ),
P2P_TUNNEL_EU( "P2PTunnelEU", Constants.CATEGORY_P2P_TUNNELS ),
P2P_TUNNEL_LIQUIDS( "P2PTunnelLiquids", Constants.CATEGORY_P2P_TUNNELS ),
P2P_TUNNEL_FLUIDS( "P2PTunnelFluids", Constants.CATEGORY_P2P_TUNNELS ),
P2P_TUNNEL_LIGHT( "P2PTunnelLight", Constants.CATEGORY_P2P_TUNNELS ),
P2P_TUNNEL_OPEN_COMPUTERS( "P2PTunnelOpenComputers", Constants.CATEGORY_P2P_TUNNELS ),
P2P_TUNNEL_PRESSURE( "P2PTunnelPressure", Constants.CATEGORY_P2P_TUNNELS ),
@@ -34,6 +34,9 @@ import appeng.api.movable.IMovableRegistry;
import appeng.api.networking.IGridCacheRegistry;
import appeng.api.parts.IPartModels;
import appeng.api.storage.ICellRegistry;
import appeng.core.features.registries.cell.CellRegistry;
import appeng.core.features.registries.grinder.GrinderRecipeManager;
import appeng.core.features.registries.inscriber.InscriberRegistry;
/**
@@ -16,7 +16,7 @@
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.core.features.registries.entries;
package appeng.core.features.registries.cell;
import net.minecraft.entity.player.EntityPlayer;
@@ -16,7 +16,7 @@
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.core.features.registries;
package appeng.core.features.registries.cell;
import java.util.ArrayList;
@@ -16,7 +16,7 @@
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.core.features.registries.entries;
package appeng.core.features.registries.cell;
import net.minecraft.entity.player.EntityPlayer;
@@ -16,7 +16,7 @@
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.core.features.registries.entries;
package appeng.core.features.registries.grinder;
import java.util.Optional;
@@ -40,17 +40,17 @@ public class AppEngGrinderRecipe implements IGrinderRecipe
private final int turns;
public AppEngGrinderRecipe( final ItemStack input, final ItemStack output, final int cost )
AppEngGrinderRecipe( final ItemStack input, final ItemStack output, final int cost )
{
this( input, output, null, null, 0, 0, cost );
}
public AppEngGrinderRecipe( final ItemStack input, final ItemStack output, final ItemStack optional, final float chance, final int cost )
AppEngGrinderRecipe( final ItemStack input, final ItemStack output, final ItemStack optional, final float chance, final int cost )
{
this( input, output, optional, null, chance, 0, cost );
}
public AppEngGrinderRecipe( final ItemStack input, final ItemStack output, final ItemStack optional1, final ItemStack optional2, final float chance1, final float chance2, final int cost )
AppEngGrinderRecipe( final ItemStack input, final ItemStack output, final ItemStack optional1, final ItemStack optional2, final float chance1, final float chance2, final int cost )
{
this.in = input;
this.out = output;
@@ -16,7 +16,7 @@
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.core.features.registries;
package appeng.core.features.registries.grinder;
import java.util.Collection;
@@ -36,7 +36,6 @@ import appeng.api.features.IGrinderRecipe;
import appeng.api.features.IGrinderRegistry;
import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.core.features.registries.entries.AppEngGrinderRecipe;
import appeng.recipes.ores.IOreListener;
import appeng.recipes.ores.OreDictionaryHandler;
import appeng.util.Platform;
@@ -16,7 +16,7 @@
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.core.features.registries.entries;
package appeng.core.features.registries.inscriber;
import java.util.Collection;
@@ -38,7 +38,7 @@ import appeng.api.features.InscriberProcessType;
*/
public class InscriberInscribeRecipe extends InscriberRecipe
{
public InscriberInscribeRecipe( @Nonnull final Collection<ItemStack> inputs, @Nonnull final ItemStack output, @Nullable final ItemStack top, @Nullable final ItemStack bot )
InscriberInscribeRecipe( @Nonnull final Collection<ItemStack> inputs, @Nonnull final ItemStack output, @Nullable final ItemStack top, @Nullable final ItemStack bot )
{
super( inputs, output, top, bot, InscriberProcessType.INSCRIBE );
}
@@ -16,7 +16,7 @@
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.core.features.registries.entries;
package appeng.core.features.registries.inscriber;
import java.util.ArrayList;
@@ -57,7 +57,7 @@ public class InscriberRecipe implements IInscriberRecipe
@Nonnull
private final InscriberProcessType type;
public InscriberRecipe( @Nonnull final Collection<ItemStack> inputs, @Nonnull final ItemStack output, @Nullable final ItemStack top, @Nullable final ItemStack bot, @Nonnull final InscriberProcessType type )
InscriberRecipe( @Nonnull final Collection<ItemStack> inputs, @Nonnull final ItemStack output, @Nullable final ItemStack top, @Nullable final ItemStack bot, @Nonnull final InscriberProcessType type )
{
this.inputs = new ArrayList<ItemStack>( inputs.size() );
this.inputs.addAll( inputs );
@@ -16,7 +16,7 @@
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.core.features.registries;
package appeng.core.features.registries.inscriber;
import java.util.ArrayList;
@@ -35,7 +35,6 @@ import appeng.api.features.IInscriberRecipe;
import appeng.api.features.IInscriberRecipeBuilder;
import appeng.api.features.IInscriberRegistry;
import appeng.api.features.InscriberProcessType;
import appeng.core.features.registries.entries.InscriberRecipe;
/**
@@ -34,11 +34,11 @@ import appeng.core.sync.packets.PacketCompressedNBT;
import appeng.core.sync.packets.PacketConfigButton;
import appeng.core.sync.packets.PacketCraftRequest;
import appeng.core.sync.packets.PacketInventoryAction;
import appeng.core.sync.packets.PacketJEIRecipe;
import appeng.core.sync.packets.PacketLightning;
import appeng.core.sync.packets.PacketMEInventoryUpdate;
import appeng.core.sync.packets.PacketMatterCannon;
import appeng.core.sync.packets.PacketMockExplosion;
import appeng.core.sync.packets.PacketJEIRecipe;
import appeng.core.sync.packets.PacketNewStorageDimension;
import appeng.core.sync.packets.PacketPaintedEntity;
import appeng.core.sync.packets.PacketPartPlacement;
@@ -16,7 +16,7 @@
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.coremod.asm;
package appeng.coremod.transformer;
import java.util.Iterator;
@@ -19,11 +19,9 @@
package appeng.crafting;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import javax.annotation.Nonnull;
import java.util.Set;
import appeng.api.networking.crafting.ICraftingWatcher;
import appeng.api.networking.crafting.ICraftingWatcherHost;
@@ -39,7 +37,7 @@ public class CraftingWatcher implements ICraftingWatcher
private final CraftingGridCache gsc;
private final ICraftingWatcherHost host;
private final HashSet<IAEStack> myInterests = new HashSet<IAEStack>();
private final Set<IAEStack> myInterests = new HashSet<IAEStack>();
public CraftingWatcher( final CraftingGridCache cache, final ICraftingWatcherHost host )
{
@@ -52,45 +50,6 @@ public class CraftingWatcher implements ICraftingWatcher
return this.host;
}
@Override
public int size()
{
return this.myInterests.size();
}
@Override
public boolean isEmpty()
{
return this.myInterests.isEmpty();
}
@Override
public boolean contains( final Object o )
{
return this.myInterests.contains( o );
}
@Nonnull
@Override
public Iterator<IAEStack> iterator()
{
return new ItemWatcherIterator( this, this.myInterests.iterator() );
}
@Nonnull
@Override
public Object[] toArray()
{
return this.myInterests.toArray();
}
@Nonnull
@Override
public <T> T[] toArray( @Nonnull final T[] a )
{
return this.myInterests.toArray( a );
}
@Override
public boolean add( final IAEStack e )
{
@@ -103,100 +62,20 @@ public class CraftingWatcher implements ICraftingWatcher
}
@Override
public boolean remove( final Object o )
public boolean remove( final IAEStack o )
{
return this.myInterests.remove( o ) && this.gsc.getInterestManager().remove( (IAEStack) o, this );
}
@Override
public boolean containsAll( @Nonnull final Collection<?> c )
{
return this.myInterests.containsAll( c );
}
@Override
public boolean addAll( @Nonnull final Collection<? extends IAEStack> c )
{
boolean didChange = false;
for( final IAEStack o : c )
{
didChange = this.add( o ) || didChange;
}
return didChange;
}
@Override
public boolean removeAll( @Nonnull final Collection<?> c )
{
boolean didSomething = false;
for( final Object o : c )
{
didSomething = this.remove( o ) || didSomething;
}
return didSomething;
}
@Override
public boolean retainAll( @Nonnull final Collection<?> c )
{
boolean changed = false;
final Iterator<IAEStack> i = this.iterator();
while( i.hasNext() )
{
if( !c.contains( i.next() ) )
{
i.remove();
changed = true;
}
}
return changed;
}
@Override
public void clear()
public void reset()
{
final Iterator<IAEStack> i = this.myInterests.iterator();
while( i.hasNext() )
{
this.gsc.getInterestManager().remove( i.next(), this );
i.remove();
}
}
private class ItemWatcherIterator implements Iterator<IAEStack>
{
private final CraftingWatcher watcher;
private final Iterator<IAEStack> interestIterator;
private IAEStack myLast;
public ItemWatcherIterator( final CraftingWatcher parent, final Iterator<IAEStack> i )
{
this.watcher = parent;
this.interestIterator = i;
}
@Override
public boolean hasNext()
{
return this.interestIterator.hasNext();
}
@Override
public IAEStack next()
{
return this.myLast = this.interestIterator.next();
}
@Override
public void remove()
{
CraftingWatcher.this.gsc.getInterestManager().remove( this.myLast, this.watcher );
this.interestIterator.remove();
}
}
}
@@ -2,6 +2,7 @@ package appeng.decorative.slab;
import java.util.Random;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
@@ -95,15 +95,17 @@ public class BlockQuartzGlass extends AEBaseBlock
{
BlockPos adjacentPos = pos.offset( side );
final Material mat = w.getBlockState( adjacentPos ).getBlock().getMaterial( state );
final Material mat = w.getBlockState( adjacentPos ).getMaterial();
if( mat == Material.GLASS || mat == AEGlassMaterial.INSTANCE )
{
if( w.getBlockState( adjacentPos ).getBlock().getRenderType( state ) == this.getRenderType( state ) )
if( w.getBlockState( adjacentPos ).getRenderType() == this.getRenderType( state ) )
{
return false;
}
}
return super.shouldSideBeRendered( state, w, pos, side );
return w.getBlockState( pos ).shouldSideBeRendered( w, adjacentPos, side );
}
@Override
@@ -64,7 +64,7 @@ public final class EntityChargedQuartz extends AEBaseEntityItem
{
super.onUpdate();
if( !AEConfig.instance().isFeatureEnabled( AEFeature.IN_WORLD_FLUIX ) )
if( this.isDead || !AEConfig.instance().isFeatureEnabled( AEFeature.IN_WORLD_FLUIX ) )
{
return;
}
@@ -74,14 +74,16 @@ public final class EntityChargedQuartz extends AEBaseEntityItem
CommonHelper.proxy.spawnEffect( EffectType.Lightning, this.worldObj, this.posX, this.posY, this.posZ, null );
this.delay = 0;
}
this.delay++;
final int j = MathHelper.floor_double( this.posX );
final int i = MathHelper.floor_double( (this.getEntityBoundingBox().minY + this.getEntityBoundingBox().maxY) / 2.0D );
final int i = MathHelper.floor_double( ( this.getEntityBoundingBox().minY + this.getEntityBoundingBox().maxY ) / 2.0D );
final int k = MathHelper.floor_double( this.posZ );
IBlockState state = this.worldObj.getBlockState( new BlockPos( j, i, k ) );
final Material mat = state.getBlock().getMaterial( state );
if( Platform.isServer() && mat.isLiquid() )
{
this.transformTime++;
@@ -25,6 +25,7 @@ import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import javax.annotation.Nullable;
import com.google.common.collect.ImmutableSet;
@@ -27,6 +27,10 @@ public interface IIntegrationModule
return true;
}
default void preInit() throws Throwable
{
}
default void init() throws Throwable
{
}
@@ -94,24 +94,14 @@ final class IntegrationNode
if( enabled )
{
switch( type )
{
case IC2:
this.mod = Integrations.setIc2( new IC2Module() );
break;
case JEI:
this.mod = Integrations.setJei( new JEIModule() );
break;
case Waila:
this.mod = new WailaModule();
break;
}
this.mod = type.createInstance();
}
else
{
throw new ModNotInstalled( this.modID );
}
this.mod.preInit();
this.setState( IntegrationStage.INIT );
break;
@@ -19,9 +19,22 @@
package appeng.integration;
import appeng.integration.modules.ic2.IC2Module;
import appeng.integration.modules.jei.JEIModule;
import appeng.integration.modules.theoneprobe.TheOneProbeModule;
import appeng.integration.modules.waila.WailaModule;
public enum IntegrationType
{
IC2( IntegrationSide.BOTH, "Industrial Craft 2", "IC2" ),
IC2( IntegrationSide.BOTH, "Industrial Craft 2", "IC2" )
{
@Override
public IIntegrationModule createInstance()
{
return Integrations.setIc2( new IC2Module() );
}
},
RC( IntegrationSide.BOTH, "Railcraft", "Railcraft" ),
@@ -31,15 +44,38 @@ public enum IntegrationType
MFR( IntegrationSide.BOTH, "Mine Factory Reloaded", "MineFactoryReloaded" ),
Waila( IntegrationSide.BOTH, "Waila", "Waila" ),
Waila( IntegrationSide.BOTH, "Waila", "Waila" )
{
@Override
public IIntegrationModule createInstance()
{
return new WailaModule();
}
},
InvTweaks( IntegrationSide.CLIENT, "Inventory Tweaks", "inventorytweaks" ),
JEI( IntegrationSide.CLIENT, "Just Enough Items", "JEI" ),
JEI( IntegrationSide.CLIENT, "Just Enough Items", "JEI" )
{
@Override
public IIntegrationModule createInstance()
{
return Integrations.setJei( new JEIModule() );
}
},
Mekanism( IntegrationSide.BOTH, "Mekanism", "Mekanism" ),
OpenComputers( IntegrationSide.BOTH, "OpenComputers", "OpenComputers" );
OpenComputers( IntegrationSide.BOTH, "OpenComputers", "OpenComputers" ),
THE_ONE_PROBE( IntegrationSide.BOTH, "TheOneProbe", "theoneprobe" )
{
@Override
public IIntegrationModule createInstance()
{
return new TheOneProbeModule();
}
};
public final IntegrationSide side;
public final String dspName;
@@ -52,4 +88,9 @@ public enum IntegrationType
this.modID = modid;
}
public IIntegrationModule createInstance()
{
throw new UnsupportedOperationException();
}
}
@@ -21,6 +21,7 @@ package appeng.integration.modules.jei;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nullable;
import com.google.common.base.Splitter;
@@ -23,6 +23,7 @@ import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import javax.annotation.Nullable;
import net.minecraft.entity.player.EntityPlayer;
@@ -0,0 +1,86 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, 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.integration.modules.theoneprobe;
import java.util.List;
import java.util.Optional;
import com.google.common.collect.Lists;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import mcjty.theoneprobe.api.IProbeHitData;
import mcjty.theoneprobe.api.IProbeInfo;
import mcjty.theoneprobe.api.IProbeInfoProvider;
import mcjty.theoneprobe.api.ProbeMode;
import appeng.api.parts.IPart;
import appeng.core.AppEng;
import appeng.integration.modules.theoneprobe.part.ChannelInfoProvider;
import appeng.integration.modules.theoneprobe.part.IPartProbInfoProvider;
import appeng.integration.modules.theoneprobe.part.P2PStateInfoProvider;
import appeng.integration.modules.theoneprobe.part.PartAccessor;
import appeng.integration.modules.theoneprobe.part.PowerStateInfoProvider;
import appeng.integration.modules.theoneprobe.part.StorageMonitorInfoProvider;
public final class PartInfoProvider implements IProbeInfoProvider
{
private final List<IPartProbInfoProvider> providers;
private final PartAccessor accessor = new PartAccessor();
public PartInfoProvider()
{
final IPartProbInfoProvider channel = new ChannelInfoProvider();
final IPartProbInfoProvider power = new PowerStateInfoProvider();
final IPartProbInfoProvider storageMonitor = new StorageMonitorInfoProvider();
final IPartProbInfoProvider p2p = new P2PStateInfoProvider();
this.providers = Lists.newArrayList( channel, power, p2p, storageMonitor );
}
@Override
public String getID()
{
return AppEng.MOD_ID + ":PartInfoProvider";
}
@Override
public void addProbeInfo( ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data )
{
final TileEntity te = world.getTileEntity( data.getPos() );
final Optional<IPart> maybePart = this.accessor.getMaybePart( te, data );
if( maybePart.isPresent() )
{
final IPart part = maybePart.get();
for( final IPartProbInfoProvider provider : this.providers )
{
provider.addProbeInfo( part, mode, probeInfo, player, world, blockState, data );
}
}
}
}
@@ -0,0 +1,51 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, 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.integration.modules.theoneprobe;
import com.google.common.base.Function;
import net.minecraftforge.fml.common.event.FMLInterModComms;
import mcjty.theoneprobe.api.ITheOneProbe;
import appeng.integration.IIntegrationModule;
import appeng.integration.modules.theoneprobe.config.AEConfigProvider;
public class TheOneProbeModule implements IIntegrationModule, Function<ITheOneProbe, Void>
{
@Override
public void preInit() throws Throwable
{
FMLInterModComms.sendFunctionMessage( "theoneprobe", "getTheOneProbe", this.getClass().getName() );
}
@Override
public Void apply( ITheOneProbe input )
{
input.registerProbeConfigProvider( new AEConfigProvider() );
input.registerProvider( new TileInfoProvider() );
input.registerProvider( new PartInfoProvider() );
return null;
}
}
@@ -0,0 +1,66 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, 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.integration.modules.theoneprobe;
import java.util.Locale;
import net.minecraft.util.text.translation.I18n;
public enum TheOneProbeText
{
CRAFTING,
DEVICE_ONLINE,
DEVICE_OFFLINE,
DEVICE_MISSING_CHANNEL,
P2P_UNLINKED,
P2P_INPUT_ONE_OUTPUT,
P2P_INPUT_MANY_OUTPUTS,
P2P_OUTPUT,
LOCKED,
UNLOCKED,
SHOWING,
CONTAINS,
CHANNELS,
STORED_ENERGY;
private final String root;
TheOneProbeText()
{
this.root = "theoneprobe.appliedenergistics2";
}
public String getLocal()
{
return I18n.translateToLocal( this.getUnlocalized() );
}
public String getUnlocalized()
{
return this.root + '.' + this.name().toLowerCase( Locale.ENGLISH );
}
}
@@ -0,0 +1,80 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, 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.integration.modules.theoneprobe;
import java.util.List;
import com.google.common.collect.Lists;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import mcjty.theoneprobe.api.IProbeHitData;
import mcjty.theoneprobe.api.IProbeInfo;
import mcjty.theoneprobe.api.IProbeInfoProvider;
import mcjty.theoneprobe.api.ProbeMode;
import appeng.core.AppEng;
import appeng.integration.modules.theoneprobe.tile.ChargerInfoProvider;
import appeng.integration.modules.theoneprobe.tile.CraftingMonitorInfoProvider;
import appeng.integration.modules.theoneprobe.tile.ITileProbInfoProvider;
import appeng.integration.modules.theoneprobe.tile.PowerStateInfoProvider;
import appeng.integration.modules.theoneprobe.tile.PowerStorageInfoProvider;
import appeng.tile.AEBaseTile;
public final class TileInfoProvider implements IProbeInfoProvider
{
private final List<ITileProbInfoProvider> providers;
public TileInfoProvider()
{
final ITileProbInfoProvider charger = new ChargerInfoProvider();
final ITileProbInfoProvider energyCell = new CraftingMonitorInfoProvider();
final ITileProbInfoProvider craftingBlock = new PowerStateInfoProvider();
final ITileProbInfoProvider craftingMonitor = new PowerStorageInfoProvider();
this.providers = Lists.newArrayList( charger, energyCell, craftingBlock, craftingMonitor );
}
@Override
public String getID()
{
return AppEng.MOD_ID + ":TileInfoProvider";
}
@Override
public void addProbeInfo( ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data )
{
final TileEntity tile = world.getTileEntity( data.getPos() );
if( tile instanceof AEBaseTile )
{
final AEBaseTile aeBaseTile = (AEBaseTile) tile;
for( final ITileProbInfoProvider provider : this.providers )
{
provider.addProbeInfo( aeBaseTile, mode, probeInfo, player, world, blockState, data );
}
}
}
}
@@ -0,0 +1,53 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, 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.integration.modules.theoneprobe.config;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import mcjty.theoneprobe.api.IProbeConfig;
import mcjty.theoneprobe.api.IProbeConfigProvider;
import mcjty.theoneprobe.api.IProbeHitData;
import mcjty.theoneprobe.api.IProbeHitEntityData;
import appeng.tile.AEBaseTile;
public class AEConfigProvider implements IProbeConfigProvider
{
@Override
public void getProbeConfig( IProbeConfig config, EntityPlayer player, World world, Entity entity, IProbeHitEntityData data )
{
// Still no AE entities.
}
@Override
public void getProbeConfig( IProbeConfig config, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data )
{
if( world.getTileEntity( data.getPos() ) instanceof AEBaseTile )
{
config.setRFMode( 0 );
}
}
}
@@ -0,0 +1,66 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, 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.integration.modules.theoneprobe.part;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import mcjty.theoneprobe.api.IProbeHitData;
import mcjty.theoneprobe.api.IProbeInfo;
import mcjty.theoneprobe.api.ProbeMode;
import appeng.api.parts.IPart;
import appeng.integration.modules.theoneprobe.TheOneProbeText;
import appeng.parts.networking.PartCableSmart;
import appeng.parts.networking.PartDenseCable;
public class ChannelInfoProvider implements IPartProbInfoProvider
{
@Override
public void addProbeInfo( IPart part, ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data )
{
if( part instanceof PartDenseCable || part instanceof PartCableSmart )
{
final int usedChannels;
final int maxChannels = ( part instanceof PartDenseCable ) ? 32 : 8;
if( part.getGridNode().isActive() )
{
final NBTTagCompound tmp = new NBTTagCompound();
part.writeToNBT( tmp );
usedChannels = tmp.getByte( "usedChannels" );
}
else
{
usedChannels = 0;
}
final String formattedChannelString = String.format( TheOneProbeText.CHANNELS.getLocal(), usedChannels, maxChannels );
probeInfo.text( formattedChannelString );
}
}
}
@@ -0,0 +1,45 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, 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.integration.modules.theoneprobe.part;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import mcjty.theoneprobe.api.IProbeHitData;
import mcjty.theoneprobe.api.IProbeInfo;
import mcjty.theoneprobe.api.IProbeInfoProvider;
import mcjty.theoneprobe.api.ProbeMode;
import appeng.api.parts.IPart;
/**
* Similar to {@link IProbeInfoProvider}, but already providing the {@link IPart} being looked at.
*
*/
public interface IPartProbInfoProvider
{
/**
* @see IProbeInfoProvider#addProbeInfo(ProbeMode, IProbeInfo, EntityPlayer, World, IBlockState, IProbeHitData)
*/
void addProbeInfo( IPart part, ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data );
}
@@ -0,0 +1,115 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, 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.integration.modules.theoneprobe.part;
import com.google.common.collect.Iterators;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import mcjty.theoneprobe.api.IProbeHitData;
import mcjty.theoneprobe.api.IProbeInfo;
import mcjty.theoneprobe.api.ProbeMode;
import appeng.api.parts.IPart;
import appeng.integration.modules.theoneprobe.TheOneProbeText;
import appeng.me.GridAccessException;
import appeng.parts.p2p.PartP2PTunnel;
public class P2PStateInfoProvider implements IPartProbInfoProvider
{
private static final int STATE_UNLINKED = 0;
private static final int STATE_OUTPUT = 1;
private static final int STATE_INPUT = 2;
public static final String TAG_P2P_STATE = "p2p_state";
@Override
public void addProbeInfo( IPart part, ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data )
{
if( part instanceof PartP2PTunnel )
{
final PartP2PTunnel tunnel = (PartP2PTunnel) part;
// The default state
int state = STATE_UNLINKED;
int outputCount = 0;
if( !tunnel.isOutput() )
{
outputCount = getOutputCount( tunnel );
if( outputCount > 0 )
{
// Only set it to INPUT if we know there are any outputs
state = STATE_INPUT;
}
}
else
{
final PartP2PTunnel input = tunnel.getInput();
if( input != null )
{
state = STATE_OUTPUT;
}
}
switch( state )
{
case STATE_UNLINKED:
probeInfo.text( TheOneProbeText.P2P_UNLINKED.getLocal() );
break;
case STATE_OUTPUT:
probeInfo.text( TheOneProbeText.P2P_OUTPUT.getLocal() );
break;
case STATE_INPUT:
probeInfo.text( getOutputText( outputCount ) );
break;
}
}
}
private static int getOutputCount( PartP2PTunnel tunnel )
{
try
{
return Iterators.size( tunnel.getOutputs().iterator() );
}
catch( GridAccessException e )
{
// Well... unknown size it is!
return 0;
}
}
private static String getOutputText( int outputs )
{
if( outputs <= 1 )
{
return TheOneProbeText.P2P_INPUT_ONE_OUTPUT.getLocal();
}
else
{
return String.format( TheOneProbeText.P2P_INPUT_MANY_OUTPUTS.getLocal(), outputs );
}
}
}
@@ -0,0 +1,55 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, 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.integration.modules.theoneprobe.part;
import java.util.Optional;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import mcjty.theoneprobe.api.IProbeHitData;
import appeng.api.parts.IPart;
import appeng.api.parts.IPartHost;
import appeng.api.parts.SelectedPart;
public final class PartAccessor
{
public Optional<IPart> getMaybePart( final TileEntity te, final IProbeHitData data )
{
if( te instanceof IPartHost )
{
BlockPos pos = data.getPos();
final Vec3d position = data.getHitVec().addVector( -pos.getX(), -pos.getY(), -pos.getZ() );
final IPartHost host = (IPartHost) te;
final SelectedPart sp = host.selectPart( position );
if( sp.part != null )
{
return Optional.of( sp.part );
}
}
return Optional.empty();
}
}
@@ -0,0 +1,71 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, 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.integration.modules.theoneprobe.part;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import mcjty.theoneprobe.api.IProbeHitData;
import mcjty.theoneprobe.api.IProbeInfo;
import mcjty.theoneprobe.api.ProbeMode;
import appeng.api.implementations.IPowerChannelState;
import appeng.api.parts.IPart;
import appeng.integration.modules.theoneprobe.TheOneProbeText;
public class PowerStateInfoProvider implements IPartProbInfoProvider
{
@Override
public void addProbeInfo( IPart part, ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data )
{
if( part instanceof IPowerChannelState )
{
final IPowerChannelState state = (IPowerChannelState) part;
final String tooltip = this.getToolTip( state.isActive(), state.isPowered() );
probeInfo.text( tooltip );
}
}
private String getToolTip( final boolean isActive, final boolean isPowered )
{
final String result;
if( isActive && isPowered )
{
result = TheOneProbeText.DEVICE_ONLINE.getLocal();
}
else if( isPowered )
{
result = TheOneProbeText.DEVICE_MISSING_CHANNEL.getLocal();
}
else
{
result = TheOneProbeText.DEVICE_OFFLINE.getLocal();
}
return result;
}
}
@@ -0,0 +1,66 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, 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.integration.modules.theoneprobe.part;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import mcjty.theoneprobe.api.IProbeHitData;
import mcjty.theoneprobe.api.IProbeInfo;
import mcjty.theoneprobe.api.ProbeMode;
import appeng.api.implementations.parts.IPartStorageMonitor;
import appeng.api.parts.IPart;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAEStack;
import appeng.integration.modules.theoneprobe.TheOneProbeText;
public class StorageMonitorInfoProvider implements IPartProbInfoProvider
{
@Override
public void addProbeInfo( IPart part, ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data )
{
if( part instanceof IPartStorageMonitor )
{
final IPartStorageMonitor monitor = (IPartStorageMonitor) part;
final IAEStack<?> displayed = monitor.getDisplayed();
final boolean isLocked = monitor.isLocked();
if( displayed instanceof IAEItemStack )
{
final IAEItemStack ais = (IAEItemStack) displayed;
probeInfo.text( TheOneProbeText.SHOWING.getLocal() + ": " + ais.getItemStack().getDisplayName() );
}
else if( displayed instanceof IAEFluidStack )
{
final IAEFluidStack ais = (IAEFluidStack) displayed;
probeInfo.text( TheOneProbeText.SHOWING.getLocal() + ": " + ais.getFluid().getLocalizedName( ais.getFluidStack() ) );
}
probeInfo.text( isLocked ? TheOneProbeText.LOCKED.getLocal() : TheOneProbeText.UNLOCKED.getLocal() );
}
}
}
@@ -0,0 +1,61 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, 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.integration.modules.theoneprobe.tile;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import mcjty.theoneprobe.api.ElementAlignment;
import mcjty.theoneprobe.api.IProbeHitData;
import mcjty.theoneprobe.api.IProbeInfo;
import mcjty.theoneprobe.api.ProbeMode;
import appeng.tile.AEBaseTile;
import appeng.tile.misc.TileCharger;
public class ChargerInfoProvider implements ITileProbInfoProvider
{
@Override
public void addProbeInfo( AEBaseTile tile, ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data )
{
if( tile instanceof TileCharger )
{
final TileCharger charger = (TileCharger) tile;
final IInventory chargerInventory = charger.getInternalInventory();
final ItemStack chargingItem = chargerInventory.getStackInSlot( 0 );
if( chargingItem != null )
{
final String currentInventory = chargingItem.getDisplayName();
final IProbeInfo centerAlignedHorizontalLayout = probeInfo
.horizontal( probeInfo.defaultLayoutStyle().alignment( ElementAlignment.ALIGN_CENTER ) );
centerAlignedHorizontalLayout.item( chargingItem );
centerAlignedHorizontalLayout.text( currentInventory );
}
}
}
}
@@ -0,0 +1,64 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, 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.integration.modules.theoneprobe.tile;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import mcjty.theoneprobe.api.ElementAlignment;
import mcjty.theoneprobe.api.IProbeHitData;
import mcjty.theoneprobe.api.IProbeInfo;
import mcjty.theoneprobe.api.ProbeMode;
import appeng.api.storage.data.IAEItemStack;
import appeng.integration.modules.theoneprobe.TheOneProbeText;
import appeng.tile.AEBaseTile;
import appeng.tile.crafting.TileCraftingMonitorTile;
public class CraftingMonitorInfoProvider implements ITileProbInfoProvider
{
@Override
public void addProbeInfo( AEBaseTile tile, ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data )
{
if( tile instanceof TileCraftingMonitorTile )
{
final TileCraftingMonitorTile monitor = (TileCraftingMonitorTile) tile;
final IAEItemStack displayStack = monitor.getJobProgress();
if( displayStack != null )
{
final ItemStack itemStack = displayStack.getItemStack();
final String itemName = itemStack.getDisplayName();
final String formattedCrafting = String.format( TheOneProbeText.CRAFTING.getLocal(), itemName );
final IProbeInfo centerAlignedHorizontalLayout = probeInfo
.horizontal( probeInfo.defaultLayoutStyle().alignment( ElementAlignment.ALIGN_CENTER ) );
centerAlignedHorizontalLayout.item( itemStack );
centerAlignedHorizontalLayout.text( formattedCrafting );
}
}
}
}
@@ -0,0 +1,44 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, 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.integration.modules.theoneprobe.tile;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import mcjty.theoneprobe.api.IProbeHitData;
import mcjty.theoneprobe.api.IProbeInfo;
import mcjty.theoneprobe.api.IProbeInfoProvider;
import mcjty.theoneprobe.api.ProbeMode;
import appeng.tile.AEBaseTile;
/**
* Similar to {@link IProbeInfoProvider}, but already providing the {@link AEBaseTile} being looked at.
*
*/
public interface ITileProbInfoProvider
{
/**
* @see IProbeInfoProvider#addProbeInfo(ProbeMode, IProbeInfo, EntityPlayer, World, IBlockState, IProbeHitData)
*/
void addProbeInfo( AEBaseTile tile, ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data );
}
@@ -0,0 +1,64 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, 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.integration.modules.theoneprobe.tile;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import mcjty.theoneprobe.api.IProbeHitData;
import mcjty.theoneprobe.api.IProbeInfo;
import mcjty.theoneprobe.api.ProbeMode;
import appeng.api.implementations.IPowerChannelState;
import appeng.integration.modules.theoneprobe.TheOneProbeText;
import appeng.tile.AEBaseTile;
public class PowerStateInfoProvider implements ITileProbInfoProvider
{
@Override
public void addProbeInfo( AEBaseTile tile, ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data )
{
if( tile instanceof IPowerChannelState )
{
final IPowerChannelState state = (IPowerChannelState) tile;
final boolean isActive = state.isActive();
final boolean isPowered = state.isPowered();
if( isActive && isPowered )
{
probeInfo.text( TheOneProbeText.DEVICE_ONLINE.getLocal() );
}
else if( isPowered )
{
probeInfo.text( TheOneProbeText.DEVICE_MISSING_CHANNEL.getLocal() );
}
else
{
probeInfo.text( TheOneProbeText.DEVICE_OFFLINE.getLocal() );
}
}
}
}
@@ -0,0 +1,66 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2015, 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.integration.modules.theoneprobe.tile;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import mcjty.theoneprobe.api.IProbeHitData;
import mcjty.theoneprobe.api.IProbeInfo;
import mcjty.theoneprobe.api.ProbeMode;
import appeng.api.networking.energy.IAEPowerStorage;
import appeng.integration.modules.theoneprobe.TheOneProbeText;
import appeng.tile.AEBaseTile;
import appeng.util.Platform;
public class PowerStorageInfoProvider implements ITileProbInfoProvider
{
@Override
public void addProbeInfo( AEBaseTile tile, ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data )
{
if( tile instanceof IAEPowerStorage )
{
final IAEPowerStorage storage = (IAEPowerStorage) tile;
final double maxPower = storage.getAEMaxPower();
if( maxPower > 0 )
{
final long internalCurrentPower = (long) ( storage.getAECurrentPower() * 100 );
if( internalCurrentPower >= 0 )
{
final long internalMaxPower = (long) ( 100 * maxPower );
final String formatCurrentPower = Platform.formatPowerLong( internalCurrentPower, false );
final String formatMaxPower = Platform.formatPowerLong( internalMaxPower, false );
final String formattedString = String.format( TheOneProbeText.STORED_ENERGY.getLocal(), formatCurrentPower, formatMaxPower );
probeInfo.text( formattedString );
}
}
}
}
}
@@ -28,6 +28,7 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -1,3 +1,4 @@
package appeng.items.parts;
@@ -11,6 +12,7 @@ import java.util.List;
import net.minecraft.util.ResourceLocation;
import appeng.api.parts.IPartModel;
import appeng.core.AELog;
@@ -22,7 +24,7 @@ class PartModelsHelper
static List<ResourceLocation> createModels( Class<?> clazz )
{
List<ResourceLocation> locations = new ArrayList<>( );
List<ResourceLocation> locations = new ArrayList<>();
// Check all static fields for used models
Field[] fields = clazz.getDeclaredFields();
@@ -33,7 +35,6 @@ class PartModelsHelper
continue;
}
if( !Modifier.isStatic( field.getModifiers() ) )
{
AELog.error( "The @PartModels annotation can only be used on static fields or methods. Was seen on: " + field );
@@ -80,8 +81,8 @@ class PartModelsHelper
Class<?> returnType = method.getReturnType();
if( !ResourceLocation.class.isAssignableFrom( returnType ) && !Collection.class.isAssignableFrom( returnType ) )
{
AELog.error( "The @PartModels annotation can only be used on static methods that return a ResourceLocation or Collection of "
+ "ResourceLocations. Was seen on: " + method );
AELog.error(
"The @PartModels annotation can only be used on static methods that return a ResourceLocation or Collection of " + "ResourceLocations. Was seen on: " + method );
continue;
}
@@ -119,18 +120,23 @@ class PartModelsHelper
{
locations.add( (ResourceLocation) value );
}
else if( value instanceof IPartModel )
{
locations.addAll( ( (IPartModel) value ).getModels() );
}
else if( value instanceof Collection )
{
// Check that each object is a ResourceLocation
// Check that each object is an IPartModel
Collection values = (Collection) value;
for( Object candidate : values )
{
if ( !( candidate instanceof ResourceLocation )) {
if( !( candidate instanceof IPartModel ) )
{
AELog.error( "List of locations obtained from {} contains a non resource location: {}", source, candidate );
continue;
}
locations.add( (ResourceLocation) candidate );
locations.addAll( ( (IPartModel) candidate ).getModels() );
}
}
}
@@ -59,10 +59,10 @@ import appeng.parts.networking.PartCableGlass;
import appeng.parts.networking.PartCableSmart;
import appeng.parts.networking.PartDenseCable;
import appeng.parts.networking.PartQuartzFiber;
import appeng.parts.p2p.PartP2PFluids;
import appeng.parts.p2p.PartP2PIC2Power;
import appeng.parts.p2p.PartP2PItems;
import appeng.parts.p2p.PartP2PLight;
import appeng.parts.p2p.PartP2PLiquids;
import appeng.parts.p2p.PartP2PRedstone;
import appeng.parts.p2p.PartP2PTunnelME;
import appeng.parts.reporting.PartConversionMonitor;
@@ -226,8 +226,8 @@ public enum PartType
}
},
P2PTunnelLiquids( 463, "p2p_tunnel_liquids", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_LIQUIDS ), EnumSet
.noneOf( IntegrationType.class ), PartP2PLiquids.class, GuiText.FluidTunnel )
P2PTunnelFluids( 463, "p2p_tunnel_fluids", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_FLUIDS ), EnumSet
.noneOf( IntegrationType.class ), PartP2PFluids.class, GuiText.FluidTunnel )
{
@Override
String getUnlocalizedName()
@@ -27,6 +27,8 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang3.text.WordUtils;
import net.minecraft.block.Block;
import net.minecraft.block.BlockColored;
import net.minecraft.block.BlockStainedGlass;
@@ -62,8 +64,8 @@ import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.api.util.AEColor;
import appeng.api.util.DimensionalCoord;
import appeng.block.paint.BlockPaint;
import appeng.block.networking.BlockCableBus;
import appeng.block.paint.BlockPaint;
import appeng.core.AEConfig;
import appeng.core.localization.GuiText;
import appeng.helpers.IMouseWheelItem;
@@ -86,15 +88,13 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
static
{
for( final AEColor col : AEColor.values() )
for( final AEColor color : AEColor.VALID_COLORS )
{
if( col == AEColor.TRANSPARENT )
{
continue;
}
final String dyeName = color.dye.getUnlocalizedName();
final String oreDictName = "dye" + WordUtils.capitalize( dyeName );
final int oreDictId = OreDictionary.getOreID( oreDictName );
ORE_TO_COLOR.put( OreDictionary.getOreID( "dye" + col.name() ), col );
ORE_TO_COLOR.put( oreDictId, color );
}
}
@@ -277,7 +277,8 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
list.add( i );
}
Collections.sort( list, new Comparator<IAEItemStack>(){
Collections.sort( list, new Comparator<IAEItemStack>()
{
@Override
public int compare( final IAEItemStack a, final IAEItemStack b )
@@ -186,4 +186,10 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell,
{
return new PortableCellViewer( is, pos.getX() );
}
@Override
public boolean shouldCauseReequipAnimation( ItemStack oldStack, ItemStack newStack, boolean slotChanged )
{
return slotChanged;
}
}
@@ -150,4 +150,10 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
tag.setString( "encryptionKey", encKey );
tag.setString( "name", name );
}
@Override
public boolean shouldCauseReequipAnimation( ItemStack oldStack, ItemStack newStack, boolean slotChanged )
{
return slotChanged;
}
}
+3 -3
View File
@@ -21,8 +21,8 @@ package appeng.me;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
/**
@@ -31,7 +31,7 @@ import java.util.List;
public class NetworkList implements Collection<Grid>
{
private List<Grid> networks = new LinkedList<Grid>();
private List<Grid> networks = new CopyOnWriteArrayList<>();
@Override
public int size()
@@ -108,6 +108,6 @@ public class NetworkList implements Collection<Grid>
@Override
public void clear()
{
this.networks = new LinkedList<Grid>();
this.networks.clear();
}
}
+1 -1
View File
@@ -172,7 +172,7 @@ public class CraftingGridCache implements ICraftingGrid, ICraftingProviderHelper
final ICraftingWatcher craftingWatcher = this.craftingWatchers.get( machine );
if( craftingWatcher != null )
{
craftingWatcher.clear();
craftingWatcher.reset();
this.craftingWatchers.remove( machine );
}
}
+23 -15
View File
@@ -23,11 +23,12 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.NavigableSet;
import java.util.Set;
import java.util.TreeSet;
import com.google.common.collect.HashMultiset;
import com.google.common.collect.Multiset;
import com.google.common.collect.Sets;
import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable;
@@ -58,8 +59,8 @@ import appeng.me.energy.EnergyWatcher;
public class EnergyGridCache implements IEnergyGrid
{
private final TreeSet<EnergyThreshold> interests = new TreeSet<EnergyThreshold>();
private final double AvgLength = 40.0;
private final NavigableSet<EnergyThreshold> interests = Sets.newTreeSet();
private final double averageLength = 40.0;
private final Set<IAEPowerStorage> providers = new LinkedHashSet<IAEPowerStorage>();
private final Set<IAEPowerStorage> requesters = new LinkedHashSet<IAEPowerStorage>();
private final Multiset<IEnergyGridProvider> energyGridProviders = HashMultiset.create();
@@ -150,24 +151,25 @@ public class EnergyGridCache implements IEnergyGrid
@Override
public void onUpdateTick()
{
if( !this.getInterests().isEmpty() )
if( !this.interests.isEmpty() )
{
final double oldPower = this.lastStoredPower;
this.lastStoredPower = this.getStoredPower();
final EnergyThreshold low = new EnergyThreshold( Math.min( oldPower, this.lastStoredPower ), null );
final EnergyThreshold high = new EnergyThreshold( Math.max( oldPower, this.lastStoredPower ), null );
for( final EnergyThreshold th : this.getInterests().subSet( low, true, high, true ) )
final EnergyThreshold low = new EnergyThreshold( Math.min( oldPower, this.lastStoredPower ), Integer.MIN_VALUE );
final EnergyThreshold high = new EnergyThreshold( Math.max( oldPower, this.lastStoredPower ), Integer.MAX_VALUE );
for( final EnergyThreshold th : this.interests.subSet( low, true, high, true ) )
{
( (EnergyWatcher) th.getWatcher() ).post( this );
( (EnergyWatcher) th.getEnergyWatcher() ).post( this );
}
}
this.avgDrainPerTick *= ( this.AvgLength - 1 ) / this.AvgLength;
this.avgInjectionPerTick *= ( this.AvgLength - 1 ) / this.AvgLength;
this.avgDrainPerTick *= ( this.averageLength - 1 ) / this.averageLength;
this.avgInjectionPerTick *= ( this.averageLength - 1 ) / this.averageLength;
this.avgDrainPerTick += this.tickDrainPerTick / this.AvgLength;
this.avgInjectionPerTick += this.tickInjectionPerTick / this.AvgLength;
this.avgDrainPerTick += this.tickDrainPerTick / this.averageLength;
this.avgInjectionPerTick += this.tickInjectionPerTick / this.averageLength;
this.tickDrainPerTick = 0;
this.tickInjectionPerTick = 0;
@@ -554,7 +556,7 @@ public class EnergyGridCache implements IEnergyGrid
final IEnergyWatcher myWatcher = this.watchers.get( machine );
if( myWatcher != null )
{
myWatcher.clear();
myWatcher.reset();
this.watchers.remove( machine );
}
}
@@ -631,8 +633,14 @@ public class EnergyGridCache implements IEnergyGrid
storage.dataObject().setDouble( "extraEnergy", this.extra );
}
public TreeSet<EnergyThreshold> getInterests()
public boolean registerEnergyInterest( final EnergyThreshold threshold )
{
return this.interests;
return this.interests.add( threshold );
}
public boolean unregisterEnergyInterest( final EnergyThreshold threshold )
{
return this.interests.remove( threshold );
}
}
+1 -1
View File
@@ -102,7 +102,7 @@ public class GridStorageCache implements IStorageGrid
if( myWatcher != null )
{
myWatcher.clear();
myWatcher.reset();
this.watchers.remove( machine );
}
}
@@ -20,50 +20,98 @@ package appeng.me.energy;
import appeng.api.networking.energy.IEnergyWatcher;
import appeng.util.ItemSorters;
public class EnergyThreshold implements Comparable<EnergyThreshold>
{
private final double Limit;
private final double threshold;
private final IEnergyWatcher watcher;
private final int hash;
private final int watcherHash;
public EnergyThreshold( final double lim, final IEnergyWatcher wat )
public EnergyThreshold( final double lim, final IEnergyWatcher watcher )
{
this.Limit = lim;
this.watcher = wat;
this.threshold = lim;
this.watcher = watcher;
this.watcherHash = watcher.hashCode();
}
if( this.getWatcher() != null )
/**
* Special constructor to allow querying a for a subset of thresholds.
*
* @param lim
* @param bound
*/
public EnergyThreshold( final double lim, final int bound )
{
this.threshold = lim;
this.watcher = null;
this.watcherHash = bound;
}
public IEnergyWatcher getEnergyWatcher()
{
return watcher;
}
@Override
public int compareTo( EnergyThreshold o )
{
int a = Double.compare( this.threshold, o.threshold );
if( a == 0 )
{
this.hash = this.getWatcher().hashCode() ^ ( (Double) lim ).hashCode();
}
else
{
this.hash = ( (Double) lim ).hashCode();
return Integer.compare( this.watcherHash, o.watcherHash );
}
return a;
}
@Override
public int hashCode()
{
return this.hash;
final int prime = 31;
int result = 1;
long temp;
temp = Double.doubleToLongBits( threshold );
result = prime * result + (int) ( temp ^ ( temp >>> 32 ) );
result = prime * result + ( ( watcher == null ) ? 0 : watcher.hashCode() );
return result;
}
@Override
public int compareTo( final EnergyThreshold o )
public boolean equals( Object obj )
{
return ItemSorters.compareDouble( this.getLimit(), o.getLimit() );
}
if( this == obj )
{
return true;
}
if( obj == null )
{
return false;
}
if( getClass() != obj.getClass() )
{
return false;
}
double getLimit()
{
return this.Limit;
}
EnergyThreshold other = (EnergyThreshold) obj;
if( Double.doubleToLongBits( threshold ) != Double.doubleToLongBits( other.threshold ) )
{
return false;
}
public IEnergyWatcher getWatcher()
{
return this.watcher;
if( watcher == null )
{
if( other.watcher != null )
{
return false;
}
}
else if( !watcher.equals( other.watcher ) )
{
return false;
}
return true;
}
}
+19 -132
View File
@@ -19,9 +19,9 @@
package appeng.me.energy;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import appeng.api.networking.energy.IEnergyWatcher;
import appeng.api.networking.energy.IEnergyWatcherHost;
@@ -35,170 +35,57 @@ public class EnergyWatcher implements IEnergyWatcher
{
private final EnergyGridCache gsc;
private final IEnergyWatcherHost myObject;
private final HashSet<EnergyThreshold> myInterests = new HashSet<EnergyThreshold>();
private final IEnergyWatcherHost watcherHost;
private final Set<EnergyThreshold> myInterests = new HashSet<EnergyThreshold>();
public EnergyWatcher( final EnergyGridCache cache, final IEnergyWatcherHost host )
{
this.gsc = cache;
this.myObject = host;
this.watcherHost = host;
}
public void post( final EnergyGridCache energyGridCache )
{
this.myObject.onThresholdPass( energyGridCache );
this.watcherHost.onThresholdPass( energyGridCache );
}
public IEnergyWatcherHost getHost()
{
return this.myObject;
return this.watcherHost;
}
@Override
public int size()
public boolean add( final double amount )
{
return this.myInterests.size();
}
final EnergyThreshold eh = new EnergyThreshold( amount, this );
@Override
public boolean isEmpty()
{
return this.myInterests.isEmpty();
}
if( this.myInterests.contains( eh ) )
@Override
public boolean contains( final Object o )
{
return this.myInterests.contains( o );
}
@Override
public Iterator<Double> iterator()
{
return new EnergyWatcherIterator( this, this.myInterests.iterator() );
}
@Override
public Object[] toArray()
{
return this.myInterests.toArray();
}
@Override
public <T> T[] toArray( final T[] a )
{
return this.myInterests.toArray( a );
}
@Override
public boolean add( final Double e )
{
if( this.myInterests.contains( e ) )
{
return false;
}
final EnergyThreshold eh = new EnergyThreshold( e, this );
return this.gsc.getInterests().add( eh ) && this.myInterests.add( eh );
return this.gsc.registerEnergyInterest( eh ) && this.myInterests.add( eh );
}
@Override
public boolean remove( final Object o )
public boolean remove( final double amount )
{
final EnergyThreshold eh = new EnergyThreshold( (Double) o, this );
return this.myInterests.remove( eh ) && this.gsc.getInterests().remove( eh );
final EnergyThreshold eh = new EnergyThreshold( amount, this );
return this.myInterests.remove( eh ) && this.gsc.unregisterEnergyInterest( eh );
}
@Override
public boolean containsAll( final Collection<?> c )
public void reset()
{
return this.myInterests.containsAll( c );
}
@Override
public boolean addAll( final Collection<? extends Double> c )
{
boolean didChange = false;
for( final Double o : c )
for( Iterator<EnergyThreshold> iterator = myInterests.iterator(); iterator.hasNext(); )
{
didChange = this.add( o ) || didChange;
}
final EnergyThreshold threshold = iterator.next();
return didChange;
}
@Override
public boolean removeAll( final Collection<?> c )
{
boolean didSomething = false;
for( final Object o : c )
{
didSomething = this.remove( o ) || didSomething;
}
return didSomething;
}
@Override
public boolean retainAll( final Collection<?> c )
{
boolean changed = false;
final Iterator<Double> i = this.iterator();
while( i.hasNext() )
{
if( !c.contains( i.next() ) )
{
i.remove();
changed = true;
}
}
return changed;
}
@Override
public void clear()
{
final Iterator<EnergyThreshold> i = this.myInterests.iterator();
while( i.hasNext() )
{
this.gsc.getInterests().remove( i.next() );
i.remove();
this.gsc.unregisterEnergyInterest( threshold );
iterator.remove();
}
}
private class EnergyWatcherIterator implements Iterator<Double>
{
private final EnergyWatcher watcher;
private final Iterator<EnergyThreshold> interestIterator;
private EnergyThreshold myLast;
public EnergyWatcherIterator( final EnergyWatcher parent, final Iterator<EnergyThreshold> i )
{
this.watcher = parent;
this.interestIterator = i;
}
@Override
public boolean hasNext()
{
return this.interestIterator.hasNext();
}
@Override
public Double next()
{
this.myLast = this.interestIterator.next();
return this.myLast.getLimit();
}
@Override
public void remove()
{
EnergyWatcher.this.gsc.getInterests().remove( this.myLast );
this.interestIterator.remove();
}
}
}
@@ -19,9 +19,9 @@
package appeng.me.storage;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import appeng.api.networking.storage.IStackWatcher;
import appeng.api.networking.storage.IStackWatcherHost;
@@ -37,7 +37,7 @@ public class ItemWatcher implements IStackWatcher
private final GridStorageCache gsc;
private final IStackWatcherHost myObject;
private final HashSet<IAEStack> myInterests = new HashSet<IAEStack>();
private final Set<IAEStack> myInterests = new HashSet<IAEStack>();
public ItemWatcher( final GridStorageCache cache, final IStackWatcherHost host )
{
@@ -50,42 +50,6 @@ public class ItemWatcher implements IStackWatcher
return this.myObject;
}
@Override
public int size()
{
return this.myInterests.size();
}
@Override
public boolean isEmpty()
{
return this.myInterests.isEmpty();
}
@Override
public boolean contains( final Object o )
{
return this.myInterests.contains( o );
}
@Override
public Iterator<IAEStack> iterator()
{
return new ItemWatcherIterator( this, this.myInterests.iterator() );
}
@Override
public Object[] toArray()
{
return this.myInterests.toArray();
}
@Override
public <T> T[] toArray( final T[] a )
{
return this.myInterests.toArray( a );
}
@Override
public boolean add( final IAEStack e )
{
@@ -98,100 +62,20 @@ public class ItemWatcher implements IStackWatcher
}
@Override
public boolean remove( final Object o )
public boolean remove( final IAEStack o )
{
return this.myInterests.remove( o ) && this.gsc.getInterestManager().remove( (IAEStack) o, this );
}
@Override
public boolean containsAll( final Collection<?> c )
{
return this.myInterests.containsAll( c );
}
@Override
public boolean addAll( final Collection<? extends IAEStack> c )
{
boolean didChange = false;
for( final IAEStack o : c )
{
didChange = this.add( o ) || didChange;
}
return didChange;
}
@Override
public boolean removeAll( final Collection<?> c )
{
boolean didSomething = false;
for( final Object o : c )
{
didSomething = this.remove( o ) || didSomething;
}
return didSomething;
}
@Override
public boolean retainAll( final Collection<?> c )
{
boolean changed = false;
final Iterator<IAEStack> i = this.iterator();
while( i.hasNext() )
{
if( !c.contains( i.next() ) )
{
i.remove();
changed = true;
}
}
return changed;
}
@Override
public void clear()
public void reset()
{
final Iterator<IAEStack> i = this.myInterests.iterator();
while( i.hasNext() )
{
this.gsc.getInterestManager().remove( i.next(), this );
i.remove();
}
}
private class ItemWatcherIterator implements Iterator<IAEStack>
{
private final ItemWatcher watcher;
private final Iterator<IAEStack> interestIterator;
private IAEStack myLast;
public ItemWatcherIterator( final ItemWatcher parent, final Iterator<IAEStack> i )
{
this.watcher = parent;
this.interestIterator = i;
}
@Override
public boolean hasNext()
{
return this.interestIterator.hasNext();
}
@Override
public IAEStack next()
{
return this.myLast = this.interestIterator.next();
}
@Override
public void remove()
{
ItemWatcher.this.gsc.getInterestManager().remove( this.myLast, this.watcher );
this.interestIterator.remove();
}
}
}
@@ -25,6 +25,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Random;
import java.util.Set;
import javax.annotation.Nullable;
import io.netty.buffer.ByteBuf;
+80
View File
@@ -0,0 +1,80 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, 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.parts;
import java.util.List;
import com.google.common.collect.ImmutableList;
import net.minecraft.util.ResourceLocation;
import appeng.api.parts.IPartModel;
public class PartModel implements IPartModel
{
private final boolean isSolid;
private final List<ResourceLocation> resources;
public PartModel( ResourceLocation resource )
{
this( true, resource );
}
public PartModel( ResourceLocation... resources )
{
this( true, resources );
}
public PartModel( boolean isSolid, ResourceLocation resource )
{
this( isSolid, ImmutableList.of( resource ) );
}
public PartModel( boolean isSolid, ResourceLocation... resources )
{
this( isSolid, ImmutableList.copyOf( resources ) );
}
public PartModel( List<ResourceLocation> resources )
{
this( true, resources );
}
public PartModel( boolean isSolid, List<ResourceLocation> resources )
{
this.isSolid = isSolid;
this.resources = resources;
}
@Override
public boolean requireCableConnection()
{
return this.isSolid;
}
@Override
public List<ResourceLocation> getModels()
{
return this.resources;
}
}
@@ -31,7 +31,6 @@ import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -53,6 +52,7 @@ import appeng.api.networking.ticking.TickingRequest;
import appeng.api.parts.IPart;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartHost;
import appeng.api.parts.IPartModel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.util.AECableType;
import appeng.api.util.AEPartLocation;
@@ -74,7 +74,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
private static final PlaneModels MODELS = new PlaneModels( "part/annihilation_plane_", "part/annihilation_plane_on_" );
@PartModels
public static List<ResourceLocation> getModels()
public static List<IPartModel> getModels()
{
return MODELS.getModels();
}
@@ -233,8 +233,9 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
boolean capture = false;
final BlockPos pos = this.getTile().getPos();
// This is the middle point of the entities BB, which is better suited for comparisons that don't rely on it "touching" the plane
double posYMiddle = (entity.getEntityBoundingBox().minY + entity.getEntityBoundingBox().maxY) / 2.0D;
// This is the middle point of the entities BB, which is better suited for comparisons that don't rely on it
// "touching" the plane
double posYMiddle = ( entity.getEntityBoundingBox().minY + entity.getEntityBoundingBox().maxY ) / 2.0D;
switch( this.getSide() )
{
@@ -244,7 +245,8 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
{
if( entity.posZ > pos.getZ() && entity.posZ < pos.getZ() + 1 )
{
if( ( entity.posY > pos.getY() + 0.9 && this.getSide() == AEPartLocation.UP ) || ( entity.posY < pos.getY() + 0.1 && this.getSide() == AEPartLocation.DOWN ) )
if( ( entity.posY > pos.getY() + 0.9 && this.getSide() == AEPartLocation.UP ) || ( entity.posY < pos.getY() + 0.1 && this
.getSide() == AEPartLocation.DOWN ) )
{
capture = true;
}
@@ -257,7 +259,8 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
{
if( posYMiddle > pos.getY() && posYMiddle < pos.getY() + 1 )
{
if( ( entity.posZ > pos.getZ() + 0.9 && this.getSide() == AEPartLocation.SOUTH ) || ( entity.posZ < pos.getZ() + 0.1 && this.getSide() == AEPartLocation.NORTH ) )
if( ( entity.posZ > pos.getZ() + 0.9 && this.getSide() == AEPartLocation.SOUTH ) || ( entity.posZ < pos.getZ() + 0.1 && this
.getSide() == AEPartLocation.NORTH ) )
{
capture = true;
}
@@ -270,7 +273,8 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
{
if( posYMiddle > pos.getY() && posYMiddle < pos.getY() + 1 )
{
if( ( entity.posX > pos.getX() + 0.9 && this.getSide() == AEPartLocation.EAST ) || ( entity.posX < pos.getX() + 0.1 && this.getSide() == AEPartLocation.WEST ) )
if( ( entity.posX > pos.getX() + 0.9 && this.getSide() == AEPartLocation.EAST ) || ( entity.posX < pos.getX() + 0.1 && this
.getSide() == AEPartLocation.WEST ) )
{
capture = true;
}
@@ -288,7 +292,8 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
if( changed )
{
ServerHelper.proxy.sendToAllNearExcept( null, pos.getX(), pos.getY(), pos.getZ(), 64, this.getTile().getWorld(), new PacketTransitionEffect( entity.posX, entity.posY, entity.posZ, this.getSide(), false ) );
ServerHelper.proxy.sendToAllNearExcept( null, pos.getX(), pos.getY(), pos.getZ(), 64, this.getTile().getWorld(),
new PacketTransitionEffect( entity.posX, entity.posY, entity.posZ, this.getSide(), false ) );
}
}
}
@@ -452,7 +457,8 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
{
energy.extractAEPower( requiredPower, Actionable.MODULATE, PowerMultiplier.CONFIG );
this.breakBlockAndStoreItems( w, pos, items );
ServerHelper.proxy.sendToAllNearExcept( null, pos.getX(), pos.getY(), pos.getZ(), 64, w, new PacketTransitionEffect( pos.getX(), pos.getY(), pos.getZ(), this.getSide(), true ) );
ServerHelper.proxy.sendToAllNearExcept( null, pos.getX(), pos.getY(), pos.getZ(), 64, w,
new PacketTransitionEffect( pos.getX(), pos.getY(), pos.getZ(), this.getSide(), true ) );
}
else
{
@@ -500,9 +506,12 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
final Material material = state.getMaterial();
final float hardness = state.getBlockHardness( w, pos );
final boolean ignoreMaterials = material == Material.AIR || material == Material.LAVA || material == Material.WATER || material.isLiquid();
final boolean ignoreBlocks = state.getBlock() == Blocks.BEDROCK || state.getBlock() == Blocks.END_PORTAL || state.getBlock() == Blocks.END_PORTAL_FRAME || state.getBlock() == Blocks.COMMAND_BLOCK;
final boolean ignoreBlocks = state.getBlock() == Blocks.BEDROCK || state.getBlock() == Blocks.END_PORTAL || state
.getBlock() == Blocks.END_PORTAL_FRAME || state.getBlock() == Blocks.COMMAND_BLOCK;
return !ignoreMaterials && !ignoreBlocks && !w.isAirBlock( pos ) && w.isBlockLoaded( pos ) && w.canMineBlockBody( Platform.getPlayer( w ), pos ) && hardness >= 0f;
return !ignoreMaterials && !ignoreBlocks && hardness >= 0f && !w.isAirBlock( pos ) && w.isBlockLoaded( pos ) && w.canMineBlockBody(
Platform.getPlayer( w ),
pos );
}
protected List<ItemStack> obtainBlockDrops( final WorldServer w, final BlockPos pos )
@@ -568,7 +577,8 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
{
w.setBlockToAir( pos );
final AxisAlignedBB box = new AxisAlignedBB( pos.getX() - 0.2, pos.getY() - 0.2, pos.getZ() - 0.2, pos.getX() + 1.2, pos.getY() + 1.2, pos.getZ() + 1.2 );
final AxisAlignedBB box = new AxisAlignedBB( pos.getX() - 0.2, pos.getY() - 0.2, pos.getZ() - 0.2, pos.getX() + 1.2, pos.getY() + 1.2, pos
.getZ() + 1.2 );
for( final Object ei : w.getEntitiesWithinAABB( EntityItem.class, box ) )
{
if( ei instanceof EntityItem )
@@ -586,7 +596,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
}
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
return MODELS.getModel( getConnections(), isPowered(), isActive() );
}
@@ -19,8 +19,6 @@
package appeng.parts.automation;
import java.util.List;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
@@ -49,6 +47,7 @@ import appeng.api.networking.security.MachineSource;
import appeng.api.networking.ticking.TickRateModulation;
import appeng.api.networking.ticking.TickingRequest;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartModel;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.data.IAEItemStack;
@@ -61,6 +60,7 @@ import appeng.helpers.MultiCraftingTracker;
import appeng.helpers.Reflected;
import appeng.items.parts.PartModels;
import appeng.me.GridAccessException;
import appeng.parts.PartModel;
import appeng.util.InventoryAdaptor;
import appeng.util.Platform;
import appeng.util.item.AEItemStack;
@@ -70,22 +70,16 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
{
public static final ResourceLocation MODEL_BASE = new ResourceLocation( AppEng.MOD_ID, "part/export_bus_base" );
@PartModels
public static final List<ResourceLocation> MODELS_OFF = ImmutableList.of(
MODEL_BASE,
new ResourceLocation( AppEng.MOD_ID, "part/export_bus_off" )
);
public static final IPartModel MODELS_OFF = new PartModel( MODEL_BASE, new ResourceLocation( AppEng.MOD_ID, "part/export_bus_off" ) );
@PartModels
public static final List<ResourceLocation> MODELS_ON = ImmutableList.of(
MODEL_BASE,
new ResourceLocation( AppEng.MOD_ID, "part/export_bus_on" )
);
public static final IPartModel MODELS_ON = new PartModel( MODEL_BASE, new ResourceLocation( AppEng.MOD_ID, "part/export_bus_on" ) );
@PartModels
public static final List<ResourceLocation> MODELS_HAS_CHANNEL = ImmutableList.of(
MODEL_BASE,
new ResourceLocation( AppEng.MOD_ID, "part/export_bus_has_channel" )
);
public static final IPartModel MODELS_HAS_CHANNEL = new PartModel( MODEL_BASE, new ResourceLocation( AppEng.MOD_ID, "part/export_bus_has_channel" ) );
private final MultiCraftingTracker craftingTracker = new MultiCraftingTracker( this, 9 );
private final BaseActionSource mySrc;
private long itemToSend = 1;
@@ -154,7 +148,8 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
{
if( this.isCraftingEnabled() )
{
this.didSomething = this.craftingTracker.handleCrafting( slotToExport, this.itemToSend, ais, destination, this.getTile().getWorld(), this.getProxy().getGrid(), cg, this.mySrc ) || this.didSomething;
this.didSomething = this.craftingTracker.handleCrafting( slotToExport, this.itemToSend, ais, destination, this.getTile().getWorld(),
this.getProxy().getGrid(), cg, this.mySrc ) || this.didSomething;
}
continue;
}
@@ -179,7 +174,8 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
if( this.itemToSend == before && this.isCraftingEnabled() )
{
this.didSomething = this.craftingTracker.handleCrafting( slotToExport, this.itemToSend, ais, destination, this.getTile().getWorld(), this.getProxy().getGrid(), cg, this.mySrc ) || this.didSomething;
this.didSomething = this.craftingTracker.handleCrafting( slotToExport, this.itemToSend, ais, destination, this.getTile().getWorld(),
this.getProxy().getGrid(), cg, this.mySrc ) || this.didSomething;
}
}
@@ -362,7 +358,7 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
}
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
if( isActive() && isPowered() )
{
@@ -37,7 +37,6 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
@@ -62,6 +61,7 @@ import appeng.api.parts.IPart;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartHost;
import appeng.api.parts.IPartItem;
import appeng.api.parts.IPartModel;
import appeng.api.storage.ICellContainer;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.IMEInventoryHandler;
@@ -90,7 +90,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
private static final PlaneModels MODELS = new PlaneModels( "part/formation_plane_", "part/formation_plane_on_" );
@PartModels
public static List<ResourceLocation> getModels()
public static List<IPartModel> getModels()
{
return MODELS.getModels();
}
@@ -447,8 +447,9 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
if( w.getBlockState( tePos ).getBlock().isReplaceable( w, tePos ) )
{
if( placeBlock == YesNo.YES && ( i instanceof ItemBlock || i instanceof IPlantable || i instanceof ItemSkull || i instanceof ItemFirework || i instanceof IPartItem || i == Item.getItemFromBlock(
Blocks.REEDS ) ) )
if( placeBlock == YesNo.YES && ( i instanceof ItemBlock || i instanceof IPlantable || i instanceof ItemSkull || i instanceof ItemFirework || i instanceof IPartItem || i == Item
.getItemFromBlock(
Blocks.REEDS ) ) )
{
final EntityPlayer player = Platform.getPlayer( (WorldServer) w );
Platform.configurePlayer( player, side, this.getTile() );
@@ -614,7 +615,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
}
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
return MODELS.getModel( getConnections(), isPowered(), isActive() );
}
@@ -26,7 +26,6 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.util.FakePlayer;
@@ -34,6 +33,7 @@ import net.minecraftforge.common.util.FakePlayerFactory;
import appeng.api.parts.IPart;
import appeng.api.parts.IPartHost;
import appeng.api.parts.IPartModel;
import appeng.api.util.AEPartLocation;
import appeng.items.parts.PartModels;
@@ -44,7 +44,7 @@ public class PartIdentityAnnihilationPlane extends PartAnnihilationPlane
private static final PlaneModels MODELS = new PlaneModels( "part/identity_annihilation_plane_", "part/identity_annihilation_plane_on_" );
@PartModels
public static List<ResourceLocation> getModels()
public static List<IPartModel> getModels()
{
return MODELS.getModels();
}
@@ -105,7 +105,7 @@ public class PartIdentityAnnihilationPlane extends PartAnnihilationPlane
}
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
return MODELS.getModel( getConnections(), isPowered(), isActive() );
}
@@ -19,10 +19,6 @@
package appeng.parts.automation;
import java.util.List;
import com.google.common.collect.ImmutableList;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
@@ -44,6 +40,7 @@ import appeng.api.networking.security.MachineSource;
import appeng.api.networking.ticking.TickRateModulation;
import appeng.api.networking.ticking.TickingRequest;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartModel;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.data.IAEItemStack;
@@ -54,6 +51,7 @@ import appeng.core.sync.GuiBridge;
import appeng.helpers.Reflected;
import appeng.items.parts.PartModels;
import appeng.me.GridAccessException;
import appeng.parts.PartModel;
import appeng.util.InventoryAdaptor;
import appeng.util.Platform;
import appeng.util.inv.IInventoryDestination;
@@ -65,21 +63,12 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
public static final ResourceLocation MODEL_BASE = new ResourceLocation( AppEng.MOD_ID, "part/import_bus_base" );
@PartModels
public static final List<ResourceLocation> MODELS_OFF = ImmutableList.of(
MODEL_BASE,
new ResourceLocation( AppEng.MOD_ID, "part/import_bus_off" )
);
public static final IPartModel MODELS_OFF = new PartModel( MODEL_BASE, new ResourceLocation( AppEng.MOD_ID, "part/import_bus_off" ) );
@PartModels
public static final List<ResourceLocation> MODELS_ON = ImmutableList.of(
MODEL_BASE,
new ResourceLocation( AppEng.MOD_ID, "part/import_bus_on" )
);
public static final IPartModel MODELS_ON = new PartModel( MODEL_BASE, new ResourceLocation( AppEng.MOD_ID, "part/import_bus_on" ) );
@PartModels
public static final List<ResourceLocation> MODELS_HAS_CHANNEL = ImmutableList.of(
MODEL_BASE,
new ResourceLocation( AppEng.MOD_ID, "part/import_bus_has_channel" )
);
public static final IPartModel MODELS_HAS_CHANNEL = new PartModel( MODEL_BASE, new ResourceLocation( AppEng.MOD_ID, "part/import_bus_has_channel" ) );
private final BaseActionSource source;
private IMEInventory<IAEItemStack> destination = null;
private IAEItemStack lastItemChecked = null;
@@ -104,7 +93,8 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
return false;
}
final IAEItemStack out = this.destination.injectItems( this.lastItemChecked = AEApi.instance().storage().createItemStack( stack ), Actionable.SIMULATE, this.source );
final IAEItemStack out = this.destination.injectItems( this.lastItemChecked = AEApi.instance().storage().createItemStack( stack ), Actionable.SIMULATE,
this.source );
if( out == null )
{
return true;
@@ -173,7 +163,8 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
try
{
this.itemToSend = this.calculateItemsToSend();
this.itemToSend = Math.min( this.itemToSend, (int) ( 0.01 + this.getProxy().getEnergy().extractAEPower( this.itemToSend, Actionable.SIMULATE, PowerMultiplier.CONFIG ) ) );
this.itemToSend = Math.min( this.itemToSend,
(int) ( 0.01 + this.getProxy().getEnergy().extractAEPower( this.itemToSend, Actionable.SIMULATE, PowerMultiplier.CONFIG ) ) );
final IMEMonitor<IAEItemStack> inv = this.getProxy().getStorage().getItemInventory();
final IEnergyGrid energy = this.getProxy().getEnergy();
@@ -235,7 +226,8 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
if( newItems != null )
{
newItems.stackSize = (int) ( Math.min( newItems.stackSize, energy.extractAEPower( newItems.stackSize, Actionable.SIMULATE, PowerMultiplier.CONFIG ) ) + 0.01 );
newItems.stackSize = (int) ( Math.min( newItems.stackSize,
energy.extractAEPower( newItems.stackSize, Actionable.SIMULATE, PowerMultiplier.CONFIG ) ) + 0.01 );
this.itemToSend -= newItems.stackSize;
if( this.lastItemChecked == null || !this.lastItemChecked.isSameType( newItems ) )
@@ -321,7 +313,7 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
}
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
if( isActive() && isPowered() )
{
@@ -20,11 +20,8 @@ package appeng.parts.automation;
import java.util.Collection;
import java.util.List;
import java.util.Random;
import com.google.common.collect.ImmutableList;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryCrafting;
@@ -62,6 +59,7 @@ import appeng.api.networking.storage.IBaseMonitor;
import appeng.api.networking.storage.IStackWatcher;
import appeng.api.networking.storage.IStackWatcherHost;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartModel;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.IMEMonitorHandlerReceiver;
import appeng.api.storage.StorageChannel;
@@ -76,6 +74,7 @@ import appeng.core.sync.GuiBridge;
import appeng.helpers.Reflected;
import appeng.items.parts.PartModels;
import appeng.me.GridAccessException;
import appeng.parts.PartModel;
import appeng.tile.inventory.AppEngInternalAEInventory;
import appeng.tile.inventory.InvOperation;
import appeng.util.Platform;
@@ -95,12 +94,12 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
@PartModels
public static final ResourceLocation MODEL_STATUS_HAS_CHANNEL = new ResourceLocation( AppEng.MOD_ID, "part/level_emitter_status_has_channel" );
public static final List<ResourceLocation> MODEL_OFF_OFF = ImmutableList.of( MODEL_BASE_OFF, MODEL_STATUS_OFF );
public static final List<ResourceLocation> MODEL_OFF_ON = ImmutableList.of( MODEL_BASE_OFF, MODEL_STATUS_ON );
public static final List<ResourceLocation> MODEL_OFF_HAS_CHANNEL = ImmutableList.of( MODEL_BASE_OFF, MODEL_STATUS_HAS_CHANNEL );
public static final List<ResourceLocation> MODEL_ON_OFF = ImmutableList.of( MODEL_BASE_ON, MODEL_STATUS_OFF );
public static final List<ResourceLocation> MODEL_ON_ON = ImmutableList.of( MODEL_BASE_ON, MODEL_STATUS_ON );
public static final List<ResourceLocation> MODEL_ON_HAS_CHANNEL = ImmutableList.of( MODEL_BASE_ON, MODEL_STATUS_HAS_CHANNEL );
public static final PartModel MODEL_OFF_OFF = new PartModel( MODEL_BASE_OFF, MODEL_STATUS_OFF );
public static final PartModel MODEL_OFF_ON = new PartModel( MODEL_BASE_OFF, MODEL_STATUS_ON );
public static final PartModel MODEL_OFF_HAS_CHANNEL = new PartModel( MODEL_BASE_OFF, MODEL_STATUS_HAS_CHANNEL );
public static final PartModel MODEL_ON_OFF = new PartModel( MODEL_BASE_ON, MODEL_STATUS_OFF );
public static final PartModel MODEL_ON_ON = new PartModel( MODEL_BASE_ON, MODEL_STATUS_ON );
public static final PartModel MODEL_ON_HAS_CHANNEL = new PartModel( MODEL_BASE_ON, MODEL_STATUS_HAS_CHANNEL );
private static final int FLAG_ON = 4;
@@ -229,17 +228,17 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
if( this.myWatcher != null )
{
this.myWatcher.clear();
this.myWatcher.reset();
}
if( this.myEnergyWatcher != null )
{
this.myEnergyWatcher.clear();
this.myEnergyWatcher.reset();
}
if( this.myCraftingWatcher != null )
{
this.myCraftingWatcher.clear();
this.myCraftingWatcher.reset();
}
try
@@ -445,7 +444,8 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
final double d1 = d.yOffset * 0.45F + ( r.nextFloat() - 0.5F ) * 0.2D;
final double d2 = d.zOffset * 0.45F + ( r.nextFloat() - 0.5F ) * 0.2D;
world.spawnParticle( EnumParticleTypes.REDSTONE, 0.5 + pos.getX() + d0, 0.5 + pos.getY() + d1, 0.5 + pos.getZ() + d2, 0.0D, 0.0D, 0.0D, new int[0] );
world.spawnParticle( EnumParticleTypes.REDSTONE, 0.5 + pos.getX() + d0, 0.5 + pos.getY() + d1, 0.5 + pos.getZ() + d2, 0.0D, 0.0D, 0.0D,
new int[0] );
}
}
@@ -561,7 +561,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
}
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
if( isActive() && isPowered() )
{
@@ -24,12 +24,13 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import net.minecraft.util.ResourceLocation;
import appeng.api.parts.IPartModel;
import appeng.core.AppEng;
import appeng.parts.PartModel;
/**
@@ -42,26 +43,26 @@ class PlaneModels
public static final ResourceLocation MODEL_CHASSIS_ON = new ResourceLocation( AppEng.MOD_ID, "part/transition_plane_on" );
public static final ResourceLocation MODEL_CHASSIS_HAS_CHANNEL = new ResourceLocation( AppEng.MOD_ID, "part/transition_plane_has_channel" );
private final Map<PlaneConnections, List<ResourceLocation>> modelsOff;
private final Map<PlaneConnections, IPartModel> modelsOff;
private final Map<PlaneConnections, List<ResourceLocation>> modelsOn;
private final Map<PlaneConnections, IPartModel> modelsOn;
private final Map<PlaneConnections, List<ResourceLocation>> modelsHasChannel;
private final Map<PlaneConnections, IPartModel> modelsHasChannel;
public PlaneModels( String prefixOff, String prefixOn )
{
Map<PlaneConnections, List<ResourceLocation>> modelsOff = new HashMap<>();
Map<PlaneConnections, List<ResourceLocation>> modelsOn = new HashMap<>();
Map<PlaneConnections, List<ResourceLocation>> modelsHasChannel = new HashMap<>();
Map<PlaneConnections, IPartModel> modelsOff = new HashMap<>();
Map<PlaneConnections, IPartModel> modelsOn = new HashMap<>();
Map<PlaneConnections, IPartModel> modelsHasChannel = new HashMap<>();
for( PlaneConnections permutation : PlaneConnections.PERMUTATIONS )
{
ResourceLocation planeOff = new ResourceLocation( AppEng.MOD_ID, prefixOff + permutation.getFilenameSuffix() );
ResourceLocation planeOn = new ResourceLocation( AppEng.MOD_ID, prefixOn + permutation.getFilenameSuffix() );
modelsOff.put( permutation, ImmutableList.of( MODEL_CHASSIS_OFF, planeOff ) );
modelsOn.put( permutation, ImmutableList.of( MODEL_CHASSIS_ON, planeOff ) );
modelsHasChannel.put( permutation, ImmutableList.of( MODEL_CHASSIS_HAS_CHANNEL, planeOn ) );
modelsOff.put( permutation, new PartModel( MODEL_CHASSIS_OFF, planeOff ) );
modelsOn.put( permutation, new PartModel( MODEL_CHASSIS_ON, planeOff ) );
modelsHasChannel.put( permutation, new PartModel( MODEL_CHASSIS_HAS_CHANNEL, planeOn ) );
}
this.modelsOff = ImmutableMap.copyOf( modelsOff );
@@ -69,7 +70,7 @@ class PlaneModels
this.modelsHasChannel = ImmutableMap.copyOf( modelsHasChannel );
}
public List<ResourceLocation> getModel( PlaneConnections connections, boolean hasPower, boolean hasChannel )
public IPartModel getModel( PlaneConnections connections, boolean hasPower, boolean hasChannel )
{
if( hasPower && hasChannel )
{
@@ -85,12 +86,12 @@ class PlaneModels
}
}
public List<ResourceLocation> getModels()
public List<IPartModel> getModels()
{
List<ResourceLocation> result = new ArrayList<>();
modelsOff.values().forEach( result::addAll );
modelsOn.values().forEach( result::addAll );
modelsHasChannel.values().forEach( result::addAll );
List<IPartModel> result = new ArrayList<>();
modelsOff.values().forEach( result::add );
modelsOn.values().forEach( result::add );
modelsHasChannel.values().forEach( result::add );
return result;
}
@@ -117,7 +117,8 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
}
ItemStack extracted;
int remainingCurrentSlot = Math.min( remainingSize, stackInInventorySlot.stackSize );
int stackSizeCurrentSlot = stackInInventorySlot.stackSize;
int remainingCurrentSlot = Math.min( remainingSize, stackSizeCurrentSlot );
// We have to loop here because according to the docs, the handler shouldn't return a stack with size >
// maxSize, even if we request more. So even if it returns a valid stack, it might have more stuff.
@@ -149,7 +150,7 @@ class ItemHandlerAdapter implements IMEInventory<IAEItemStack>, IBaseMonitor<IAE
}
while( extracted != null && remainingCurrentSlot > 0 );
remainingSize -= stackInInventorySlot.stackSize - remainingCurrentSlot;
remainingSize -= stackSizeCurrentSlot - remainingCurrentSlot;
// Done?
if( remainingSize <= 0 )
@@ -23,8 +23,6 @@ import java.io.IOException;
import java.util.List;
import java.util.Random;
import com.google.common.collect.ImmutableList;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.Entity;
@@ -44,18 +42,23 @@ import appeng.api.parts.BusSupport;
import appeng.api.parts.IPart;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartHost;
import appeng.api.parts.IPartModel;
import appeng.api.parts.PartItemStack;
import appeng.api.util.AECableType;
import appeng.api.util.AEPartLocation;
import appeng.core.AppEng;
import appeng.items.parts.PartModels;
import appeng.parts.PartModel;
public class PartCableAnchor implements IPart
{
@PartModels
public static final List<ResourceLocation> MODELS = ImmutableList.of( new ResourceLocation( AppEng.MOD_ID, "part/cable_anchor" ) );
public static final PartModel DEFAULT_MODELS = new PartModel( false, new ResourceLocation( AppEng.MOD_ID, "part/cable_anchor" ) );
@PartModels
public static final PartModel FACADE_MODELS = new PartModel( false, new ResourceLocation( AppEng.MOD_ID, "part/cable_anchor_short" ) );
private ItemStack is = null;
private IPartHost host = null;
@@ -237,9 +240,16 @@ public class PartCableAnchor implements IPart
}
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
return MODELS;
if( this.host != null && this.host.getFacadeContainer().getFacade( this.mySide ) != null )
{
return FACADE_MODELS;
}
else
{
return DEFAULT_MODELS;
}
}
}
@@ -22,7 +22,6 @@ package appeng.parts.misc;
import java.util.EnumSet;
import java.util.List;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import net.minecraft.entity.player.EntityPlayer;
@@ -52,6 +51,7 @@ import appeng.api.networking.ticking.IGridTickable;
import appeng.api.networking.ticking.TickRateModulation;
import appeng.api.networking.ticking.TickingRequest;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartModel;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.IStorageMonitorable;
import appeng.api.storage.data.IAEFluidStack;
@@ -66,6 +66,7 @@ import appeng.helpers.IPriorityHost;
import appeng.helpers.Reflected;
import appeng.items.parts.PartModels;
import appeng.parts.PartBasicState;
import appeng.parts.PartModel;
import appeng.tile.inventory.IAEAppEngInventory;
import appeng.tile.inventory.InvOperation;
import appeng.util.Platform;
@@ -76,21 +77,15 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
{
public static final ResourceLocation MODEL_BASE = new ResourceLocation( AppEng.MOD_ID, "part/interface_base" );
@PartModels
public static final List<ResourceLocation> MODELS_OFF = ImmutableList.of(
MODEL_BASE,
new ResourceLocation( AppEng.MOD_ID, "part/interface_off" )
);
public static final PartModel MODELS_OFF = new PartModel( MODEL_BASE, new ResourceLocation( AppEng.MOD_ID, "part/interface_off" ) );
@PartModels
public static final List<ResourceLocation> MODELS_ON = ImmutableList.of(
MODEL_BASE,
new ResourceLocation( AppEng.MOD_ID, "part/interface_on" )
);
public static final PartModel MODELS_ON = new PartModel( MODEL_BASE, new ResourceLocation( AppEng.MOD_ID, "part/interface_on" ) );
@PartModels
public static final List<ResourceLocation> MODELS_HAS_CHANNEL = ImmutableList.of(
MODEL_BASE,
new ResourceLocation( AppEng.MOD_ID, "part/interface_has_channel" )
);
public static final PartModel MODELS_HAS_CHANNEL = new PartModel( MODEL_BASE, new ResourceLocation( AppEng.MOD_ID, "part/interface_has_channel" ) );
private final DualityInterface duality = new DualityInterface( this.getProxy(), this );
@@ -421,7 +416,7 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
}
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
if( isActive() && isPowered() )
{
@@ -19,16 +19,14 @@
package appeng.parts.misc;
import java.util.List;
import com.google.common.collect.ImmutableList;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import appeng.api.parts.IPartModel;
import appeng.core.AppEng;
import appeng.helpers.Reflected;
import appeng.items.parts.PartModels;
import appeng.parts.PartModel;
public class PartInvertedToggleBus extends PartToggleBus
@@ -36,9 +34,9 @@ public class PartInvertedToggleBus extends PartToggleBus
@PartModels
public static final ResourceLocation MODEL_BASE = new ResourceLocation( AppEng.MOD_ID, "part/inverted_toggle_bus_base" );
public static final List<ResourceLocation> MODELS_OFF = ImmutableList.of(MODEL_BASE, MODEL_STATUS_OFF);
public static final List<ResourceLocation> MODELS_ON = ImmutableList.of(MODEL_BASE, MODEL_STATUS_ON);
public static final List<ResourceLocation> MODELS_HAS_CHANNEL = ImmutableList.of(MODEL_BASE, MODEL_STATUS_HAS_CHANNEL);
public static final PartModel MODELS_OFF = new PartModel( MODEL_BASE, MODEL_STATUS_OFF );
public static final PartModel MODELS_ON = new PartModel( MODEL_BASE, MODEL_STATUS_ON );
public static final PartModel MODELS_HAS_CHANNEL = new PartModel( MODEL_BASE, MODEL_STATUS_HAS_CHANNEL );
@Reflected
public PartInvertedToggleBus( final ItemStack is )
@@ -57,7 +55,7 @@ public class PartInvertedToggleBus extends PartToggleBus
}
@Override
public List<ResourceLocation> getStaticModels()
public IPartModel getStaticModels()
{
if( hasRedstoneFlag() && isActive() && isPowered() )
{

Some files were not shown because too many files have changed in this diff Show More