Part models
This commit is contained in:
@@ -23,7 +23,9 @@ import java.util.List;
|
||||
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.block.misc.BlockLightDetector;
|
||||
import appeng.block.misc.BlockSkyCompass;
|
||||
import appeng.block.networking.BlockWireless;
|
||||
import appeng.me.helpers.IGridProxyable;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import net.minecraft.block.Block;
|
||||
@@ -89,19 +91,19 @@ public class AEBaseBlockItem extends BlockItem
|
||||
|
||||
if( this.blockType instanceof AEBaseTileBlock )
|
||||
{
|
||||
// FIXME if( this.blockType instanceof BlockLightDetector )
|
||||
// FIXME {
|
||||
// FIXME up = side;
|
||||
// FIXME if( up == Direction.UP || up == Direction.DOWN )
|
||||
// FIXME {
|
||||
// FIXME forward = Direction.SOUTH;
|
||||
// FIXME }
|
||||
// FIXME else
|
||||
// FIXME {
|
||||
// FIXME forward = Direction.UP;
|
||||
// FIXME }
|
||||
// FIXME }
|
||||
/* FIXME else */ if( /*this.blockType instanceof BlockWireless ||*/ this.blockType instanceof BlockSkyCompass)
|
||||
if( this.blockType instanceof BlockLightDetector)
|
||||
{
|
||||
up = side;
|
||||
if( up == Direction.UP || up == Direction.DOWN )
|
||||
{
|
||||
forward = Direction.SOUTH;
|
||||
}
|
||||
else
|
||||
{
|
||||
forward = Direction.UP;
|
||||
}
|
||||
}
|
||||
else if( this.blockType instanceof BlockWireless || this.blockType instanceof BlockSkyCompass)
|
||||
{
|
||||
forward = side;
|
||||
if( forward == Direction.UP || forward == Direction.DOWN )
|
||||
@@ -116,36 +118,16 @@ public class AEBaseBlockItem extends BlockItem
|
||||
else
|
||||
{
|
||||
up = Direction.UP;
|
||||
forward = context.getPlacementHorizontalFacing();
|
||||
|
||||
// FIXME: investigate placementYaw
|
||||
final byte rotation = (byte) ( MathHelper.floor( ( player.rotationYaw * 4F ) / 360F + 2.5D ) & 3 );
|
||||
|
||||
switch( rotation )
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
forward = Direction.SOUTH;
|
||||
break;
|
||||
case 1:
|
||||
forward = Direction.WEST;
|
||||
break;
|
||||
case 2:
|
||||
forward = Direction.NORTH;
|
||||
break;
|
||||
case 3:
|
||||
forward = Direction.EAST;
|
||||
break;
|
||||
}
|
||||
|
||||
if( player.rotationPitch > 65 )
|
||||
{
|
||||
up = forward.getOpposite();
|
||||
forward = Direction.UP;
|
||||
}
|
||||
else if( player.rotationPitch < -65 )
|
||||
{
|
||||
up = forward.getOpposite();
|
||||
forward = Direction.DOWN;
|
||||
if (player != null) {
|
||||
if (player.rotationPitch > 65) {
|
||||
up = forward.getOpposite();
|
||||
forward = Direction.UP;
|
||||
} else if (player.rotationPitch < -65) {
|
||||
up = forward.getOpposite();
|
||||
forward = Direction.DOWN;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -172,7 +154,7 @@ public class AEBaseBlockItem extends BlockItem
|
||||
return result;
|
||||
}
|
||||
|
||||
if( this.blockType instanceof AEBaseTileBlock /* FIXME && !( this.blockType instanceof BlockLightDetector ) */ )
|
||||
if( this.blockType instanceof AEBaseTileBlock && !( this.blockType instanceof BlockLightDetector ) )
|
||||
{
|
||||
final AEBaseTile tile = ( (AEBaseTileBlock<?>) this.blockType ).getTileEntity( context.getWorld(), context.getPos() );
|
||||
ori = tile;
|
||||
|
||||
@@ -19,52 +19,42 @@
|
||||
package appeng.block;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import appeng.block.networking.BlockCableBus;
|
||||
import appeng.client.render.FacingToRotation;
|
||||
import appeng.tile.networking.TileCableBus;
|
||||
import appeng.tile.storage.TileSkyChest;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.DyeColor;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.state.EnumProperty;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.data.ModelProperty;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
|
||||
import appeng.api.implementations.items.IMemoryCard;
|
||||
import appeng.api.implementations.items.MemoryCardMessages;
|
||||
import appeng.api.implementations.tiles.IColorableTile;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.block.networking.BlockCableBus;
|
||||
import appeng.tile.AEBaseInvTile;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.networking.TileCableBus;
|
||||
import appeng.tile.storage.TileSkyChest;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.SettingsFrom;
|
||||
import com.google.common.collect.Lists;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.DyeColor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public abstract class AEBaseTileBlock<T extends AEBaseTile> extends AEBaseBlock
|
||||
{
|
||||
|
||||
@@ -51,6 +51,7 @@ import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.item.DyeColor;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.state.BooleanProperty;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
@@ -74,22 +75,12 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
|
||||
public class BlockCableBus extends AEBaseTileBlock<TileCableBus> /* FIXME implements IAEFacade */
|
||||
{
|
||||
public class BlockCableBus extends AEBaseTileBlock<TileCableBus> /* FIXME implements IAEFacade */ {
|
||||
|
||||
private static final ICableBusContainer NULL_CABLE_BUS = new NullCableBusContainer();
|
||||
|
||||
private static Class<? extends AEBaseTile> noTesrTile;
|
||||
|
||||
private static Class<? extends AEBaseTile> tesrTile;
|
||||
|
||||
public BlockCableBus()
|
||||
{
|
||||
super( Properties.create(AEGlassMaterial.INSTANCE).notSolid() );
|
||||
|
||||
// this will actually be overwritten later through setupTile and the
|
||||
// combined layers
|
||||
// FIXME ...uh this.setTileEntity( TileCableBus.class, TileCableBus::new );
|
||||
public BlockCableBus() {
|
||||
super(Properties.create(AEGlassMaterial.INSTANCE).notSolid());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -98,56 +89,50 @@ public class BlockCableBus extends AEBaseTileBlock<TileCableBus> /* FIXME implem
|
||||
}
|
||||
|
||||
@Override
|
||||
public void animateTick( final BlockState state, final World worldIn, final BlockPos pos, final Random rand )
|
||||
{
|
||||
this.cb( worldIn, pos ).animateTick( worldIn, pos, rand );
|
||||
public void animateTick(final BlockState state, final World worldIn, final BlockPos pos, final Random rand) {
|
||||
this.cb(worldIn, pos).animateTick(worldIn, pos, rand);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborChange(BlockState state, IWorldReader w, BlockPos pos, BlockPos neighbor) {
|
||||
this.cb( w, pos ).onNeighborChanged( w, pos, neighbor );
|
||||
this.cb(w, pos).onNeighborChanged(w, pos, neighbor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWeakPower( final BlockState state, final IBlockReader w, final BlockPos pos, final Direction side )
|
||||
{
|
||||
return this.cb( w, pos ).isProvidingWeakPower( side.getOpposite() ); // TODO:
|
||||
public int getWeakPower(final BlockState state, final IBlockReader w, final BlockPos pos, final Direction side) {
|
||||
return this.cb(w, pos).isProvidingWeakPower(side.getOpposite()); // TODO:
|
||||
// IS
|
||||
// OPPOSITE!?
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canProvidePower( final BlockState state )
|
||||
{
|
||||
public boolean canProvidePower(final BlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollision(BlockState state, World w, BlockPos pos, Entity entityIn) {
|
||||
this.cb( w, pos ).onEntityCollision( entityIn );
|
||||
this.cb(w, pos).onEntityCollision(entityIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStrongPower( final BlockState state, final IBlockReader w, final BlockPos pos, final Direction side )
|
||||
{
|
||||
return this.cb( w, pos ).isProvidingStrongPower( side.getOpposite() ); // TODO:
|
||||
public int getStrongPower(final BlockState state, final IBlockReader w, final BlockPos pos, final Direction side) {
|
||||
return this.cb(w, pos).isProvidingStrongPower(side.getOpposite()); // TODO:
|
||||
// IS
|
||||
// OPPOSITE!?
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLightValue( final BlockState state, final IBlockReader world, final BlockPos pos )
|
||||
{
|
||||
if( state.getBlock() != this )
|
||||
{
|
||||
return state.getBlock().getLightValue( state, world, pos );
|
||||
public int getLightValue(final BlockState state, final IBlockReader world, final BlockPos pos) {
|
||||
if (state.getBlock() != this) {
|
||||
return state.getBlock().getLightValue(state, world, pos);
|
||||
}
|
||||
return this.cb( world, pos ).getLightValue();
|
||||
return this.cb(world, pos).getLightValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLadder(BlockState state, IWorldReader world, BlockPos pos, LivingEntity entity) {
|
||||
return this.cb( world, pos ).isLadder( entity );
|
||||
return this.cb(world, pos).isLadder(entity);
|
||||
}
|
||||
|
||||
// FIXME: This is now derived from the collision shape, and cannot be decided programatically anymore.
|
||||
@@ -162,45 +147,38 @@ public class BlockCableBus extends AEBaseTileBlock<TileCableBus> /* FIXME implem
|
||||
@Override
|
||||
public boolean isReplaceable(BlockState state, BlockItemUseContext useContext) {
|
||||
// FIXME: Potentially check the fluid one too
|
||||
return super.isReplaceable(state, useContext) && this.cb( useContext.getWorld(), useContext.getPos() ).isEmpty();
|
||||
return super.isReplaceable(state, useContext) && this.cb(useContext.getWorld(), useContext.getPos()).isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(BlockState state, World world, BlockPos pos, PlayerEntity player, boolean willHarvest, IFluidState fluid) {
|
||||
if( player.abilities.isCreativeMode )
|
||||
{
|
||||
final AEBaseTile tile = this.getTileEntity( world, pos );
|
||||
if( tile != null )
|
||||
{
|
||||
if (player.abilities.isCreativeMode) {
|
||||
final AEBaseTile tile = this.getTileEntity(world, pos);
|
||||
if (tile != null) {
|
||||
tile.disableDrops();
|
||||
}
|
||||
// maybe ray trace?
|
||||
}
|
||||
return super.removedByPlayer( state, world, pos, player, willHarvest, fluid );
|
||||
return super.removedByPlayer(state, world, pos, player, willHarvest, fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectRedstone( final BlockState state, final IBlockReader w, final BlockPos pos, Direction side )
|
||||
{
|
||||
if( side == null )
|
||||
{
|
||||
public boolean canConnectRedstone(final BlockState state, final IBlockReader w, final BlockPos pos, Direction side) {
|
||||
if (side == null) {
|
||||
side = Direction.UP;
|
||||
}
|
||||
|
||||
return this.cb( w, pos ).canConnectRedstone( EnumSet.of( side ) );
|
||||
return this.cb(w, pos).canConnectRedstone(EnumSet.of(side));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(BlockState state, RayTraceResult target, IBlockReader world, BlockPos pos, PlayerEntity player) {
|
||||
final Vec3d v3 = target.getHitVec().subtract( pos.getX(), pos.getY(), pos.getZ() );
|
||||
final SelectedPart sp = this.cb( world, pos ).selectPart( v3 );
|
||||
final Vec3d v3 = target.getHitVec().subtract(pos.getX(), pos.getY(), pos.getZ());
|
||||
final SelectedPart sp = this.cb(world, pos).selectPart(v3);
|
||||
|
||||
if( sp.part != null )
|
||||
{
|
||||
return sp.part.getItemStack( PartItemStack.PICK );
|
||||
}
|
||||
else if( sp.facade != null )
|
||||
{
|
||||
if (sp.part != null) {
|
||||
return sp.part.getItemStack(PartItemStack.PICK);
|
||||
} else if (sp.facade != null) {
|
||||
return sp.facade.getItemStack();
|
||||
}
|
||||
|
||||
@@ -208,14 +186,12 @@ public class BlockCableBus extends AEBaseTileBlock<TileCableBus> /* FIXME implem
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public boolean addHitEffects( final BlockState state, final World world, final RayTraceResult target, final ParticleManager effectRenderer )
|
||||
{
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public boolean addHitEffects(final BlockState state, final World world, final RayTraceResult target, final ParticleManager effectRenderer) {
|
||||
|
||||
// Half the particle rate. Since we're spawning concentrated on a specific spot,
|
||||
// our particle effect otherwise looks too strong
|
||||
if( Platform.getRandom().nextBoolean() )
|
||||
{
|
||||
if (Platform.getRandom().nextBoolean()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -224,14 +200,13 @@ public class BlockCableBus extends AEBaseTileBlock<TileCableBus> /* FIXME implem
|
||||
}
|
||||
BlockPos blockPos = new BlockPos(target.getHitVec().x, target.getHitVec().y, target.getHitVec().z);
|
||||
|
||||
ICableBusContainer cb = this.cb( world, blockPos );
|
||||
ICableBusContainer cb = this.cb(world, blockPos);
|
||||
|
||||
// Our built-in model has the actual baked sprites we need
|
||||
IBakedModel model = Minecraft.getInstance().getBlockRendererDispatcher().getModelForState( this.getDefaultState() );
|
||||
IBakedModel model = Minecraft.getInstance().getBlockRendererDispatcher().getModelForState(this.getDefaultState());
|
||||
|
||||
// We cannot add the effect if we don't have the model
|
||||
if( !( model instanceof CableBusBakedModel ) )
|
||||
{
|
||||
if (!(model instanceof CableBusBakedModel)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -240,15 +215,14 @@ public class BlockCableBus extends AEBaseTileBlock<TileCableBus> /* FIXME implem
|
||||
CableBusRenderState renderState = cb.getRenderState();
|
||||
|
||||
// Spawn a particle for one of the particle textures
|
||||
TextureAtlasSprite texture = Platform.pickRandom( cableBusModel.getParticleTextures( renderState ) );
|
||||
if( texture != null )
|
||||
{
|
||||
TextureAtlasSprite texture = Platform.pickRandom(cableBusModel.getParticleTextures(renderState));
|
||||
if (texture != null) {
|
||||
double x = target.getHitVec().x;
|
||||
double y = target.getHitVec().y;
|
||||
double z = target.getHitVec().z;
|
||||
// FIXME: Check how this looks, probably like shit, maybe provide parts the ability to supply particle textures???
|
||||
effectRenderer.addEffect(new CableBusBreakingParticle(world, x, y, z, texture)
|
||||
.multipleParticleScaleBy( 0.8F ));
|
||||
.multipleParticleScaleBy(0.8F));
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -256,14 +230,13 @@ public class BlockCableBus extends AEBaseTileBlock<TileCableBus> /* FIXME implem
|
||||
|
||||
@Override
|
||||
public boolean addDestroyEffects(BlockState state, World world, BlockPos pos, ParticleManager effectRenderer) {
|
||||
ICableBusContainer cb = this.cb( world, pos );
|
||||
ICableBusContainer cb = this.cb(world, pos);
|
||||
|
||||
// Our built-in model has the actual baked sprites we need
|
||||
IBakedModel model = Minecraft.getInstance().getBlockRendererDispatcher().getModelForState( this.getDefaultState() );
|
||||
IBakedModel model = Minecraft.getInstance().getBlockRendererDispatcher().getModelForState(this.getDefaultState());
|
||||
|
||||
// We cannot add the effect if we dont have the model
|
||||
if( !( model instanceof CableBusBakedModel ) )
|
||||
{
|
||||
if (!(model instanceof CableBusBakedModel)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -271,23 +244,19 @@ public class BlockCableBus extends AEBaseTileBlock<TileCableBus> /* FIXME implem
|
||||
|
||||
CableBusRenderState renderState = cb.getRenderState();
|
||||
|
||||
List<TextureAtlasSprite> textures = cableBusModel.getParticleTextures( renderState );
|
||||
List<TextureAtlasSprite> textures = cableBusModel.getParticleTextures(renderState);
|
||||
|
||||
if( !textures.isEmpty() )
|
||||
{
|
||||
if (!textures.isEmpty()) {
|
||||
// Shamelessly inspired by ParticleManager.addBlockDestroyEffects
|
||||
for( int j = 0; j < 4; ++j )
|
||||
{
|
||||
for( int k = 0; k < 4; ++k )
|
||||
{
|
||||
for( int l = 0; l < 4; ++l )
|
||||
{
|
||||
for (int j = 0; j < 4; ++j) {
|
||||
for (int k = 0; k < 4; ++k) {
|
||||
for (int l = 0; l < 4; ++l) {
|
||||
// Randomly select one of the textures if the cable bus has more than just one possibility here
|
||||
final TextureAtlasSprite texture = Platform.pickRandom( textures );
|
||||
final TextureAtlasSprite texture = Platform.pickRandom(textures);
|
||||
|
||||
final double x = pos.getX() + ( j + 0.5D ) / 4.0D;
|
||||
final double y = pos.getY() + ( k + 0.5D ) / 4.0D;
|
||||
final double z = pos.getZ() + ( l + 0.5D ) / 4.0D;
|
||||
final double x = pos.getX() + (j + 0.5D) / 4.0D;
|
||||
final double y = pos.getY() + (k + 0.5D) / 4.0D;
|
||||
final double z = pos.getZ() + (l + 0.5D) / 4.0D;
|
||||
|
||||
// FIXME: Check how this looks, probably like shit, maybe provide parts the ability to supply particle textures???
|
||||
Particle effect = new CableBusBreakingParticle(world, x, y, z, x - pos.getX() - 0.5D,
|
||||
@@ -302,36 +271,30 @@ public class BlockCableBus extends AEBaseTileBlock<TileCableBus> /* FIXME implem
|
||||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving )
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
this.cb( world, pos ).onNeighborChanged( world, pos, fromPos );
|
||||
public void neighborChanged(BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving) {
|
||||
if (Platform.isServer()) {
|
||||
this.cb(world, pos).onNeighborChanged(world, pos, fromPos);
|
||||
}
|
||||
}
|
||||
|
||||
private ICableBusContainer cb( final IBlockReader w, final BlockPos pos )
|
||||
{
|
||||
final TileEntity te = w.getTileEntity( pos );
|
||||
private ICableBusContainer cb(final IBlockReader w, final BlockPos pos) {
|
||||
final TileEntity te = w.getTileEntity(pos);
|
||||
ICableBusContainer out = null;
|
||||
|
||||
if( te instanceof TileCableBus )
|
||||
{
|
||||
out = ( (TileCableBus) te ).getCableBus();
|
||||
if (te instanceof TileCableBus) {
|
||||
out = ((TileCableBus) te).getCableBus();
|
||||
}
|
||||
|
||||
return out == null ? NULL_CABLE_BUS : out;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private IFacadeContainer fc( final IBlockReader w, final BlockPos pos )
|
||||
{
|
||||
final TileEntity te = w.getTileEntity( pos );
|
||||
private IFacadeContainer fc(final IBlockReader w, final BlockPos pos) {
|
||||
final TileEntity te = w.getTileEntity(pos);
|
||||
IFacadeContainer out = null;
|
||||
|
||||
if( te instanceof TileCableBus )
|
||||
{
|
||||
out = ( (TileCableBus) te ).getCableBus().getFacadeContainer();
|
||||
if (te instanceof TileCableBus) {
|
||||
out = ((TileCableBus) te).getCableBus().getFacadeContainer();
|
||||
}
|
||||
|
||||
return out;
|
||||
@@ -339,11 +302,9 @@ public class BlockCableBus extends AEBaseTileBlock<TileCableBus> /* FIXME implem
|
||||
|
||||
@Override
|
||||
public void onBlockClicked(BlockState state, World worldIn, BlockPos pos, PlayerEntity player) {
|
||||
if( worldIn.isRemote() )
|
||||
{
|
||||
if (worldIn.isRemote()) {
|
||||
final RayTraceResult rtr = Minecraft.getInstance().objectMouseOver;
|
||||
if( rtr instanceof BlockRayTraceResult)
|
||||
{
|
||||
if (rtr instanceof BlockRayTraceResult) {
|
||||
BlockRayTraceResult brtr = (BlockRayTraceResult) rtr;
|
||||
if (brtr.getPos().equals(pos)) {
|
||||
final Vec3d hitVec = rtr.getHitVec().subtract(new Vec3d(pos));
|
||||
@@ -358,15 +319,16 @@ public class BlockCableBus extends AEBaseTileBlock<TileCableBus> /* FIXME implem
|
||||
}
|
||||
}
|
||||
|
||||
public void onBlockClickPacket( World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, Vec3d hitVec )
|
||||
{
|
||||
this.cb( worldIn, pos ).clicked( playerIn, hand, hitVec );
|
||||
public void onBlockClickPacket(World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, Vec3d hitVec) {
|
||||
this.cb(worldIn, pos).clicked(playerIn, hand, hitVec);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
return this.cb( w, pos ).activate( player, hand, hit.getHitVec() ) ? ActionResultType.SUCCESS
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit) {
|
||||
// Transform from world into block space
|
||||
Vec3d hitVec = hit.getHitVec();
|
||||
Vec3d hitInBlock = new Vec3d(hitVec.x - pos.getX(), hitVec.y - pos.getY(), hitVec.z - pos.getZ());
|
||||
return this.cb(w, pos).activate(player, hand, hitInBlock) ? ActionResultType.SUCCESS
|
||||
: ActionResultType.PASS;
|
||||
}
|
||||
|
||||
@@ -375,46 +337,20 @@ public class BlockCableBus extends AEBaseTileBlock<TileCableBus> /* FIXME implem
|
||||
return recolorBlock(world, pos, side, color, null);
|
||||
}
|
||||
|
||||
public boolean recolorBlock(final IBlockReader world, final BlockPos pos, final Direction side, final DyeColor color, final PlayerEntity who )
|
||||
{
|
||||
try
|
||||
{
|
||||
return this.cb( world, pos ).recolourBlock( side, AEColor.values()[color.ordinal()], who );
|
||||
}
|
||||
catch( final Throwable ignored )
|
||||
{
|
||||
public boolean recolorBlock(final IBlockReader world, final BlockPos pos, final Direction side, final DyeColor color, final PlayerEntity who) {
|
||||
try {
|
||||
return this.cb(world, pos).recolourBlock(side, AEColor.values()[color.ordinal()], who);
|
||||
} catch (final Throwable ignored) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> itemStacks)
|
||||
{
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> itemStacks) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
public void setupTile()
|
||||
{
|
||||
noTesrTile = TileCableBus.class;
|
||||
// FIXME ... uh ... this.setTileEntity( noTesrTile );
|
||||
|
||||
// FIXME oh no... GameRegistry.registerTileEntity( noTesrTile, AppEng.MOD_ID.toLowerCase() + ":" + "BlockCableBus" );
|
||||
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
setupTesr();
|
||||
}
|
||||
}
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
private static void setupTesr()
|
||||
{
|
||||
tesrTile = TileCableBusTESR.class;
|
||||
// FIXME oh no... GameRegistry.registerTileEntity( tesrTile, AppEng.MOD_ID.toLowerCase() + ":" + "ClientOnly_TESR_CableBus" );
|
||||
// FIXME oh no... ClientRegistry.bindTileEntitySpecialRenderer( BlockCableBus.getTesrTile(), new CableBusTESR() );
|
||||
}
|
||||
|
||||
// FIXME FACADES @Override
|
||||
// FIXME FACADES public BlockState getFacadeState( IBlockReader world, BlockPos pos, Direction side )
|
||||
// FIXME FACADES {
|
||||
@@ -433,16 +369,6 @@ public class BlockCableBus extends AEBaseTileBlock<TileCableBus> /* FIXME implem
|
||||
// FIXME FACADES return world.getBlockState( pos );
|
||||
// FIXME FACADES }
|
||||
|
||||
public static Class<? extends AEBaseTile> getNoTesrTile()
|
||||
{
|
||||
return noTesrTile;
|
||||
}
|
||||
|
||||
public static Class<? extends AEBaseTile> getTesrTile()
|
||||
{
|
||||
return tesrTile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState state, IBlockReader w, BlockPos pos, ISelectionContext context) {
|
||||
|
||||
@@ -478,4 +404,5 @@ public class BlockCableBus extends AEBaseTileBlock<TileCableBus> /* FIXME implem
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -314,7 +314,7 @@ public class CableBusBakedModel implements IBakedModel
|
||||
|
||||
// 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( isMissingTexture(particleTexture) )
|
||||
if( !isMissingTexture(particleTexture) )
|
||||
{
|
||||
result.add( particleTexture );
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
|
||||
import appeng.core.AELog;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
|
||||
@@ -76,7 +77,12 @@ public class CableBusModel implements IModelGeometry<CableBusModel>
|
||||
|
||||
for( ResourceLocation location : this.partModels.getModels() )
|
||||
{
|
||||
result.put( location, bakery.getBakedModel( location, transformIn, spriteGetterIn ) );
|
||||
IBakedModel bakedModel = bakery.getBakedModel(location, transformIn, spriteGetterIn);
|
||||
if (bakedModel == null) {
|
||||
AELog.warn("Failed to bake part model {}", location);
|
||||
} else {
|
||||
result.put(location, bakedModel);
|
||||
}
|
||||
}
|
||||
|
||||
return result.build();
|
||||
|
||||
@@ -62,12 +62,12 @@ public class QuadRotator
|
||||
CachedFormat format = CachedFormat.lookup( DefaultVertexFormats.BLOCK );
|
||||
BakedPipeline pipeline = pipelines.get();
|
||||
Quad collector = collectors.get();
|
||||
pipeline.reset( format );
|
||||
collector.reset( format );
|
||||
QuadMatrixTransformer transformer = pipeline.getElement( "transformer", QuadMatrixTransformer.class );
|
||||
|
||||
for( BakedQuad quad : quads )
|
||||
{
|
||||
pipeline.reset( format );
|
||||
collector.reset( format );
|
||||
transformer.setMatrix( rotation.getMat() );
|
||||
pipeline.prepare( collector );
|
||||
quad.pipe( pipeline );
|
||||
|
||||
@@ -6,6 +6,7 @@ import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.api.networking.security.ISecurityGrid;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
@@ -20,36 +21,9 @@ abstract class AbstractContainerHelper {
|
||||
|
||||
protected boolean checkPermission(PlayerEntity player, Object accessInterface) {
|
||||
|
||||
// FIXME: Check permissions...
|
||||
if (requiredPermission != null && accessInterface instanceof IActionHost)
|
||||
if (requiredPermission != null)
|
||||
{
|
||||
final IGridNode gn = ( (IActionHost) accessInterface ).getActionableNode();
|
||||
if( gn != null )
|
||||
{
|
||||
final IGrid g = gn.getGrid();
|
||||
if( g != null )
|
||||
{
|
||||
final boolean requirePower = false;
|
||||
if( requirePower )
|
||||
{
|
||||
final IEnergyGrid eg = g.getCache( IEnergyGrid.class );
|
||||
if( !eg.isNetworkPowered() )
|
||||
{
|
||||
// FIXME trace logging?
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
final ISecurityGrid sg = g.getCache( ISecurityGrid.class );
|
||||
if( !sg.hasPermission( player, this.requiredPermission ) )
|
||||
{
|
||||
player.sendMessage(new TranslationTextComponent("appliedenergistics2.permission_denied")
|
||||
.applyTextStyle(TextFormatting.RED));
|
||||
// FIXME trace logging?
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return Platform.checkPermissions(player, accessInterface, requiredPermission, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -29,8 +29,6 @@ public final class PartContainerHelper<C extends AEBaseContainer, P extends IPar
|
||||
|
||||
private final ContainerFactory<P, C> factory;
|
||||
|
||||
private final SecurityPermissions requiredPermission;
|
||||
|
||||
public PartContainerHelper(ContainerFactory<P, C> factory, Class<P> partClass) {
|
||||
this(factory, partClass, null);
|
||||
}
|
||||
@@ -39,7 +37,6 @@ public final class PartContainerHelper<C extends AEBaseContainer, P extends IPar
|
||||
super(requiredPermission);
|
||||
this.partClass = partClass;
|
||||
this.factory = factory;
|
||||
this.requiredPermission = requiredPermission;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,11 +85,6 @@ public final class PartContainerHelper<C extends AEBaseContainer, P extends IPar
|
||||
// FIXME: this is not right, we'd need to check the part's item stack, or custom naming interface impl
|
||||
ITextComponent title = player.world.getBlockState(locator.getBlockPos()).getBlock().getNameTextComponent();
|
||||
|
||||
// FIXME: Check permissions...
|
||||
if (requiredPermission != null) {
|
||||
throw new IllegalStateException(); // NOT YET IMPLEMENTED
|
||||
}
|
||||
|
||||
INamedContainerProvider container = new SimpleNamedContainerProvider(
|
||||
(wnd, p, pl) -> {
|
||||
C c = factory.create(wnd, p, actualPart);
|
||||
|
||||
@@ -36,8 +36,6 @@ public final class PartOrTileContainerHelper<C extends AEBaseContainer, I> exten
|
||||
|
||||
private final ContainerFactory<C, I> factory;
|
||||
|
||||
private final SecurityPermissions requiredPermission;
|
||||
|
||||
public PartOrTileContainerHelper(ContainerFactory<C, I> factory, Class<I> interfaceClass) {
|
||||
this(factory, interfaceClass, null);
|
||||
}
|
||||
@@ -46,7 +44,6 @@ public final class PartOrTileContainerHelper<C extends AEBaseContainer, I> exten
|
||||
super(requiredPermission);
|
||||
this.interfaceClass = interfaceClass;
|
||||
this.factory = factory;
|
||||
this.requiredPermission = requiredPermission;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -198,6 +198,8 @@ public final class AppEng
|
||||
ModelLoaderRegistry.registerLoader(new ResourceLocation(AppEng.MOD_ID, "crafting_cube"), CraftingCubeModelLoader.INSTANCE);
|
||||
ModelLoaderRegistry.registerLoader(new ResourceLocation(AppEng.MOD_ID, "uvlightmap"), UVLModelLoader.INSTANCE);
|
||||
addBuiltInModel("cable_bus", () -> new CableBusModel((PartModels) Api.INSTANCE.registries().partModels()));
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static <T extends IModelGeometry<T>> void addBuiltInModel(String id, Supplier<T> modelFactory) {
|
||||
|
||||
@@ -284,6 +284,7 @@ final class Registration
|
||||
|
||||
PartModels partModels = (PartModels) Api.INSTANCE.registries().partModels();
|
||||
partModels.getModels().forEach(ModelLoader::addSpecialModel);
|
||||
partModels.setInitialized(true);
|
||||
}
|
||||
|
||||
public void registerBlocks( RegistryEvent.Register<Block> event )
|
||||
|
||||
@@ -549,10 +549,15 @@ public final class ApiBlocks implements IBlocks
|
||||
|
||||
this.multiPart = registry.block( "cable_bus", BlockCableBus::new )
|
||||
.rendering( new CableBusRendering() )
|
||||
// (handled in BlockCableBus.java and its setupTile())
|
||||
// .tileEntity( TileCableBus.class )
|
||||
// TODO: why the custom registration?
|
||||
.bootstrap( ( block, item ) -> (IInitComponent) ((BlockCableBus) block)::setupTile)
|
||||
.tileEntity( registry.tileEntity( "cable_bus", TileCableBus.class, TileCableBus::new)
|
||||
.rendering(new TileEntityRenderingCustomizer<TileCableBus>() {
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void customize(TileEntityRendering<TileCableBus> rendering) {
|
||||
rendering.tileEntityRenderer(CableBusTESR::new);
|
||||
}
|
||||
})
|
||||
.build())
|
||||
.build();
|
||||
|
||||
this.skyStoneSlab = deco.block( "sky_stone_slab", () -> new SlabBlock( SKYSTONE_PROPERTIES ) )
|
||||
|
||||
@@ -25,12 +25,14 @@ import appeng.api.parts.IPart;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEColoredItemDefinition;
|
||||
import appeng.bootstrap.FeatureFactory;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.CreativeTab;
|
||||
import appeng.core.features.*;
|
||||
import appeng.core.features.registries.PartModels;
|
||||
import appeng.fluids.parts.*;
|
||||
import appeng.items.parts.ColoredPartItem;
|
||||
import appeng.items.parts.ItemPart;
|
||||
import appeng.items.parts.ItemPartRendering;
|
||||
import appeng.items.parts.PartType;
|
||||
import appeng.parts.automation.*;
|
||||
import appeng.parts.misc.*;
|
||||
@@ -38,8 +40,12 @@ import appeng.parts.networking.*;
|
||||
import appeng.parts.p2p.*;
|
||||
import appeng.parts.reporting.*;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
@@ -91,20 +97,12 @@ public final class ApiParts implements IParts
|
||||
|
||||
public ApiParts( FeatureFactory registry, PartModels partModels )
|
||||
{
|
||||
// IItemDefinition itemPartDef = registry.item( "part", ItemPart::new )
|
||||
// .rendering( new ItemPartRendering( partModels ) )
|
||||
// .build();
|
||||
|
||||
// Register all part models
|
||||
for( PartType partType : PartType.values() )
|
||||
{
|
||||
partModels.registerModels( partType.getModels() );
|
||||
}
|
||||
registerPartModels(partModels);
|
||||
|
||||
this.cableSmart = constructColoredDefinition(registry, "smart_cable", PartType.CABLE_SMART, PartCableSmart::new);
|
||||
this.cableCovered = constructColoredDefinition(registry, "covered_cable", PartType.CABLE_COVERED, PartCableCovered::new);
|
||||
this.cableGlass = constructColoredDefinition(registry, "glass_cable", PartType.CABLE_GLASS, PartCableGlass::new);
|
||||
this.cableDenseCovered = constructColoredDefinition(registry, "dense_cable", PartType.CABLE_DENSE_COVERED, PartDenseCableCovered::new);
|
||||
this.cableDenseCovered = constructColoredDefinition(registry, "covered_dense_cable", PartType.CABLE_DENSE_COVERED, PartDenseCableCovered::new);
|
||||
this.cableDenseSmart = constructColoredDefinition(registry, "smart_dense_cable", PartType.CABLE_DENSE_SMART, PartDenseCableSmart::new);
|
||||
this.quartzFiber = createPart(registry, "quartz_fiber", PartType.QUARTZ_FIBER, PartQuartzFiber::new );
|
||||
this.toggleBus = createPart(registry, "toggle_bus", PartType.TOGGLE_BUS, PartToggleBus::new );
|
||||
@@ -122,7 +120,7 @@ public final class ApiParts implements IParts
|
||||
this.levelEmitter = createPart(registry, "level_emitter", PartType.LEVEL_EMITTER, PartLevelEmitter::new );
|
||||
this.fluidLevelEmitter = createPart(registry, "fluid_level_emitter", PartType.FLUID_LEVEL_EMITTER, PartFluidLevelEmitter::new );
|
||||
this.annihilationPlane = createPart(registry, "annihilation_plane", PartType.ANNIHILATION_PLANE, PartAnnihilationPlane::new );
|
||||
this.identityAnnihilationPlane = createPart(registry, "identity_annihiliation_plane", PartType.IDENTITY_ANNIHILATION_PLANE, PartIdentityAnnihilationPlane::new );
|
||||
this.identityAnnihilationPlane = createPart(registry, "identity_annihilation_plane", PartType.IDENTITY_ANNIHILATION_PLANE, PartIdentityAnnihilationPlane::new );
|
||||
this.fluidAnnihilationPlane = createPart(registry, "fluid_annihilation_plane", PartType.FLUID_ANNIHILATION_PLANE, PartFluidAnnihilationPlane::new );
|
||||
this.formationPlane = createPart(registry, "formation_plane", PartType.FORMATION_PLANE, PartFormationPlane::new );
|
||||
this.fluidFormationPlane = createPart(registry, "fluid_formation_plane", PartType.FLUID_FORMATION_PLANE, PartFluidFormationPlane::new );
|
||||
@@ -133,20 +131,97 @@ public final class ApiParts implements IParts
|
||||
this.conversionMonitor = createPart(registry, "conversion_monitor", PartType.CONVERSION_MONITOR, PartConversionMonitor::new );
|
||||
this.iface = createPart(registry, "cable_interface", PartType.INTERFACE, PartInterface::new );
|
||||
this.fluidIface = createPart(registry, "cable_fluid_interface", PartType.FLUID_INTERFACE, PartFluidInterface::new );
|
||||
this.p2PTunnelME = createPart(registry, "me_tunnel", PartType.P2P_TUNNEL_ME, PartP2PTunnelME::new );
|
||||
this.p2PTunnelRedstone = createPart(registry, "redstone_tunnel", PartType.P2P_TUNNEL_REDSTONE, PartP2PRedstone::new );
|
||||
this.p2PTunnelItems = createPart(registry, "item_tunnel", PartType.P2P_TUNNEL_ITEMS, PartP2PItems::new );
|
||||
this.p2PTunnelFluids = createPart(registry, "fluid_tunnel", PartType.P2P_TUNNEL_FLUIDS, PartP2PFluids::new );
|
||||
this.p2PTunnelEU = null; // FIXME createPart( "tunnel.eu", PartType.P2P_TUNNEL_IC2, PartP2PIC2Power::new);
|
||||
this.p2PTunnelFE = createPart(registry, "fe_tunnel", PartType.P2P_TUNNEL_FE, PartP2PFEPower::new );
|
||||
this.p2PTunnelLight = createPart(registry, "light_tunnel", PartType.P2P_TUNNEL_LIGHT, PartP2PLight::new );
|
||||
this.p2PTunnelME = createPart(registry, "me_p2p_tunnel", PartType.P2P_TUNNEL_ME, PartP2PTunnelME::new );
|
||||
this.p2PTunnelRedstone = createPart(registry, "redstone_p2p_tunnel", PartType.P2P_TUNNEL_REDSTONE, PartP2PRedstone::new );
|
||||
this.p2PTunnelItems = createPart(registry, "item_p2p_tunnel", PartType.P2P_TUNNEL_ITEM, PartP2PItems::new );
|
||||
this.p2PTunnelFluids = createPart(registry, "fluid_p2p_tunnel", PartType.P2P_TUNNEL_FLUID, PartP2PFluids::new );
|
||||
this.p2PTunnelEU = null; // FIXME createPart( "ic2_p2p_tunnel", PartType.P2P_TUNNEL_IC2, PartP2PIC2Power::new);
|
||||
this.p2PTunnelFE = createPart(registry, "fe_p2p_tunnel", PartType.P2P_TUNNEL_FE, PartP2PFEPower::new );
|
||||
this.p2PTunnelLight = createPart(registry, "light_p2p_tunnel", PartType.P2P_TUNNEL_LIGHT, PartP2PLight::new );
|
||||
this.interfaceTerminal = createPart(registry, "interface_terminal", PartType.INTERFACE_TERMINAL, PartInterfaceTerminal::new );
|
||||
this.fluidTerminal = createPart(registry, "fluid_terminal", PartType.FLUID_TERMINAL, PartFluidTerminal::new );
|
||||
}
|
||||
|
||||
private void registerPartModels(PartModels partModels) {
|
||||
|
||||
// Register the built-in models for annihilation planes
|
||||
ResourceLocation annihilationPlaneTexture = new ResourceLocation( AppEng.MOD_ID, "item/part/annihilation_plane" );
|
||||
ResourceLocation annihilationPlaneOnTexture = new ResourceLocation( AppEng.MOD_ID, "parts/annihilation_plane_on" );
|
||||
ResourceLocation fluidAnnihilationPlaneTexture = new ResourceLocation( AppEng.MOD_ID, "item/part/fluid_annihilation_plane" );
|
||||
ResourceLocation fluidAnnihilationPlaneOnTexture = new ResourceLocation( AppEng.MOD_ID, "parts/fluid_annihilation_plane_on" );
|
||||
ResourceLocation identityAnnihilationPlaneTexture = new ResourceLocation( AppEng.MOD_ID, "item/part/identity_annihilation_plane" );
|
||||
ResourceLocation identityAnnihilationPlaneOnTexture = new ResourceLocation( AppEng.MOD_ID, "parts/identity_annihilation_plane_on" );
|
||||
ResourceLocation formationPlaneTexture = new ResourceLocation( AppEng.MOD_ID, "item/part/formation_plane" );
|
||||
ResourceLocation formationPlaneOnTexture = new ResourceLocation( AppEng.MOD_ID, "parts/formation_plane_on" );
|
||||
ResourceLocation fluidFormationPlaneTexture = new ResourceLocation( AppEng.MOD_ID, "item/part/fluid_formation_plane" );
|
||||
ResourceLocation fluidFormationPlaneOnTexture = new ResourceLocation( AppEng.MOD_ID, "parts/fluid_formation_plane_on" );
|
||||
ResourceLocation sidesTexture = new ResourceLocation( AppEng.MOD_ID, "parts/plane_sides" );
|
||||
ResourceLocation backTexture = new ResourceLocation( AppEng.MOD_ID, "parts/transition_plane_back" );
|
||||
|
||||
List<String> modelNames = new ArrayList<>();
|
||||
|
||||
// FIXME for( PlaneConnections connection : PlaneConnections.PERMUTATIONS )
|
||||
// FIXME {
|
||||
// FIXME PlaneModel model = new PlaneModel( annihilationPlaneTexture, sidesTexture, backTexture, connection );
|
||||
// FIXME rendering.builtInModel( "models/part/annihilation_plane_" + connection.getFilenameSuffix(), model );
|
||||
// FIXME modelNames.add( "part/annihilation_plane_" + connection.getFilenameSuffix() );
|
||||
// FIXME
|
||||
// FIXME model = new PlaneModel( annihilationPlaneOnTexture, sidesTexture, backTexture, connection );
|
||||
// FIXME rendering.builtInModel( "models/part/annihilation_plane_on_" + connection.getFilenameSuffix(), model );
|
||||
// FIXME modelNames.add( "part/annihilation_plane_on_" + connection.getFilenameSuffix() );
|
||||
// FIXME
|
||||
// FIXME model = new PlaneModel( fluidAnnihilationPlaneTexture, sidesTexture, backTexture, connection );
|
||||
// FIXME rendering.builtInModel( "models/part/fluid_annihilation_plane_" + connection.getFilenameSuffix(), model );
|
||||
// FIXME modelNames.add( "part/fluid_annihilation_plane_" + connection.getFilenameSuffix() );
|
||||
// FIXME
|
||||
// FIXME model = new PlaneModel( fluidAnnihilationPlaneOnTexture, sidesTexture, backTexture, connection );
|
||||
// FIXME rendering.builtInModel( "models/part/fluid_annihilation_plane_on_" + connection.getFilenameSuffix(), model );
|
||||
// FIXME modelNames.add( "part/fluid_annihilation_plane_on_" + connection.getFilenameSuffix() );
|
||||
// FIXME
|
||||
// FIXME model = new PlaneModel( identityAnnihilationPlaneTexture, sidesTexture, backTexture, connection );
|
||||
// FIXME rendering.builtInModel( "models/part/identity_annihilation_plane_" + connection.getFilenameSuffix(), model );
|
||||
// FIXME modelNames.add( "part/identity_annihilation_plane_" + connection.getFilenameSuffix() );
|
||||
// FIXME
|
||||
// FIXME model = new PlaneModel( identityAnnihilationPlaneOnTexture, sidesTexture, backTexture, connection );
|
||||
// FIXME rendering.builtInModel( "models/part/identity_annihilation_plane_on_" + connection.getFilenameSuffix(), model );
|
||||
// FIXME modelNames.add( "part/identity_annihilation_plane_on_" + connection.getFilenameSuffix() );
|
||||
// FIXME
|
||||
// FIXME model = new PlaneModel( formationPlaneTexture, sidesTexture, backTexture, connection );
|
||||
// FIXME rendering.builtInModel( "models/part/formation_plane_" + connection.getFilenameSuffix(), model );
|
||||
// FIXME modelNames.add( "part/formation_plane_" + connection.getFilenameSuffix() );
|
||||
// FIXME
|
||||
// FIXME model = new PlaneModel( formationPlaneOnTexture, sidesTexture, backTexture, connection );
|
||||
// FIXME rendering.builtInModel( "models/part/formation_plane_on_" + connection.getFilenameSuffix(), model );
|
||||
// FIXME modelNames.add( "part/formation_plane_on_" + connection.getFilenameSuffix() );
|
||||
// FIXME
|
||||
// FIXME model = new PlaneModel( fluidFormationPlaneTexture, sidesTexture, backTexture, connection );
|
||||
// FIXME rendering.builtInModel( "models/part/fluid_formation_plane_" + connection.getFilenameSuffix(), model );
|
||||
// FIXME modelNames.add( "part/fluid_formation_plane_" + connection.getFilenameSuffix() );
|
||||
// FIXME
|
||||
// FIXME model = new PlaneModel( fluidFormationPlaneOnTexture, sidesTexture, backTexture, connection );
|
||||
// FIXME rendering.builtInModel( "models/part/fluid_formation_plane_on_" + connection.getFilenameSuffix(), model );
|
||||
// FIXME modelNames.add( "part/fluid_formation_plane_on_" + connection.getFilenameSuffix() );
|
||||
// FIXME }
|
||||
// FIXME
|
||||
// FIXME // base p2p model with frequency
|
||||
// FIXME rendering.builtInModel( "models/part/builtin/p2p_tunnel_frequency", new P2PTunnelFrequencyModel() );
|
||||
|
||||
List<ResourceLocation> partResourceLocs = modelNames.stream()
|
||||
.map( name -> new ResourceLocation( AppEng.MOD_ID, name ) )
|
||||
.collect( Collectors.toList() );
|
||||
partModels.registerModels( partResourceLocs );
|
||||
|
||||
// Register all part models
|
||||
for( PartType partType : PartType.values() )
|
||||
{
|
||||
partModels.registerModels( partType.getModels() );
|
||||
}
|
||||
}
|
||||
|
||||
private <T extends IPart> IItemDefinition createPart(FeatureFactory registry, String id, PartType type, Function<ItemStack, T> factory) {
|
||||
return registry.item(id, props -> new ItemPart<>(props, type, factory))
|
||||
.itemGroup(CreativeTab.instance)
|
||||
.rendering(new ItemPartRendering())
|
||||
.build();
|
||||
}
|
||||
|
||||
@@ -156,10 +231,11 @@ public final class ApiParts implements IParts
|
||||
|
||||
for( final AEColor color : AEColor.values() )
|
||||
{
|
||||
String id = color.registryPrefix + idSuffix;
|
||||
String id = color.registryPrefix + '_' + idSuffix;
|
||||
|
||||
IItemDefinition itemDef = registry.item(id, props -> new ColoredPartItem<>(props, type, factory, color))
|
||||
.itemGroup(CreativeTab.instance)
|
||||
.rendering(new ItemPartRendering(color))
|
||||
.build();
|
||||
|
||||
definition.add( color, new ItemStackSrc(itemDef.item(), ActivityState.Enabled) );
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
package appeng.fluids.parts;
|
||||
|
||||
|
||||
import appeng.fluids.container.ContainerFluidTerminal;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
@@ -53,11 +55,11 @@ public class PartFluidTerminal extends AbstractPartTerminal
|
||||
super( is );
|
||||
}
|
||||
|
||||
// FIXME @Override
|
||||
// FIXME public GuiBridge getGui( PlayerEntity player )
|
||||
// FIXME {
|
||||
// FIXME return GuiBridge.GUI_FLUID_TERMINAL;
|
||||
// FIXME }
|
||||
@Override
|
||||
public ContainerType<?> getContainerType(PlayerEntity player )
|
||||
{
|
||||
return ContainerFluidTerminal.TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPartModel getStaticModels()
|
||||
|
||||
@@ -19,125 +19,31 @@
|
||||
package appeng.items.parts;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.bootstrap.IItemRendering;
|
||||
import appeng.bootstrap.ItemRenderingCustomizer;
|
||||
import appeng.client.render.StaticItemColor;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.features.registries.PartModels;
|
||||
import appeng.parts.automation.PlaneConnections;
|
||||
import appeng.parts.automation.PlaneModel;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
||||
public class ItemPartRendering extends ItemRenderingCustomizer
|
||||
{
|
||||
|
||||
private final PartModels partModels;
|
||||
private final AEColor color;
|
||||
|
||||
public ItemPartRendering( PartModels partModels )
|
||||
{
|
||||
this.partModels = partModels;
|
||||
public ItemPartRendering() {
|
||||
this.color = AEColor.TRANSPARENT;
|
||||
}
|
||||
|
||||
public ItemPartRendering(AEColor color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void customize( IItemRendering rendering )
|
||||
{
|
||||
|
||||
// FIXME rendering.meshDefinition( this::getItemMeshDefinition );
|
||||
|
||||
rendering.color( new StaticItemColor( AEColor.TRANSPARENT ) );
|
||||
|
||||
// Register all item models as variants so they get loaded
|
||||
rendering.variants( Arrays.stream( PartType.values() )
|
||||
.filter( f -> f != PartType.INVALID_TYPE )
|
||||
.flatMap( part -> part.getItemModels().stream() )
|
||||
.collect( Collectors.toList() ) );
|
||||
|
||||
// Register the built-in models for annihilation planes
|
||||
ResourceLocation annihilationPlaneTexture = new ResourceLocation( AppEng.MOD_ID, "item/part/annihilation_plane" );
|
||||
ResourceLocation annihilationPlaneOnTexture = new ResourceLocation( AppEng.MOD_ID, "parts/annihilation_plane_on" );
|
||||
ResourceLocation fluidAnnihilationPlaneTexture = new ResourceLocation( AppEng.MOD_ID, "item/part/fluid_annihilation_plane" );
|
||||
ResourceLocation fluidAnnihilationPlaneOnTexture = new ResourceLocation( AppEng.MOD_ID, "parts/fluid_annihilation_plane_on" );
|
||||
ResourceLocation identityAnnihilationPlaneTexture = new ResourceLocation( AppEng.MOD_ID, "item/part/identity_annihilation_plane" );
|
||||
ResourceLocation identityAnnihilationPlaneOnTexture = new ResourceLocation( AppEng.MOD_ID, "parts/identity_annihilation_plane_on" );
|
||||
ResourceLocation formationPlaneTexture = new ResourceLocation( AppEng.MOD_ID, "item/part/formation_plane" );
|
||||
ResourceLocation formationPlaneOnTexture = new ResourceLocation( AppEng.MOD_ID, "parts/formation_plane_on" );
|
||||
ResourceLocation fluidFormationPlaneTexture = new ResourceLocation( AppEng.MOD_ID, "item/part/fluid_formation_plane" );
|
||||
ResourceLocation fluidFormationPlaneOnTexture = new ResourceLocation( AppEng.MOD_ID, "parts/fluid_formation_plane_on" );
|
||||
ResourceLocation sidesTexture = new ResourceLocation( AppEng.MOD_ID, "parts/plane_sides" );
|
||||
ResourceLocation backTexture = new ResourceLocation( AppEng.MOD_ID, "parts/transition_plane_back" );
|
||||
|
||||
List<String> modelNames = new ArrayList<>();
|
||||
|
||||
for( PlaneConnections connection : PlaneConnections.PERMUTATIONS )
|
||||
{
|
||||
PlaneModel model = new PlaneModel( annihilationPlaneTexture, sidesTexture, backTexture, connection );
|
||||
rendering.builtInModel( "models/part/annihilation_plane_" + connection.getFilenameSuffix(), model );
|
||||
modelNames.add( "part/annihilation_plane_" + connection.getFilenameSuffix() );
|
||||
|
||||
model = new PlaneModel( annihilationPlaneOnTexture, sidesTexture, backTexture, connection );
|
||||
rendering.builtInModel( "models/part/annihilation_plane_on_" + connection.getFilenameSuffix(), model );
|
||||
modelNames.add( "part/annihilation_plane_on_" + connection.getFilenameSuffix() );
|
||||
|
||||
model = new PlaneModel( fluidAnnihilationPlaneTexture, sidesTexture, backTexture, connection );
|
||||
rendering.builtInModel( "models/part/fluid_annihilation_plane_" + connection.getFilenameSuffix(), model );
|
||||
modelNames.add( "part/fluid_annihilation_plane_" + connection.getFilenameSuffix() );
|
||||
|
||||
model = new PlaneModel( fluidAnnihilationPlaneOnTexture, sidesTexture, backTexture, connection );
|
||||
rendering.builtInModel( "models/part/fluid_annihilation_plane_on_" + connection.getFilenameSuffix(), model );
|
||||
modelNames.add( "part/fluid_annihilation_plane_on_" + connection.getFilenameSuffix() );
|
||||
|
||||
model = new PlaneModel( identityAnnihilationPlaneTexture, sidesTexture, backTexture, connection );
|
||||
rendering.builtInModel( "models/part/identity_annihilation_plane_" + connection.getFilenameSuffix(), model );
|
||||
modelNames.add( "part/identity_annihilation_plane_" + connection.getFilenameSuffix() );
|
||||
|
||||
model = new PlaneModel( identityAnnihilationPlaneOnTexture, sidesTexture, backTexture, connection );
|
||||
rendering.builtInModel( "models/part/identity_annihilation_plane_on_" + connection.getFilenameSuffix(), model );
|
||||
modelNames.add( "part/identity_annihilation_plane_on_" + connection.getFilenameSuffix() );
|
||||
|
||||
model = new PlaneModel( formationPlaneTexture, sidesTexture, backTexture, connection );
|
||||
rendering.builtInModel( "models/part/formation_plane_" + connection.getFilenameSuffix(), model );
|
||||
modelNames.add( "part/formation_plane_" + connection.getFilenameSuffix() );
|
||||
|
||||
model = new PlaneModel( formationPlaneOnTexture, sidesTexture, backTexture, connection );
|
||||
rendering.builtInModel( "models/part/formation_plane_on_" + connection.getFilenameSuffix(), model );
|
||||
modelNames.add( "part/formation_plane_on_" + connection.getFilenameSuffix() );
|
||||
|
||||
model = new PlaneModel( fluidFormationPlaneTexture, sidesTexture, backTexture, connection );
|
||||
rendering.builtInModel( "models/part/fluid_formation_plane_" + connection.getFilenameSuffix(), model );
|
||||
modelNames.add( "part/fluid_formation_plane_" + connection.getFilenameSuffix() );
|
||||
|
||||
model = new PlaneModel( fluidFormationPlaneOnTexture, sidesTexture, backTexture, connection );
|
||||
rendering.builtInModel( "models/part/fluid_formation_plane_on_" + connection.getFilenameSuffix(), model );
|
||||
modelNames.add( "part/fluid_formation_plane_on_" + connection.getFilenameSuffix() );
|
||||
|
||||
}
|
||||
|
||||
// base p2p model with frequency
|
||||
// FIXME rendering.builtInModel( "models/part/builtin/p2p_tunnel_frequency", new P2PTunnelFrequencyModel() );
|
||||
|
||||
List<ResourceLocation> partResourceLocs = modelNames.stream()
|
||||
.map( name -> new ResourceLocation( AppEng.MOD_ID, name ) )
|
||||
.collect( Collectors.toList() );
|
||||
this.partModels.registerModels( partResourceLocs );
|
||||
rendering.color( new StaticItemColor(color) );
|
||||
}
|
||||
|
||||
// FIXME private ModelResourceLocation getItemMeshDefinition( ItemStack is )
|
||||
// FIXME {
|
||||
// FIXME PartType partType = this.item.getTypeByStack( is );
|
||||
// FIXME int variant = this.item.variantOf( is.getDamage() );
|
||||
// FIXME return partType.getItemModels().get( variant );
|
||||
// FIXME }
|
||||
}
|
||||
|
||||
@@ -19,28 +19,20 @@
|
||||
package appeng.items.parts;
|
||||
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import appeng.fluids.parts.*;
|
||||
import appeng.parts.p2p.*;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.api.features.AEFeature;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.parts.automation.PartAnnihilationPlane;
|
||||
@@ -69,68 +61,40 @@ import appeng.parts.reporting.PartPatternTerminal;
|
||||
import appeng.parts.reporting.PartSemiDarkPanel;
|
||||
import appeng.parts.reporting.PartStorageMonitor;
|
||||
import appeng.parts.reporting.PartTerminal;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public enum PartType
|
||||
{
|
||||
INVALID_TYPE( -1, "invalid", EnumSet.of( AEFeature.CORE ), EnumSet.noneOf( IntegrationType.class ), null ),
|
||||
INVALID_TYPE(EnumSet.of( AEFeature.CORE ), EnumSet.noneOf( IntegrationType.class ), null ),
|
||||
|
||||
CABLE_GLASS( 0, "cable_glass", EnumSet.of( AEFeature.GLASS_CABLES ), EnumSet.noneOf( IntegrationType.class ), PartCableGlass.class )
|
||||
CABLE_GLASS(EnumSet.of( AEFeature.GLASS_CABLES ), EnumSet.noneOf( IntegrationType.class ), PartCableGlass.class )
|
||||
{
|
||||
@Override
|
||||
public boolean isCable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
protected List<ModelResourceLocation> createItemModels( String baseName )
|
||||
{
|
||||
return Arrays.stream( AEColor.values() )
|
||||
.map( color -> modelFromBaseName( baseName + "_" + color.name().toLowerCase() ) )
|
||||
.collect( Collectors.toList() );
|
||||
}
|
||||
},
|
||||
|
||||
CABLE_COVERED( 20, "cable_covered", EnumSet.of( AEFeature.COVERED_CABLES ), EnumSet.noneOf( IntegrationType.class ), PartCableCovered.class )
|
||||
CABLE_COVERED(EnumSet.of( AEFeature.COVERED_CABLES ), EnumSet.noneOf( IntegrationType.class ), PartCableCovered.class )
|
||||
{
|
||||
@Override
|
||||
public boolean isCable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
protected List<ModelResourceLocation> createItemModels( String baseName )
|
||||
{
|
||||
return Arrays.stream( AEColor.values() )
|
||||
.map( color -> modelFromBaseName( baseName + "_" + color.name().toLowerCase() ) )
|
||||
.collect( Collectors.toList() );
|
||||
}
|
||||
},
|
||||
|
||||
CABLE_SMART( 40, "cable_smart", EnumSet.of( AEFeature.CHANNELS, AEFeature.SMART_CABLES ), EnumSet.noneOf( IntegrationType.class ), PartCableSmart.class )
|
||||
CABLE_SMART(EnumSet.of( AEFeature.CHANNELS, AEFeature.SMART_CABLES ), EnumSet.noneOf( IntegrationType.class ), PartCableSmart.class )
|
||||
{
|
||||
@Override
|
||||
public boolean isCable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
protected List<ModelResourceLocation> createItemModels( String baseName )
|
||||
{
|
||||
return Arrays.stream( AEColor.values() )
|
||||
.map( color -> modelFromBaseName( baseName + "_" + color.name().toLowerCase() ) )
|
||||
.collect( Collectors.toList() );
|
||||
}
|
||||
},
|
||||
|
||||
CABLE_DENSE_SMART( 60, "cable_dense_smart", EnumSet.of( AEFeature.CHANNELS, AEFeature.DENSE_CABLES ), EnumSet
|
||||
CABLE_DENSE_SMART(EnumSet.of( AEFeature.CHANNELS, AEFeature.DENSE_CABLES ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartDenseCableSmart.class )
|
||||
{
|
||||
@Override
|
||||
@@ -138,18 +102,9 @@ public enum PartType
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
protected List<ModelResourceLocation> createItemModels( String baseName )
|
||||
{
|
||||
return Arrays.stream( AEColor.values() )
|
||||
.map( color -> modelFromBaseName( baseName + "_" + color.name().toLowerCase() ) )
|
||||
.collect( Collectors.toList() );
|
||||
}
|
||||
},
|
||||
|
||||
CABLE_DENSE_COVERED( 500, "cable_dense_covered", EnumSet.of( AEFeature.CHANNELS, AEFeature.DENSE_CABLES ), EnumSet
|
||||
CABLE_DENSE_COVERED(EnumSet.of( AEFeature.CHANNELS, AEFeature.DENSE_CABLES ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartDenseCableCovered.class )
|
||||
{
|
||||
@Override
|
||||
@@ -157,78 +112,69 @@ public enum PartType
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
protected List<ModelResourceLocation> createItemModels( String baseName )
|
||||
{
|
||||
return Arrays.stream( AEColor.values() )
|
||||
.map( color -> modelFromBaseName( baseName + "_" + color.name().toLowerCase() ) )
|
||||
.collect( Collectors.toList() );
|
||||
}
|
||||
},
|
||||
|
||||
TOGGLE_BUS( 80, "toggle_bus", EnumSet.of( AEFeature.TOGGLE_BUS ), EnumSet.noneOf( IntegrationType.class ), PartToggleBus.class ),
|
||||
TOGGLE_BUS(EnumSet.of( AEFeature.TOGGLE_BUS ), EnumSet.noneOf( IntegrationType.class ), PartToggleBus.class ),
|
||||
|
||||
INVERTED_TOGGLE_BUS( 100, "inverted_toggle_bus", EnumSet.of( AEFeature.TOGGLE_BUS ), EnumSet.noneOf( IntegrationType.class ), PartInvertedToggleBus.class ),
|
||||
INVERTED_TOGGLE_BUS(EnumSet.of( AEFeature.TOGGLE_BUS ), EnumSet.noneOf( IntegrationType.class ), PartInvertedToggleBus.class ),
|
||||
|
||||
CABLE_ANCHOR( 120, "cable_anchor", EnumSet.of( AEFeature.CABLE_ANCHOR ), EnumSet.noneOf( IntegrationType.class ), PartCableAnchor.class ),
|
||||
CABLE_ANCHOR(EnumSet.of( AEFeature.CABLE_ANCHOR ), EnumSet.noneOf( IntegrationType.class ), PartCableAnchor.class ),
|
||||
|
||||
QUARTZ_FIBER( 140, "quartz_fiber", EnumSet.of( AEFeature.QUARTZ_FIBER ), EnumSet.noneOf( IntegrationType.class ), PartQuartzFiber.class ),
|
||||
QUARTZ_FIBER(EnumSet.of( AEFeature.QUARTZ_FIBER ), EnumSet.noneOf( IntegrationType.class ), PartQuartzFiber.class ),
|
||||
|
||||
MONITOR( 160, "monitor", EnumSet.of( AEFeature.PANELS ), EnumSet.noneOf( IntegrationType.class ), PartPanel.class, "itemIlluminatedPanel" ),
|
||||
MONITOR(EnumSet.of( AEFeature.PANELS ), EnumSet.noneOf( IntegrationType.class ), PartPanel.class, "itemIlluminatedPanel" ),
|
||||
|
||||
SEMI_DARK_MONITOR( 180, "semi_dark_monitor", EnumSet.of( AEFeature.PANELS ), EnumSet
|
||||
SEMI_DARK_MONITOR(EnumSet.of( AEFeature.PANELS ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartSemiDarkPanel.class, "itemIlluminatedPanel" ),
|
||||
|
||||
DARK_MONITOR( 200, "dark_monitor", EnumSet.of( AEFeature.PANELS ), EnumSet.noneOf( IntegrationType.class ), PartDarkPanel.class, "itemIlluminatedPanel" ),
|
||||
DARK_MONITOR(EnumSet.of( AEFeature.PANELS ), EnumSet.noneOf( IntegrationType.class ), PartDarkPanel.class, "itemIlluminatedPanel" ),
|
||||
|
||||
STORAGE_BUS( 220, "storage_bus", EnumSet.of( AEFeature.STORAGE_BUS ), EnumSet.noneOf( IntegrationType.class ), PartStorageBus.class ),
|
||||
FLUID_STORAGE_BUS( 221, "fluid_storage_bus", EnumSet.of( AEFeature.FLUID_STORAGE_BUS ), EnumSet
|
||||
STORAGE_BUS(EnumSet.of( AEFeature.STORAGE_BUS ), EnumSet.noneOf( IntegrationType.class ), PartStorageBus.class ),
|
||||
FLUID_STORAGE_BUS(EnumSet.of( AEFeature.FLUID_STORAGE_BUS ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartFluidStorageBus.class ),
|
||||
|
||||
IMPORT_BUS( 240, "import_bus", EnumSet.of( AEFeature.IMPORT_BUS ), EnumSet.noneOf( IntegrationType.class ), PartImportBus.class ),
|
||||
IMPORT_BUS(EnumSet.of( AEFeature.IMPORT_BUS ), EnumSet.noneOf( IntegrationType.class ), PartImportBus.class ),
|
||||
|
||||
FLUID_IMPORT_BUS( 241, "fluid_import_bus", EnumSet.of( AEFeature.FLUID_IMPORT_BUS ), EnumSet.noneOf( IntegrationType.class ), PartFluidImportBus.class ),
|
||||
FLUID_IMPORT_BUS(EnumSet.of( AEFeature.FLUID_IMPORT_BUS ), EnumSet.noneOf( IntegrationType.class ), PartFluidImportBus.class ),
|
||||
|
||||
EXPORT_BUS( 260, "export_bus", EnumSet.of( AEFeature.EXPORT_BUS ), EnumSet.noneOf( IntegrationType.class ), PartExportBus.class ),
|
||||
EXPORT_BUS(EnumSet.of( AEFeature.EXPORT_BUS ), EnumSet.noneOf( IntegrationType.class ), PartExportBus.class ),
|
||||
|
||||
FLUID_EXPORT_BUS( 261, "fluid_export_bus", EnumSet.of( AEFeature.FLUID_EXPORT_BUS ), EnumSet.noneOf( IntegrationType.class ), PartFluidExportBus.class ),
|
||||
FLUID_EXPORT_BUS(EnumSet.of( AEFeature.FLUID_EXPORT_BUS ), EnumSet.noneOf( IntegrationType.class ), PartFluidExportBus.class ),
|
||||
|
||||
LEVEL_EMITTER( 280, "level_emitter", EnumSet.of( AEFeature.LEVEL_EMITTER ), EnumSet.noneOf( IntegrationType.class ), PartLevelEmitter.class ),
|
||||
FLUID_LEVEL_EMITTER( 281, "fluid_level_emitter", EnumSet.of( AEFeature.FLUID_LEVEL_EMITTER ), EnumSet
|
||||
LEVEL_EMITTER(EnumSet.of( AEFeature.LEVEL_EMITTER ), EnumSet.noneOf( IntegrationType.class ), PartLevelEmitter.class ),
|
||||
FLUID_LEVEL_EMITTER(EnumSet.of( AEFeature.FLUID_LEVEL_EMITTER ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartFluidLevelEmitter.class ),
|
||||
|
||||
ANNIHILATION_PLANE( 300, "annihilation_plane", EnumSet.of( AEFeature.ANNIHILATION_PLANE ), EnumSet
|
||||
ANNIHILATION_PLANE(EnumSet.of( AEFeature.ANNIHILATION_PLANE ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartAnnihilationPlane.class ),
|
||||
|
||||
IDENTITY_ANNIHILATION_PLANE( 301, "identity_annihilation_plane", EnumSet.of( AEFeature.ANNIHILATION_PLANE, AEFeature.IDENTITY_ANNIHILATION_PLANE ), EnumSet
|
||||
IDENTITY_ANNIHILATION_PLANE(EnumSet.of( AEFeature.ANNIHILATION_PLANE, AEFeature.IDENTITY_ANNIHILATION_PLANE ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartIdentityAnnihilationPlane.class ),
|
||||
|
||||
FLUID_ANNIHILATION_PLANE( 302, "fluid_annihilation_plane", EnumSet.of( AEFeature.FLUID_ANNIHILATION_PLANE ), EnumSet
|
||||
FLUID_ANNIHILATION_PLANE(EnumSet.of( AEFeature.FLUID_ANNIHILATION_PLANE ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartFluidAnnihilationPlane.class ),
|
||||
|
||||
FORMATION_PLANE( 320, "formation_plane", EnumSet.of( AEFeature.FORMATION_PLANE ), EnumSet.noneOf( IntegrationType.class ), PartFormationPlane.class ),
|
||||
FORMATION_PLANE(EnumSet.of( AEFeature.FORMATION_PLANE ), EnumSet.noneOf( IntegrationType.class ), PartFormationPlane.class ),
|
||||
|
||||
FLUID_FORMATION_PLANE( 321, "fluid_formation_plane", EnumSet.of( AEFeature.FLUID_FORMATION_PLANE ), EnumSet
|
||||
FLUID_FORMATION_PLANE(EnumSet.of( AEFeature.FLUID_FORMATION_PLANE ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartFluidFormationPlane.class ),
|
||||
|
||||
PATTERN_TERMINAL( 340, "pattern_terminal", EnumSet.of( AEFeature.PATTERNS ), EnumSet.noneOf( IntegrationType.class ), PartPatternTerminal.class ),
|
||||
PATTERN_TERMINAL(EnumSet.of( AEFeature.PATTERNS ), EnumSet.noneOf( IntegrationType.class ), PartPatternTerminal.class ),
|
||||
|
||||
CRAFTING_TERMINAL( 360, "crafting_terminal", EnumSet.of( AEFeature.CRAFTING_TERMINAL ), EnumSet
|
||||
CRAFTING_TERMINAL(EnumSet.of( AEFeature.CRAFTING_TERMINAL ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartCraftingTerminal.class ),
|
||||
|
||||
TERMINAL( 380, "terminal", EnumSet.of( AEFeature.TERMINAL ), EnumSet.noneOf( IntegrationType.class ), PartTerminal.class ),
|
||||
TERMINAL(EnumSet.of( AEFeature.TERMINAL ), EnumSet.noneOf( IntegrationType.class ), PartTerminal.class ),
|
||||
|
||||
STORAGE_MONITOR( 400, "storage_monitor", EnumSet.of( AEFeature.STORAGE_MONITOR ), EnumSet.noneOf( IntegrationType.class ), PartStorageMonitor.class ),
|
||||
STORAGE_MONITOR(EnumSet.of( AEFeature.STORAGE_MONITOR ), EnumSet.noneOf( IntegrationType.class ), PartStorageMonitor.class ),
|
||||
|
||||
CONVERSION_MONITOR( 420, "conversion_monitor", EnumSet.of( AEFeature.PART_CONVERSION_MONITOR ), EnumSet
|
||||
CONVERSION_MONITOR(EnumSet.of( AEFeature.PART_CONVERSION_MONITOR ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartConversionMonitor.class ),
|
||||
|
||||
INTERFACE( 440, "interface", EnumSet.of( AEFeature.INTERFACE ), EnumSet.noneOf( IntegrationType.class ), PartInterface.class ),
|
||||
FLUID_INTERFACE( 441, "fluid_interface", EnumSet.of( AEFeature.FLUID_INTERFACE ), EnumSet.noneOf( IntegrationType.class ), PartFluidInterface.class ),
|
||||
INTERFACE(EnumSet.of( AEFeature.INTERFACE ), EnumSet.noneOf( IntegrationType.class ), PartInterface.class ),
|
||||
FLUID_INTERFACE(EnumSet.of( AEFeature.FLUID_INTERFACE ), EnumSet.noneOf( IntegrationType.class ), PartFluidInterface.class ),
|
||||
|
||||
P2P_TUNNEL_ME( 460, "p2p_tunnel_me", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_ME ), EnumSet
|
||||
P2P_TUNNEL_ME(EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_ME ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartP2PTunnelME.class, GuiText.METunnel )
|
||||
{
|
||||
@Override
|
||||
@@ -238,7 +184,7 @@ public enum PartType
|
||||
}
|
||||
},
|
||||
|
||||
P2P_TUNNEL_REDSTONE( 461, "p2p_tunnel_redstone", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_REDSTONE ), EnumSet
|
||||
P2P_TUNNEL_REDSTONE(EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_REDSTONE ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartP2PRedstone.class, GuiText.RedstoneTunnel )
|
||||
{
|
||||
@Override
|
||||
@@ -248,7 +194,7 @@ public enum PartType
|
||||
}
|
||||
},
|
||||
|
||||
P2P_TUNNEL_ITEMS( 462, "p2p_tunnel_items", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_ITEMS ), EnumSet
|
||||
P2P_TUNNEL_ITEM(EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_ITEMS ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartP2PItems.class, GuiText.ItemTunnel )
|
||||
{
|
||||
@Override
|
||||
@@ -258,7 +204,7 @@ public enum PartType
|
||||
}
|
||||
},
|
||||
|
||||
P2P_TUNNEL_FLUIDS( 463, "p2p_tunnel_fluids", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_FLUIDS ), EnumSet
|
||||
P2P_TUNNEL_FLUID(EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_FLUIDS ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartP2PFluids.class, GuiText.FluidTunnel )
|
||||
{
|
||||
@Override
|
||||
@@ -278,7 +224,7 @@ public enum PartType
|
||||
//FIXME }
|
||||
//FIXME },
|
||||
|
||||
P2P_TUNNEL_LIGHT( 467, "p2p_tunnel_light", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_LIGHT ), EnumSet
|
||||
P2P_TUNNEL_LIGHT(EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_LIGHT ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartP2PLight.class, GuiText.LightTunnel )
|
||||
{
|
||||
@Override
|
||||
@@ -288,7 +234,7 @@ public enum PartType
|
||||
}
|
||||
},
|
||||
|
||||
P2P_TUNNEL_FE( 469, "p2p_tunnel_fe", EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_FE ), EnumSet
|
||||
P2P_TUNNEL_FE(EnumSet.of( AEFeature.P2P_TUNNEL, AEFeature.P2P_TUNNEL_FE ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartP2PFEPower.class, GuiText.FETunnel )
|
||||
{
|
||||
@Override
|
||||
@@ -301,100 +247,50 @@ public enum PartType
|
||||
// P2PTunnelOpenComputers( 468, EnumSet.of( AEFeature.P2PTunnel, AEFeature.P2PTunnelOpenComputers ), EnumSet.of(
|
||||
// IntegrationType.OpenComputers ), PartP2POpenComputers.class, GuiText.OCTunnel ),
|
||||
|
||||
INTERFACE_TERMINAL( 480, "interface_terminal", EnumSet.of( AEFeature.INTERFACE_TERMINAL ), EnumSet
|
||||
INTERFACE_TERMINAL(EnumSet.of( AEFeature.INTERFACE_TERMINAL ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartInterfaceTerminal.class ),
|
||||
|
||||
FLUID_TERMINAL( 520, "fluid_terminal", EnumSet.of( AEFeature.FLUID_TERMINAL ), EnumSet.noneOf( IntegrationType.class ), PartFluidTerminal.class );
|
||||
FLUID_TERMINAL(EnumSet.of( AEFeature.FLUID_TERMINAL ), EnumSet.noneOf( IntegrationType.class ), PartFluidTerminal.class );
|
||||
|
||||
private final int baseDamage;
|
||||
private final Set<AEFeature> features;
|
||||
private final Set<IntegrationType> integrations;
|
||||
private final Class<? extends IPart> myPart;
|
||||
private final GuiText extraName;
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
private List<ModelResourceLocation> itemModels;
|
||||
private final Set<ResourceLocation> models;
|
||||
private final boolean enabled;
|
||||
private Constructor<? extends IPart> constructor;
|
||||
private final String oreName;
|
||||
|
||||
PartType( final int baseMetaValue, final String itemModel, final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c )
|
||||
PartType(final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c)
|
||||
{
|
||||
this( baseMetaValue, itemModel, features, integrations, c, null, null );
|
||||
this(features, integrations, c, null, null );
|
||||
}
|
||||
|
||||
PartType( final int baseMetaValue, final String itemModel, final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c, final String oreDict )
|
||||
PartType(final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c, final String oreDict)
|
||||
{
|
||||
this( baseMetaValue, itemModel, features, integrations, c, null, oreDict );
|
||||
this(features, integrations, c, null, oreDict );
|
||||
}
|
||||
|
||||
PartType( final int baseMetaValue, final String itemModel, final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c, final GuiText en )
|
||||
PartType(final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c, final GuiText en)
|
||||
{
|
||||
this( baseMetaValue, itemModel, features, integrations, c, en, null );
|
||||
this(features, integrations, c, en, null );
|
||||
}
|
||||
|
||||
PartType( final int baseMetaValue, final String itemModel, final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c, final GuiText en, final String oreDict )
|
||||
PartType(final Set<AEFeature> features, final Set<IntegrationType> integrations, final Class<? extends IPart> c, final GuiText en, final String oreDict)
|
||||
{
|
||||
this.baseDamage = baseMetaValue;
|
||||
this.features = Collections.unmodifiableSet( features );
|
||||
this.integrations = Collections.unmodifiableSet( integrations );
|
||||
this.myPart = c;
|
||||
this.extraName = en;
|
||||
this.oreName = oreDict;
|
||||
|
||||
// The part is enabled if all features + integrations it needs are enabled
|
||||
this.enabled = features.stream().allMatch( AEConfig.instance()::isFeatureEnabled ); /* FIXME && integrations.stream()
|
||||
.allMatch( IntegrationRegistry.INSTANCE::isEnabled ); */
|
||||
|
||||
if( this.enabled )
|
||||
if( c != null )
|
||||
{
|
||||
// Only load models if the part is enabled, otherwise we also run into class-loading issues while
|
||||
// scanning for annotations
|
||||
if( Platform.isClientInstall() )
|
||||
{
|
||||
this.itemModels = this.createItemModels( itemModel );
|
||||
}
|
||||
if( c != null )
|
||||
{
|
||||
this.models = new HashSet<>( PartModelsHelper.createModels( c ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
this.models = Collections.emptySet();
|
||||
}
|
||||
this.models = new HashSet<>( PartModelsHelper.createModels( c ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( Platform.isClientInstall() )
|
||||
{
|
||||
this.itemModels = Collections.emptyList();
|
||||
}
|
||||
this.models = Collections.emptySet();
|
||||
}
|
||||
}
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
protected List<ModelResourceLocation> createItemModels( String baseName )
|
||||
{
|
||||
return ImmutableList.of( modelFromBaseName( baseName ) );
|
||||
}
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
private static ModelResourceLocation modelFromBaseName( String baseName )
|
||||
{
|
||||
return new ModelResourceLocation( new ResourceLocation( AppEng.MOD_ID, "part/" + baseName ), "inventory" );
|
||||
}
|
||||
|
||||
public boolean isEnabled()
|
||||
{
|
||||
return this.enabled;
|
||||
}
|
||||
|
||||
int getBaseDamage()
|
||||
{
|
||||
return this.baseDamage;
|
||||
}
|
||||
|
||||
public boolean isCable()
|
||||
{
|
||||
return false;
|
||||
@@ -420,22 +316,11 @@ public enum PartType
|
||||
return this.extraName;
|
||||
}
|
||||
|
||||
void setConstructor( final Constructor<? extends IPart> constructor )
|
||||
{
|
||||
this.constructor = constructor;
|
||||
}
|
||||
|
||||
public String getOreName()
|
||||
{
|
||||
return this.oreName;
|
||||
}
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public List<ModelResourceLocation> getItemModels()
|
||||
{
|
||||
return this.itemModels;
|
||||
}
|
||||
|
||||
public Set<ResourceLocation> getModels()
|
||||
{
|
||||
return this.models;
|
||||
|
||||
@@ -21,7 +21,11 @@ package appeng.parts.reporting;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import appeng.container.ContainerLocator;
|
||||
import appeng.container.ContainerOpener;
|
||||
import appeng.container.implementations.ContainerMEMonitorable;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.Hand;
|
||||
@@ -115,18 +119,18 @@ public abstract class AbstractPartTerminal extends AbstractPartDisplay implement
|
||||
{
|
||||
if( !super.onPartActivate( player, hand, pos ) )
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
if( !player.world.isRemote )
|
||||
{
|
||||
// FIXME Platform.openGUI( player, this.getHost().getTile(), this.getSide(), this.getGui( player ) );
|
||||
ContainerOpener.openContainer(getContainerType(player), player, ContainerLocator.forPart(this));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// FIXME public GuiBridge getGui( final PlayerEntity player )
|
||||
// FIXME {
|
||||
// FIXME return GuiBridge.GUI_ME;
|
||||
// FIXME }
|
||||
public ContainerType<?> getContainerType(final PlayerEntity player )
|
||||
{
|
||||
return ContainerMEMonitorable.TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends IAEStack<T>> IMEMonitor<T> getInventory( IStorageChannel<T> channel )
|
||||
|
||||
@@ -21,7 +21,13 @@ package appeng.parts.reporting;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.container.implementations.ContainerCraftingTerm;
|
||||
import appeng.container.implementations.ContainerMEMonitorable;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -84,25 +90,15 @@ public class PartCraftingTerminal extends AbstractPartTerminal
|
||||
this.craftingGrid.writeToNBT( data, "craftingGrid" );
|
||||
}
|
||||
|
||||
// FIXME @Override
|
||||
// FIXME public GuiBridge getGui( final PlayerEntity p )
|
||||
// FIXME {
|
||||
// FIXME int x = (int) p.getPosX();
|
||||
// FIXME int y = (int) p.getPosY();
|
||||
// FIXME int z = (int) p.getPosZ();
|
||||
// FIXME if( this.getHost().getTile() != null )
|
||||
// FIXME {
|
||||
// FIXME x = this.getTile().getPos().getX();
|
||||
// FIXME y = this.getTile().getPos().getY();
|
||||
// FIXME z = this.getTile().getPos().getZ();
|
||||
// FIXME }
|
||||
// FIXME
|
||||
// FIXME if( GuiBridge.GUI_CRAFTING_TERMINAL.hasPermissions( this.getHost().getTile(), x, y, z, this.getSide(), p ) )
|
||||
// FIXME {
|
||||
// FIXME return GuiBridge.GUI_CRAFTING_TERMINAL;
|
||||
// FIXME }
|
||||
// FIXME return GuiBridge.GUI_ME;
|
||||
// FIXME }
|
||||
@Override
|
||||
public ContainerType<?> getContainerType(final PlayerEntity p )
|
||||
{
|
||||
if( Platform.checkPermissions( p, this, SecurityPermissions.CRAFT, false) )
|
||||
{
|
||||
return ContainerCraftingTerm.TYPE;
|
||||
}
|
||||
return ContainerMEMonitorable.TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemHandler getInventoryByName( final String name )
|
||||
|
||||
@@ -21,7 +21,12 @@ package appeng.parts.reporting;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.container.implementations.ContainerMEMonitorable;
|
||||
import appeng.container.implementations.ContainerPatternTerm;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -99,25 +104,15 @@ public class PartPatternTerminal extends AbstractPartTerminal
|
||||
this.crafting.writeToNBT( data, "craftingGrid" );
|
||||
}
|
||||
|
||||
// FIXME @Override
|
||||
// FIXME public GuiBridge getGui( final PlayerEntity p )
|
||||
// FIXME {
|
||||
// FIXME int x = (int) p.getPosX();
|
||||
// FIXME int y = (int) p.getPosY();
|
||||
// FIXME int z = (int) p.getPosZ();
|
||||
// FIXME if( this.getHost().getTile() != null )
|
||||
// FIXME {
|
||||
// FIXME x = this.getTile().getPos().getX();
|
||||
// FIXME y = this.getTile().getPos().getY();
|
||||
// FIXME z = this.getTile().getPos().getZ();
|
||||
// FIXME }
|
||||
// FIXME
|
||||
// FIXME if( GuiBridge.GUI_PATTERN_TERMINAL.hasPermissions( this.getHost().getTile(), x, y, z, this.getSide(), p ) )
|
||||
// FIXME {
|
||||
// FIXME return GuiBridge.GUI_PATTERN_TERMINAL;
|
||||
// FIXME }
|
||||
// FIXME return GuiBridge.GUI_ME;
|
||||
// FIXME }
|
||||
@Override
|
||||
public ContainerType<?> getContainerType(final PlayerEntity p )
|
||||
{
|
||||
if(Platform.checkPermissions(p, this, SecurityPermissions.CRAFT, false) )
|
||||
{
|
||||
return ContainerPatternTerm.TYPE;
|
||||
}
|
||||
return ContainerMEMonitorable.TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory( final IItemHandler inv, final int slot, final InvOperation mc, final ItemStack removedStack, final ItemStack newStack )
|
||||
|
||||
@@ -29,7 +29,7 @@ import appeng.api.parts.IPart;
|
||||
import appeng.tile.AEBaseTile;
|
||||
|
||||
|
||||
public class CableBusTESR extends TileEntityRenderer<TileCableBusTESR>
|
||||
public class CableBusTESR extends TileEntityRenderer<TileCableBus>
|
||||
{
|
||||
|
||||
public CableBusTESR(TileEntityRendererDispatcher rendererDispatcherIn) {
|
||||
@@ -37,7 +37,11 @@ public class CableBusTESR extends TileEntityRenderer<TileCableBusTESR>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(TileCableBusTESR te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffers, int combinedLightIn, int combinedOverlayIn) {
|
||||
public void render(TileCableBus te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffers, int combinedLightIn, int combinedOverlayIn) {
|
||||
if (!te.getCableBus().isRequiresDynamicRender()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for( Direction facing : Direction.values() )
|
||||
{
|
||||
IPart part = te.getPart( facing );
|
||||
|
||||
@@ -62,8 +62,6 @@ import java.util.Set;
|
||||
public class TileCableBus extends AEBaseTile implements AEMultiTile
|
||||
{
|
||||
|
||||
public static final ModelProperty<CableBusRenderState> RENDER_STATE_PROPERTY = new ModelProperty<>();
|
||||
|
||||
private CableBusContainer cb = new CableBusContainer( this );
|
||||
|
||||
private int oldLV = -1; // on re-calculate light when it changes
|
||||
@@ -117,19 +115,19 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile
|
||||
*/
|
||||
protected void updateTileSetting()
|
||||
{
|
||||
if( this.getCableBus().isRequiresDynamicRender() )
|
||||
{
|
||||
try
|
||||
{
|
||||
final TileCableBus tcb = (TileCableBus) BlockCableBus.getTesrTile().newInstance();
|
||||
tcb.copyFrom( this );
|
||||
this.getWorld().setTileEntity( this.pos, tcb );
|
||||
}
|
||||
catch( final Throwable ignored )
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
// FIXME if( this.getCableBus().isRequiresDynamicRender() )
|
||||
// FIXME {
|
||||
// FIXME try
|
||||
// FIXME {
|
||||
// FIXME final TileCableBus tcb = (TileCableBus) BlockCableBus.getTesrTile().newInstance();
|
||||
// FIXME tcb.copyFrom( this );
|
||||
// FIXME this.getWorld().setTileEntity( this.pos, tcb );
|
||||
// FIXME }
|
||||
// FIXME catch( final Throwable ignored )
|
||||
// FIXME {
|
||||
// FIXME
|
||||
// FIXME }
|
||||
// FIXME }
|
||||
}
|
||||
|
||||
protected void copyFrom( final TileCableBus oldTile )
|
||||
@@ -401,7 +399,7 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile
|
||||
renderState.setWorld(world);
|
||||
renderState.setPos(pos);
|
||||
return new ModelDataMap.Builder()
|
||||
.withInitial(RENDER_STATE_PROPERTY, renderState)
|
||||
.withInitial(CableBusRenderState.PROPERTY, renderState)
|
||||
.build();
|
||||
|
||||
}
|
||||
|
||||
@@ -36,18 +36,18 @@ public class TileCableBusTESR extends TileCableBus
|
||||
@Override
|
||||
protected void updateTileSetting()
|
||||
{
|
||||
if( !this.getCableBus().isRequiresDynamicRender() )
|
||||
{
|
||||
try
|
||||
{
|
||||
final TileCableBus tcb = (TileCableBus) BlockCableBus.getNoTesrTile().newInstance();
|
||||
tcb.copyFrom( this );
|
||||
this.getWorld().setTileEntity( this.pos, tcb );
|
||||
}
|
||||
catch( final Throwable ignored )
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
// FIXME if( !this.getCableBus().isRequiresDynamicRender() )
|
||||
// FIXME {
|
||||
// FIXME try
|
||||
// FIXME {
|
||||
// FIXME final TileCableBus tcb = (TileCableBus) BlockCableBus.getNoTesrTile().newInstance();
|
||||
// FIXME tcb.copyFrom( this );
|
||||
// FIXME this.getWorld().setTileEntity( this.pos, tcb );
|
||||
// FIXME }
|
||||
// FIXME catch( final Throwable ignored )
|
||||
// FIXME {
|
||||
// FIXME
|
||||
// FIXME }
|
||||
// FIXME }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
@@ -43,15 +44,16 @@ public abstract class InventoryAdaptor implements Iterable<ItemSlot>
|
||||
{
|
||||
public static InventoryAdaptor getAdaptor( final TileEntity te, final Direction d )
|
||||
{
|
||||
// FIXME if( te != null && te.getCapability( CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, d ) )
|
||||
// FIXME {
|
||||
// FIXME // Attempt getting an IItemHandler for the given side via caps
|
||||
// FIXME IItemHandler itemHandler = te.getCapability( CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, d );
|
||||
// FIXME if( itemHandler != null )
|
||||
// FIXME {
|
||||
// FIXME return new AdaptorItemHandler( itemHandler );
|
||||
// FIXME }
|
||||
// FIXME }
|
||||
if( te != null )
|
||||
{
|
||||
LazyOptional<IItemHandler> cap = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, d);
|
||||
|
||||
// Attempt getting an IItemHandler for the given side via caps
|
||||
if( cap.isPresent() )
|
||||
{
|
||||
return new AdaptorItemHandler( cap.orElseThrow(IllegalStateException::new) );
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ import appeng.api.networking.security.IActionHost;
|
||||
import appeng.api.networking.security.IActionSource;
|
||||
import appeng.api.networking.security.ISecurityGrid;
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||
@@ -77,6 +78,7 @@ import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.*;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
@@ -325,44 +327,6 @@ public class Platform
|
||||
return false;
|
||||
}
|
||||
|
||||
// public static void openGUI(@Nonnull final PlayerEntity p, @Nullable final TileEntity tile, @Nullable final AEPartLocation side, @Nonnull final ContainerType<?> type )
|
||||
// {
|
||||
// if( isClient() )
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// int x = (int) p.getPosX();
|
||||
// int y = (int) p.getPosY();
|
||||
// int z = (int) p.getPosZ();
|
||||
// if( tile != null )
|
||||
// {
|
||||
// x = tile.getPos().getX();
|
||||
// y = tile.getPos().getY();
|
||||
// z = tile.getPos().getZ();
|
||||
// }
|
||||
//
|
||||
// if( ( type.getType().isItem() && tile == null ) || type.hasPermissions( tile, x, y, z, side, p ) )
|
||||
// {
|
||||
// if( tile == null && type.getType() == GuiHostType.ITEM )
|
||||
// {
|
||||
// NetworkHooks.openGui(p, );
|
||||
// // FIXME NetworkHooks.openGui
|
||||
// // p.openGui( AppEng.instance(), type.ordinal() << 4, p.getEntityWorld(), p.inventory.currentItem, 0, 0 );
|
||||
// }
|
||||
// else if( tile == null || type.getType() == GuiHostType.ITEM )
|
||||
// {
|
||||
// // FIXME NetworkHooks.openGui
|
||||
// // p.openGui( AppEng.instance(), type.ordinal() << 4 | ( 1 << 3 ), p.getEntityWorld(), x, y, z );
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// // FIXME NetworkHooks.openGui
|
||||
// // p.openGui( AppEng.instance(), type.ordinal() << 4 | ( side.ordinal() ), tile.getWorld(), x, y, z );
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* @return True if client-side classes (such as Renderers) are available.
|
||||
*/
|
||||
@@ -393,6 +357,37 @@ public class Platform
|
||||
}
|
||||
return player.world.canMineBlockBody( player, dc.getPos() );
|
||||
}
|
||||
|
||||
public static boolean checkPermissions(final PlayerEntity player, final Object accessInterface, SecurityPermissions requiredPermission, boolean notifyPlayer) {
|
||||
// FIXME: Check permissions...
|
||||
if (requiredPermission != null && accessInterface instanceof IActionHost) {
|
||||
final IGridNode gn = ((IActionHost) accessInterface).getActionableNode();
|
||||
if (gn != null) {
|
||||
final IGrid g = gn.getGrid();
|
||||
if (g != null) {
|
||||
final boolean requirePower = false;
|
||||
if (requirePower) {
|
||||
final IEnergyGrid eg = g.getCache(IEnergyGrid.class);
|
||||
if (!eg.isNetworkPowered()) {
|
||||
// FIXME trace logging?
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
final ISecurityGrid sg = g.getCache(ISecurityGrid.class);
|
||||
if (!sg.hasPermission(player, requiredPermission)) {
|
||||
player.sendMessage(new TranslationTextComponent("appliedenergistics2.permission_denied")
|
||||
.applyTextStyle(TextFormatting.RED));
|
||||
// FIXME trace logging?
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//
|
||||
// /*
|
||||
// * Checks to see if a block is air?
|
||||
|
||||
Reference in New Issue
Block a user