Compiles again.
This commit is contained in:
@@ -21,22 +21,15 @@ package appeng.block;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import appeng.util.LookDirection;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.state.IProperty;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.*;
|
||||
import net.minecraft.util.math.shapes.EntitySelectionContext;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
@@ -45,7 +38,6 @@ import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
|
||||
|
||||
public abstract class AEBaseBlock extends Block
|
||||
@@ -85,12 +77,6 @@ public abstract class AEBaseBlock extends Block
|
||||
// FIXME this.setHarvestLevel( "pickaxe", 0 );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||
super.fillStateContainer(builder);
|
||||
builder.add(getAEStates());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNormalCube(BlockState state, IBlockReader worldIn, BlockPos pos) {
|
||||
return this.isFullSize() && this.isOpaque();
|
||||
@@ -211,9 +197,9 @@ public abstract class AEBaseBlock extends Block
|
||||
//FIXME
|
||||
//FIXME if( r != null )
|
||||
//FIXME {
|
||||
//FIXME final double xLen = ( a.x - r.hitVec.x );
|
||||
//FIXME final double yLen = ( a.y - r.hitVec.y );
|
||||
//FIXME final double zLen = ( a.z - r.hitVec.z );
|
||||
//FIXME final double xLen = ( a.x - r.getHitVec().x );
|
||||
//FIXME final double yLen = ( a.y - r.getHitVec().y );
|
||||
//FIXME final double zLen = ( a.z - r.getHitVec().z );
|
||||
//FIXME
|
||||
//FIXME final double thisDist = xLen * xLen + yLen * yLen + zLen * zLen;
|
||||
//FIXME if( br == null || lastDist > thisDist )
|
||||
@@ -396,21 +382,6 @@ public abstract class AEBaseBlock extends Block
|
||||
return true;
|
||||
}
|
||||
|
||||
protected ICustomCollision getCustomCollision( final IBlockReader w, final BlockPos pos )
|
||||
{
|
||||
if( this instanceof ICustomCollision )
|
||||
{
|
||||
return (ICustomCollision) this;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
protected IProperty[] getAEStates()
|
||||
{
|
||||
return new IProperty[0];
|
||||
}
|
||||
|
||||
protected boolean isOpaque()
|
||||
{
|
||||
return this.isOpaque;
|
||||
|
||||
+4
-3
@@ -27,6 +27,7 @@ import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -38,7 +39,6 @@ import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.api.implementations.items.IAEItemPowerStorage;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class AEBaseBlockItemChargeable extends AEBaseBlockItem implements IAEItemPowerStorage
|
||||
@@ -65,8 +65,9 @@ public class AEBaseBlockItemChargeable extends AEBaseBlockItem implements IAEIte
|
||||
|
||||
final double percent = internalCurrentPower / internalMaxPower;
|
||||
|
||||
lines.add( GuiText.StoredEnergy.getLocal() + ':' + MessageFormat.format( " {0,number,#} ", internalCurrentPower ) + Platform
|
||||
.gui_localize( PowerUnits.AE.unlocalizedName ) + " - " + MessageFormat.format( " {0,number,#.##%} ", percent ) );
|
||||
lines.add( GuiText.StoredEnergy.textComponent().appendText(':' + MessageFormat.format( " {0,number,#} ", internalCurrentPower ))
|
||||
.appendSibling(new TranslationTextComponent( PowerUnits.AE.unlocalizedName ))
|
||||
.appendText(" - " + MessageFormat.format( " {0,number,#.##%} ", percent )));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,21 +26,16 @@ import java.util.function.Supplier;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import appeng.bootstrap.definitions.TileEntityDefinition;
|
||||
import appeng.core.features.TileDefinition;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
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.state.StateContainer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
@@ -57,7 +52,6 @@ import appeng.api.implementations.items.MemoryCardMessages;
|
||||
import appeng.api.implementations.tiles.IColorableTile;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import appeng.tile.AEBaseInvTile;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.util.Platform;
|
||||
@@ -80,39 +74,6 @@ public abstract class AEBaseTileBlock<T extends AEBaseTile> extends AEBaseBlock
|
||||
super( props );
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getExtendedState( BlockState state, IBlockReader world, BlockPos pos )
|
||||
{
|
||||
// FIXME
|
||||
// // A subclass may decide it doesn't want extended block state for whatever reason
|
||||
// if( !( state instanceof IExtendedBlockState ) )
|
||||
// {
|
||||
// return state;
|
||||
// }
|
||||
//
|
||||
// AEBaseTile tile = this.getTileEntity( world, pos );
|
||||
// if( tile == null )
|
||||
// {
|
||||
// return state; // No info available
|
||||
// }
|
||||
//
|
||||
// IExtendedBlockState extState = (IExtendedBlockState) state;
|
||||
// return extState.with( FORWARD, tile.getForward() ).with( UP, tile.getUp() );
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||
super.fillStateContainer(builder);
|
||||
|
||||
// TODO: Rendering stuff
|
||||
|
||||
// return new ExtendedBlockState( this, this.getAEStates(), new IUnlistedProperty[] {
|
||||
// FORWARD,
|
||||
// UP
|
||||
// } );
|
||||
}
|
||||
|
||||
// TODO : Was this change needed?
|
||||
public void setTileEntity( final Class<T> tileEntityClass, Supplier<T> factory )
|
||||
{
|
||||
@@ -361,16 +322,4 @@ public abstract class AEBaseTileBlock<T extends AEBaseTile> extends AEBaseBlock
|
||||
return this.getTileEntity( w, pos );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICustomCollision getCustomCollision( final IBlockReader w, final BlockPos pos )
|
||||
{
|
||||
final AEBaseTile te = this.getTileEntity( w, pos );
|
||||
if( te instanceof ICustomCollision )
|
||||
{
|
||||
return (ICustomCollision) te;
|
||||
}
|
||||
|
||||
return super.getCustomCollision( w, pos );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* 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.block;
|
||||
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
|
||||
|
||||
public final class UnlistedBlockPos implements IUnlistedProperty<BlockPos>
|
||||
{
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return "pos";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid( final BlockPos value )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<BlockPos> getType()
|
||||
{
|
||||
return BlockPos.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String valueToString( final BlockPos value )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* 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.block;
|
||||
|
||||
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
|
||||
|
||||
public class UnlistedDirection implements IUnlistedProperty<Direction>
|
||||
{
|
||||
|
||||
private final String name;
|
||||
|
||||
public UnlistedDirection( String name )
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid( Direction value )
|
||||
{
|
||||
return value != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Direction> getType()
|
||||
{
|
||||
return Direction.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String valueToString( Direction value )
|
||||
{
|
||||
return value.getName();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -37,12 +37,12 @@ import appeng.tile.misc.TileCellWorkbench;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class BlockCellWorkbench extends AEBaseTileBlock
|
||||
public class BlockCellWorkbench extends AEBaseTileBlock<TileCellWorkbench>
|
||||
{
|
||||
|
||||
public BlockCellWorkbench()
|
||||
{
|
||||
super( Material.IRON );
|
||||
super( Properties.create(Material.IRON) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -58,7 +58,7 @@ public class BlockCellWorkbench extends AEBaseTileBlock
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_CELL_WORKBENCH );
|
||||
// FIXME Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit.getFace()), GuiBridge.GUI_CELL_WORKBENCH );
|
||||
}
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
@@ -19,24 +19,27 @@
|
||||
package appeng.block.misc;
|
||||
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import appeng.core.Api;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.Matrix4f;
|
||||
import net.minecraft.client.renderer.Vector3f;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
@@ -47,31 +50,32 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.util.AEAxisAlignedBB;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.client.render.effects.LightningFX;
|
||||
import appeng.client.render.renderable.ItemRenderable;
|
||||
import appeng.client.render.tesr.ModularTESR;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.misc.TileCharger;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class BlockCharger extends AEBaseTileBlock implements ICustomCollision
|
||||
public class BlockCharger extends AEBaseTileBlock<TileCharger>
|
||||
{
|
||||
|
||||
public BlockCharger()
|
||||
{
|
||||
super( Material.IRON );
|
||||
super( Properties.create(Material.IRON) );
|
||||
|
||||
this.setLightOpacity( 2 );
|
||||
this.setFullSize( this.setOpaque( false ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOpacity(BlockState state, IBlockReader worldIn, BlockPos pos) {
|
||||
return 2; // FIXME Double check this (esp. value range)
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
@@ -121,9 +125,9 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision
|
||||
{
|
||||
if( AppEng.proxy.shouldAddParticles( r ) )
|
||||
{
|
||||
final LightningFX fx = new LightningFX( w, xOff + 0.5 + pos.getX(), yOff + 0.5 + pos.getY(), zOff + 0.5 + pos
|
||||
.getZ(), 0.0D, 0.0D, 0.0D );
|
||||
Minecraft.getInstance().effectRenderer.addEffect( fx );
|
||||
// FIXME final LightningFX fx = new LightningFX( w, xOff + 0.5 + pos.getX(), yOff + 0.5 + pos.getY(), zOff + 0.5 + pos
|
||||
// FIXME .getZ(), 0.0D, 0.0D, 0.0D );
|
||||
// FIXME Minecraft.getInstance().effectRenderer.addEffect( fx );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -131,8 +135,8 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( final World w, final BlockPos pos, final Entity thePlayer, final boolean b )
|
||||
{
|
||||
public VoxelShape getShape(BlockState state, IBlockReader w, BlockPos pos, ISelectionContext context) {
|
||||
|
||||
final TileCharger tile = this.getTileEntity( w, pos );
|
||||
if( tile != null )
|
||||
{
|
||||
@@ -141,17 +145,17 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision
|
||||
final Direction forward = tile.getForward();
|
||||
final AEAxisAlignedBB bb = new AEAxisAlignedBB( twoPixels, twoPixels, twoPixels, 1.0 - twoPixels, 1.0 - twoPixels, 1.0 - twoPixels );
|
||||
|
||||
if( up.getFrontOffsetX() != 0 )
|
||||
if( up.getXOffset() != 0 )
|
||||
{
|
||||
bb.minX = 0;
|
||||
bb.maxX = 1;
|
||||
}
|
||||
if( up.getFrontOffsetY() != 0 )
|
||||
if( up.getYOffset() != 0 )
|
||||
{
|
||||
bb.minY = 0;
|
||||
bb.maxY = 1;
|
||||
}
|
||||
if( up.getFrontOffsetZ() != 0 )
|
||||
if( up.getZOffset() != 0 )
|
||||
{
|
||||
bb.minZ = 0;
|
||||
bb.maxZ = 1;
|
||||
@@ -181,21 +185,20 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision
|
||||
break;
|
||||
}
|
||||
|
||||
return Collections.singletonList( bb.getBoundingBox() );
|
||||
return VoxelShapes.create(bb.getBoundingBox());
|
||||
}
|
||||
return Collections.singletonList( new AxisAlignedBB( 0.0, 0, 0.0, 1.0, 1.0, 1.0 ) );
|
||||
return VoxelShapes.create( new AxisAlignedBB( 0.0, 0, 0.0, 1.0, 1.0, 1.0 ) );
|
||||
}
|
||||
|
||||
@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.0, 0.0, 0.0, 1.0, 1.0, 1.0 ) );
|
||||
public VoxelShape getCollisionShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
|
||||
return VoxelShapes.create( new AxisAlignedBB( 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 ) );
|
||||
}
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public static TileEntityRenderer<TileCharger> createTesr()
|
||||
public static Function<TileEntityRendererDispatcher, TileEntityRenderer<TileCharger>> createTesr()
|
||||
{
|
||||
return new ModularTESR<>( new ItemRenderable<>( BlockCharger::getRenderedItem ) );
|
||||
return dispatcher -> new ModularTESR<>( dispatcher, new ItemRenderable<>( BlockCharger::getRenderedItem ) );
|
||||
}
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
|
||||
@@ -37,12 +37,12 @@ import appeng.tile.misc.TileCondenser;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class BlockCondenser extends AEBaseTileBlock
|
||||
public class BlockCondenser extends AEBaseTileBlock<TileCondenser>
|
||||
{
|
||||
|
||||
public BlockCondenser()
|
||||
{
|
||||
super( Material.IRON );
|
||||
super( Properties.create(Material.IRON) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -58,7 +58,7 @@ public class BlockCondenser extends AEBaseTileBlock
|
||||
final TileCondenser tc = this.getTileEntity( w, pos );
|
||||
if( tc != null && !player.isCrouching() )
|
||||
{
|
||||
Platform.openGUI( player, tc, AEPartLocation.fromFacing(hit), GuiBridge.GUI_CONDENSER );
|
||||
// FIXME Platform.openGUI( player, tc, AEPartLocation.fromFacing(hit), GuiBridge.GUI_CONDENSER );
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,59 +19,55 @@
|
||||
package appeng.block.misc;
|
||||
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.state.BooleanProperty;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.tile.misc.TileInterface;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.state.BooleanProperty;
|
||||
import net.minecraft.state.StateContainer;
|
||||
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 appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
|
||||
import appeng.tile.misc.TileInterface;
|
||||
import appeng.util.Platform;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
||||
public class BlockInterface extends AEBaseTileBlock
|
||||
public class BlockInterface extends AEBaseTileBlock<TileInterface>
|
||||
{
|
||||
|
||||
private static final BooleanProperty OMNIDIRECTIONAL = BooleanProperty.create( "omnidirectional" );
|
||||
|
||||
public BlockInterface()
|
||||
{
|
||||
super( Material.IRON );
|
||||
super( Properties.create(Material.IRON) );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IProperty[] getAEStates()
|
||||
{
|
||||
return new IProperty[] { OMNIDIRECTIONAL };
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||
super.fillStateContainer(builder);
|
||||
builder.add(OMNIDIRECTIONAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getActualState( BlockState state, IBlockReader world, BlockPos pos )
|
||||
{
|
||||
public BlockState updatePostPlacement(BlockState state, Direction facing, BlockState facingState, IWorld world, BlockPos pos, BlockPos facingPos) {
|
||||
// Determine whether the interface is omni-directional or not
|
||||
TileInterface te = this.getTileEntity( world, pos );
|
||||
TileInterface te = this.getTileEntity(world, pos);
|
||||
boolean omniDirectional = true; // The default
|
||||
if( te != null )
|
||||
{
|
||||
if (te != null) {
|
||||
omniDirectional = te.isOmniDirectional();
|
||||
}
|
||||
|
||||
return super.getActualState( state, world, pos )
|
||||
.with( OMNIDIRECTIONAL, omniDirectional );
|
||||
return super.updatePostPlacement(state, facing, facingState, world, pos, facingPos)
|
||||
.with(OMNIDIRECTIONAL, omniDirectional);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -87,7 +83,7 @@ public class BlockInterface extends AEBaseTileBlock
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_INTERFACE );
|
||||
// FIXME Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_INTERFACE );
|
||||
}
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
@@ -19,37 +19,32 @@
|
||||
package appeng.block.misc;
|
||||
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.helpers.MetaRotation;
|
||||
import appeng.tile.misc.TileLightDetector;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.state.BooleanProperty;
|
||||
import net.minecraft.block.properties.DirectionProperty;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.state.BooleanProperty;
|
||||
import net.minecraft.state.DirectionProperty;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import appeng.helpers.MetaRotation;
|
||||
import appeng.tile.misc.TileLightDetector;
|
||||
import java.util.Random;
|
||||
|
||||
|
||||
public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBlock, ICustomCollision
|
||||
public class BlockLightDetector extends AEBaseTileBlock<TileLightDetector> implements IOrientableBlock
|
||||
{
|
||||
|
||||
// Cannot use the vanilla FACING property here because it excludes facing DOWN
|
||||
@@ -60,48 +55,33 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
|
||||
|
||||
public BlockLightDetector()
|
||||
{
|
||||
super( Material.MISCELLANEOUS );
|
||||
super( Properties.create(Material.MISCELLANEOUS).notSolid() );
|
||||
|
||||
this.setDefaultState( this.blockState.getBaseState().with( FACING, Direction.UP ).with( ODD, false ) );
|
||||
this.setLightOpacity( 0 );
|
||||
this.setFullSize( false );
|
||||
this.setOpaque( false );
|
||||
this.setDefaultState( this.getDefaultState().with( FACING, Direction.UP ).with( ODD, false ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState( final BlockState state )
|
||||
{
|
||||
return state.get( FACING ).ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getStateFromMeta( final int meta )
|
||||
{
|
||||
Direction facing = Direction.values()[meta];
|
||||
return this.getDefaultState().with( FACING, facing );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IProperty[] getAEStates()
|
||||
{
|
||||
return new IProperty[] { FACING, ODD };
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||
super.fillStateContainer(builder);
|
||||
builder.add(FACING);
|
||||
builder.add(ODD);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWeakPower( final BlockState state, final IBlockReader w, final BlockPos pos, final Direction side )
|
||||
{
|
||||
if( w instanceof World && ( (TileLightDetector) this.getTileEntity( w, pos ) ).isReady() )
|
||||
if( w instanceof World && this.getTileEntity( w, pos ).isReady() )
|
||||
{
|
||||
return ( (World) w ).getLightFromNeighbors( pos ) - 6;
|
||||
// FIXME: This is ... uhm... fishy
|
||||
return ( (World) w ).getLight( pos ) - 6;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborChange( final IBlockReader world, final BlockPos pos, final BlockPos neighbor )
|
||||
{
|
||||
super.onNeighborChange( world, pos, neighbor );
|
||||
public void onNeighborChange(BlockState state, IWorldReader world, BlockPos pos, BlockPos neighbor) {
|
||||
super.onNeighborChange( state, world, pos, neighbor );
|
||||
|
||||
final TileLightDetector tld = this.getTileEntity( world, pos );
|
||||
if( tld != null )
|
||||
@@ -130,24 +110,18 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( final World w, final BlockPos pos, final Entity thePlayer, final boolean b )
|
||||
{
|
||||
public VoxelShape getShape(BlockState state, IBlockReader w, BlockPos pos, ISelectionContext context) {
|
||||
|
||||
final Direction up = this.getOrientable( w, pos ).getUp();
|
||||
final double xOff = -0.3 * up.getFrontOffsetX();
|
||||
final double yOff = -0.3 * up.getFrontOffsetY();
|
||||
final double zOff = -0.3 * up.getFrontOffsetZ();
|
||||
return Collections.singletonList( new AxisAlignedBB( xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7 ) );
|
||||
final double xOff = -0.3 * up.getXOffset();
|
||||
final double yOff = -0.3 * up.getYOffset();
|
||||
final double zOff = -0.3 * up.getZOffset();
|
||||
return VoxelShapes.create( new AxisAlignedBB( xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7 ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollidingBlockToList( final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e )
|
||||
{/*
|
||||
* double xOff = -0.15 * getUp().offsetX; double yOff = -0.15 *
|
||||
* getUp().offsetY; double zOff = -0.15 * getUp().offsetZ; out.add(
|
||||
* AxisAlignedBB.getBoundingBox( xOff + (double) x + 0.15, yOff +
|
||||
* (double) y + 0.15, zOff + (double) z + 0.15,// ahh xOff + (double) x
|
||||
* + 0.85, yOff + (double) y + 0.85, zOff + (double) z + 0.85 ) );
|
||||
*/
|
||||
public VoxelShape getCollisionShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
|
||||
return VoxelShapes.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -180,25 +154,6 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean usesMetadata()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube( BlockState state )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public BlockRenderLayer getBlockLayer()
|
||||
{
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOrientable getOrientable( final IBlockReader w, final BlockPos pos )
|
||||
{
|
||||
|
||||
@@ -19,56 +19,53 @@
|
||||
package appeng.block.misc;
|
||||
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.state.BooleanProperty;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.util.IOrientableBlock;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.client.render.effects.LightningFX;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.tile.misc.TileQuartzGrowthAccelerator;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.state.BooleanProperty;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
|
||||
public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOrientableBlock
|
||||
public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock<TileQuartzGrowthAccelerator> implements IOrientableBlock
|
||||
{
|
||||
|
||||
private static final BooleanProperty POWERED = BooleanProperty.create( "powered" );
|
||||
|
||||
public BlockQuartzGrowthAccelerator()
|
||||
{
|
||||
super( Material.ROCK );
|
||||
this.setSoundType( SoundType.METAL );
|
||||
super( Properties.create(Material.ROCK).sound(SoundType.METAL) );
|
||||
this.setDefaultState( this.getDefaultState().with( POWERED, false ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getActualState( BlockState state, IBlockReader world, BlockPos pos )
|
||||
{
|
||||
public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld world, BlockPos pos, BlockPos facingPos) {
|
||||
// FIXME: This is not correct since placement updates dont occur when the TE updates
|
||||
TileQuartzGrowthAccelerator te = this.getTileEntity( world, pos );
|
||||
boolean powered = te != null && te.isPowered();
|
||||
|
||||
return super.getActualState( state, world, pos )
|
||||
return super.updatePostPlacement(stateIn, facing, facingState, world, pos, facingPos)
|
||||
.with( POWERED, powered );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IProperty[] getAEStates()
|
||||
{
|
||||
return new IProperty[] { POWERED };
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||
super.fillStateContainer(builder);
|
||||
builder.add(POWERED);
|
||||
}
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
@@ -95,9 +92,9 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOr
|
||||
double ry = 0.5 + pos.getY();
|
||||
double rz = 0.5 + pos.getZ();
|
||||
|
||||
rx += up.getFrontOffsetX() * d0;
|
||||
ry += up.getFrontOffsetY() * d0;
|
||||
rz += up.getFrontOffsetZ() * d0;
|
||||
rx += up.getXOffset() * d0;
|
||||
ry += up.getYOffset() * d0;
|
||||
rz += up.getZOffset() * d0;
|
||||
|
||||
final int x = pos.getX();
|
||||
final int y = pos.getY();
|
||||
@@ -112,25 +109,25 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOr
|
||||
case 0:
|
||||
dx = 0.6;
|
||||
dz = d1;
|
||||
pt = new BlockPos( x + west.getFrontOffsetX(), y + west.getFrontOffsetY(), z + west.getFrontOffsetZ() );
|
||||
pt = new BlockPos( x + west.getXOffset(), y + west.getYOffset(), z + west.getZOffset() );
|
||||
|
||||
break;
|
||||
case 1:
|
||||
dx = d1;
|
||||
dz += 0.6;
|
||||
pt = new BlockPos( x + forward.getFrontOffsetX(), y + forward.getFrontOffsetY(), z + forward.getFrontOffsetZ() );
|
||||
pt = new BlockPos( x + forward.getXOffset(), y + forward.getYOffset(), z + forward.getZOffset() );
|
||||
|
||||
break;
|
||||
case 2:
|
||||
dx = d1;
|
||||
dz = -0.6;
|
||||
pt = new BlockPos( x - forward.getFrontOffsetX(), y - forward.getFrontOffsetY(), z - forward.getFrontOffsetZ() );
|
||||
pt = new BlockPos( x - forward.getXOffset(), y - forward.getYOffset(), z - forward.getZOffset() );
|
||||
|
||||
break;
|
||||
case 3:
|
||||
dx = -0.6;
|
||||
dz = d1;
|
||||
pt = new BlockPos( x - west.getFrontOffsetX(), y - west.getFrontOffsetY(), z - west.getFrontOffsetZ() );
|
||||
pt = new BlockPos( x - west.getXOffset(), y - west.getYOffset(), z - west.getZOffset() );
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -140,23 +137,17 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOr
|
||||
return;
|
||||
}
|
||||
|
||||
rx += dx * west.getFrontOffsetX();
|
||||
ry += dx * west.getFrontOffsetY();
|
||||
rz += dx * west.getFrontOffsetZ();
|
||||
rx += dx * west.getXOffset();
|
||||
ry += dx * west.getYOffset();
|
||||
rz += dx * west.getZOffset();
|
||||
|
||||
rx += dz * forward.getFrontOffsetX();
|
||||
ry += dz * forward.getFrontOffsetY();
|
||||
rz += dz * forward.getFrontOffsetZ();
|
||||
rx += dz * forward.getXOffset();
|
||||
ry += dz * forward.getYOffset();
|
||||
rz += dz * forward.getZOffset();
|
||||
|
||||
final LightningFX fx = new LightningFX( w, rx, ry, rz, 0.0D, 0.0D, 0.0D );
|
||||
Minecraft.getInstance().effectRenderer.addEffect( fx );
|
||||
// FIXME final LightningFX fx = new LightningFX( w, rx, ry, rz, 0.0D, 0.0D, 0.0D );
|
||||
// FIXME Minecraft.getInstance().effectRenderer.addEffect( fx );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean usesMetadata()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,18 +21,20 @@ package appeng.block.misc;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
|
||||
import net.minecraft.state.BooleanProperty;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
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 appeng.api.util.AEPartLocation;
|
||||
@@ -42,33 +44,27 @@ import appeng.tile.misc.TileSecurityStation;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class BlockSecurityStation extends AEBaseTileBlock
|
||||
public class BlockSecurityStation extends AEBaseTileBlock<TileSecurityStation>
|
||||
{
|
||||
|
||||
private static final BooleanProperty POWERED = BooleanProperty.create( "powered" );
|
||||
|
||||
public BlockSecurityStation()
|
||||
{
|
||||
super( Material.IRON );
|
||||
super( Properties.create(Material.IRON) );
|
||||
|
||||
this.setDefaultState( this.getDefaultState().with( POWERED, false ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IProperty[] getAEStates()
|
||||
{
|
||||
return new IProperty[] { POWERED };
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||
super.fillStateContainer(builder);
|
||||
builder.add(POWERED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer()
|
||||
{
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getActualState( BlockState state, IBlockReader world, BlockPos pos )
|
||||
{
|
||||
public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld world, BlockPos pos, BlockPos facingPos) {
|
||||
// FIXME: Powered state needs to be handled differently
|
||||
boolean powered = false;
|
||||
TileSecurityStation te = this.getTileEntity( world, pos );
|
||||
if( te != null )
|
||||
@@ -76,7 +72,7 @@ public class BlockSecurityStation extends AEBaseTileBlock
|
||||
powered = te.isActive();
|
||||
}
|
||||
|
||||
return super.getActualState( state, world, pos )
|
||||
return super.updatePostPlacement(stateIn, facing, facingState, world, pos, facingPos)
|
||||
.with( POWERED, powered );
|
||||
}
|
||||
|
||||
@@ -96,7 +92,7 @@ public class BlockSecurityStation extends AEBaseTileBlock
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_SECURITY );
|
||||
// FIXME Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_SECURITY );
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
return ActionResultType.PASS;
|
||||
|
||||
@@ -47,7 +47,6 @@ import net.minecraft.world.World;
|
||||
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.entity.EntityTinyTNTPrimed;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
|
||||
|
||||
|
||||
@@ -19,35 +19,32 @@
|
||||
package appeng.block.misc;
|
||||
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.state.BooleanProperty;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.AEConfig;
|
||||
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.misc.TileVibrationChamber;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.particles.ParticleTypes;
|
||||
import net.minecraft.state.BooleanProperty;
|
||||
import net.minecraft.state.StateContainer;
|
||||
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.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
|
||||
|
||||
public final class BlockVibrationChamber extends AEBaseTileBlock
|
||||
public final class BlockVibrationChamber extends AEBaseTileBlock<TileVibrationChamber>
|
||||
{
|
||||
|
||||
// Indicates that the vibration chamber is currently working
|
||||
@@ -55,25 +52,24 @@ public final class BlockVibrationChamber extends AEBaseTileBlock
|
||||
|
||||
public BlockVibrationChamber()
|
||||
{
|
||||
super( Material.IRON );
|
||||
this.setHardness( 4.2F );
|
||||
super( Properties.create(Material.IRON).hardnessAndResistance(4.2F) );
|
||||
this.setDefaultState( this.getDefaultState().with( ACTIVE, false ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getActualState( BlockState state, IBlockReader world, BlockPos pos )
|
||||
{
|
||||
public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld world, BlockPos pos, BlockPos facingPos) {
|
||||
// FIXME: This must be actively done from within the tile-entity and not passively
|
||||
TileVibrationChamber te = this.getTileEntity( world, pos );
|
||||
boolean active = te != null && te.isOn;
|
||||
|
||||
return super.getActualState( state, world, pos )
|
||||
return super.updatePostPlacement(stateIn, facing, facingState, world, pos, facingPos)
|
||||
.with( ACTIVE, active );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IProperty[] getAEStates()
|
||||
{
|
||||
return new IProperty[] { ACTIVE };
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||
super.fillStateContainer(builder);
|
||||
builder.add(ACTIVE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -81,7 +77,7 @@ public final class BlockVibrationChamber extends AEBaseTileBlock
|
||||
{
|
||||
if( player.isCrouching() )
|
||||
{
|
||||
return false;
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
if( Platform.isServer() )
|
||||
@@ -89,7 +85,7 @@ public final class BlockVibrationChamber extends AEBaseTileBlock
|
||||
final TileVibrationChamber tc = this.getTileEntity( w, pos );
|
||||
if( tc != null && !player.isCrouching() )
|
||||
{
|
||||
Platform.openGUI( player, tc, AEPartLocation.fromFacing(hit), GuiBridge.GUI_VIBRATION_CHAMBER );
|
||||
// FIXME Platform.openGUI( player, tc, AEPartLocation.fromFacing(hit), GuiBridge.GUI_VIBRATION_CHAMBER );
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
}
|
||||
@@ -111,34 +107,34 @@ public final class BlockVibrationChamber extends AEBaseTileBlock
|
||||
final TileVibrationChamber tc = (TileVibrationChamber) tile;
|
||||
if( tc.isOn )
|
||||
{
|
||||
float f1 = pos.getX() + 0.5F;
|
||||
float f2 = pos.getY() + 0.5F;
|
||||
float f3 = pos.getZ() + 0.5F;
|
||||
double f1 = pos.getX() + 0.5F;
|
||||
double f2 = pos.getY() + 0.5F;
|
||||
double f3 = pos.getZ() + 0.5F;
|
||||
|
||||
final Direction forward = tc.getForward();
|
||||
final Direction up = tc.getUp();
|
||||
|
||||
final int west_x = forward.getFrontOffsetY() * up.getFrontOffsetZ() - forward.getFrontOffsetZ() * up.getFrontOffsetY();
|
||||
final int west_y = forward.getFrontOffsetZ() * up.getFrontOffsetX() - forward.getFrontOffsetX() * up.getFrontOffsetZ();
|
||||
final int west_z = forward.getFrontOffsetX() * up.getFrontOffsetY() - forward.getFrontOffsetY() * up.getFrontOffsetX();
|
||||
final int west_x = forward.getYOffset() * up.getZOffset() - forward.getZOffset() * up.getYOffset();
|
||||
final int west_y = forward.getZOffset() * up.getXOffset() - forward.getXOffset() * up.getZOffset();
|
||||
final int west_z = forward.getXOffset() * up.getYOffset() - forward.getYOffset() * up.getXOffset();
|
||||
|
||||
f1 += forward.getFrontOffsetX() * 0.6;
|
||||
f2 += forward.getFrontOffsetY() * 0.6;
|
||||
f3 += forward.getFrontOffsetZ() * 0.6;
|
||||
f1 += forward.getXOffset() * 0.6;
|
||||
f2 += forward.getYOffset() * 0.6;
|
||||
f3 += forward.getZOffset() * 0.6;
|
||||
|
||||
final float ox = r.nextFloat();
|
||||
final float oy = r.nextFloat() * 0.2f;
|
||||
final double ox = r.nextDouble();
|
||||
final double oy = r.nextDouble() * 0.2f;
|
||||
|
||||
f1 += up.getFrontOffsetX() * ( -0.3 + oy );
|
||||
f2 += up.getFrontOffsetY() * ( -0.3 + oy );
|
||||
f3 += up.getFrontOffsetZ() * ( -0.3 + oy );
|
||||
f1 += up.getXOffset() * ( -0.3 + oy );
|
||||
f2 += up.getYOffset() * ( -0.3 + oy );
|
||||
f3 += up.getZOffset() * ( -0.3 + oy );
|
||||
|
||||
f1 += west_x * ( 0.3 * ox - 0.15 );
|
||||
f2 += west_y * ( 0.3 * ox - 0.15 );
|
||||
f3 += west_z * ( 0.3 * ox - 0.15 );
|
||||
|
||||
w.spawnParticle( EnumParticleTypes.SMOKE_NORMAL, f1, f2, f3, 0.0D, 0.0D, 0.0D, new int[0] );
|
||||
w.spawnParticle( EnumParticleTypes.FLAME, f1, f2, f3, 0.0D, 0.0D, 0.0D, new int[0] );
|
||||
w.addParticle(ParticleTypes.SMOKE, f1, f2, f3, 0.0D, 0.0D, 0.0D );
|
||||
w.addParticle(ParticleTypes.FLAME, f1, f2, f3, 0.0D, 0.0D, 0.0D );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package appeng.block.misc;
|
||||
|
||||
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -37,6 +38,7 @@ public class SecurityStationRendering extends BlockRenderingCustomizer
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
|
||||
{
|
||||
rendering.renderType(RenderType.getCutout());
|
||||
rendering.blockColor( ColorableTileBlockColor.INSTANCE );
|
||||
itemRendering.color( new StaticItemColor( AEColor.TRANSPARENT ) );
|
||||
}
|
||||
|
||||
@@ -19,31 +19,40 @@
|
||||
package appeng.block.networking;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import appeng.api.parts.IFacadeContainer;
|
||||
import appeng.api.parts.PartItemStack;
|
||||
import appeng.api.parts.SelectedPart;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.client.render.cablebus.CableBusBakedModel;
|
||||
import appeng.client.render.cablebus.CableBusBreakingParticle;
|
||||
import appeng.client.render.cablebus.CableBusRenderState;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketClick;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.parts.ICableBusContainer;
|
||||
import appeng.parts.NullCableBusContainer;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.networking.TileCableBus;
|
||||
import appeng.tile.networking.TileCableBusTESR;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.BlockStateContainer;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.particle.ParticleDigging;
|
||||
import net.minecraft.client.particle.ParticleManager;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.fluid.IFluidState;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.item.DyeColor;
|
||||
import net.minecraft.state.IProperty;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
@@ -54,44 +63,20 @@ import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
import appeng.api.parts.IFacadeContainer;
|
||||
import appeng.api.parts.IFacadePart;
|
||||
import appeng.api.parts.PartItemStack;
|
||||
import appeng.api.parts.SelectedPart;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.client.UnlistedProperty;
|
||||
import appeng.client.render.cablebus.CableBusBakedModel;
|
||||
import appeng.client.render.cablebus.CableBusRenderState;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketClick;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.integration.abstraction.IAEFacade;
|
||||
import appeng.parts.ICableBusContainer;
|
||||
import appeng.parts.NullCableBusContainer;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.networking.CableBusTESR;
|
||||
import appeng.tile.networking.TileCableBus;
|
||||
import appeng.tile.networking.TileCableBusTESR;
|
||||
import appeng.util.Platform;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
|
||||
public class BlockCableBus extends AEBaseTileBlock<TileCableBus> /* FIXME implements IAEFacade */
|
||||
{
|
||||
|
||||
public static final UnlistedProperty<CableBusRenderState> RENDER_STATE_PROPERTY = new UnlistedProperty<>( "cable_bus_render_state", CableBusRenderState.class );
|
||||
|
||||
private static final ICableBusContainer NULL_CABLE_BUS = new NullCableBusContainer();
|
||||
|
||||
private static Class<? extends AEBaseTile> noTesrTile;
|
||||
@@ -100,35 +85,16 @@ public class BlockCableBus extends AEBaseTileBlock<TileCableBus> /* FIXME implem
|
||||
|
||||
public BlockCableBus()
|
||||
{
|
||||
super( AEGlassMaterial.INSTANCE );
|
||||
this.setLightOpacity( 0 );
|
||||
this.setFullSize( false );
|
||||
this.setOpaque( false );
|
||||
super( Properties.create(AEGlassMaterial.INSTANCE).notSolid() );
|
||||
|
||||
// this will actually be overwritten later through setupTile and the
|
||||
// combined layers
|
||||
this.setTileEntity( TileCableBus.class );
|
||||
// FIXME ...uh this.setTileEntity( TileCableBus.class, TileCableBus::new );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube( BlockState state )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new ExtendedBlockState( this, new IProperty[0], new IUnlistedProperty[] { RENDER_STATE_PROPERTY } );
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getExtendedState( BlockState state, IBlockReader world, BlockPos pos )
|
||||
{
|
||||
CableBusRenderState renderState = this.cb( world, pos ).getRenderState();
|
||||
renderState.setWorld( world );
|
||||
renderState.setPos( pos );
|
||||
return ( (IExtendedBlockState) state ).with( RENDER_STATE_PROPERTY, renderState );
|
||||
public boolean propagatesSkylightDown(BlockState state, IBlockReader reader, BlockPos pos) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -138,17 +104,10 @@ public class BlockCableBus extends AEBaseTileBlock<TileCableBus> /* FIXME implem
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborChange( final IBlockReader w, final BlockPos pos, final BlockPos neighbor )
|
||||
{
|
||||
public void onNeighborChange(BlockState state, IWorldReader w, BlockPos pos, BlockPos neighbor) {
|
||||
this.cb( w, pos ).onNeighborChanged( w, pos, neighbor );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped( final BlockState state, final Random rand, final int fortune )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWeakPower( final BlockState state, final IBlockReader w, final BlockPos pos, final Direction side )
|
||||
{
|
||||
@@ -164,8 +123,7 @@ public class BlockCableBus extends AEBaseTileBlock<TileCableBus> /* FIXME implem
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock( final World w, final BlockPos pos, final BlockState state, final Entity entityIn )
|
||||
{
|
||||
public void onEntityCollision(BlockState state, World w, BlockPos pos, Entity entityIn) {
|
||||
this.cb( w, pos ).onEntityCollision( entityIn );
|
||||
}
|
||||
|
||||
@@ -188,26 +146,27 @@ public class BlockCableBus extends AEBaseTileBlock<TileCableBus> /* FIXME implem
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLadder( final BlockState state, final IBlockReader world, final BlockPos pos, final LivingEntity entity )
|
||||
{
|
||||
public boolean isLadder(BlockState state, IWorldReader world, BlockPos pos, LivingEntity entity) {
|
||||
return this.cb( world, pos ).isLadder( entity );
|
||||
}
|
||||
|
||||
// FIXME: This is now derived from the collision shape, and cannot be decided programatically anymore.
|
||||
// FIXME: see Block.hasSolidSide. We need to remove isSolidOnSide
|
||||
// FIXME @Override
|
||||
// FIXME public boolean isSideSolid( final BlockState state, final IBlockReader w, final BlockPos pos, final Direction side )
|
||||
// FIXME {
|
||||
// FIXME return this.cb( w, pos ).isSolidOnSide( side );
|
||||
// FIXME }
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid( final BlockState state, final IBlockReader w, final BlockPos pos, final Direction side )
|
||||
{
|
||||
return this.cb( w, pos ).isSolidOnSide( side );
|
||||
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();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReplaceable( final IBlockReader w, final BlockPos pos )
|
||||
{
|
||||
return this.cb( w, pos ).isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer( final BlockState state, final World world, final BlockPos pos, final PlayerEntity player, final boolean willHarvest )
|
||||
{
|
||||
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 );
|
||||
@@ -217,7 +176,7 @@ public class BlockCableBus extends AEBaseTileBlock<TileCableBus> /* FIXME implem
|
||||
}
|
||||
// maybe ray trace?
|
||||
}
|
||||
return super.removedByPlayer( state, world, pos, player, willHarvest );
|
||||
return super.removedByPlayer( state, world, pos, player, willHarvest, fluid );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -232,9 +191,8 @@ public class BlockCableBus extends AEBaseTileBlock<TileCableBus> /* FIXME implem
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock( final BlockState state, final RayTraceResult target, final World world, final BlockPos pos, final PlayerEntity player )
|
||||
{
|
||||
final Vec3d v3 = target.hitVec.subtract( pos.getX(), pos.getY(), pos.getZ() );
|
||||
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 );
|
||||
|
||||
if( sp.part != null )
|
||||
@@ -261,7 +219,12 @@ public class BlockCableBus extends AEBaseTileBlock<TileCableBus> /* FIXME implem
|
||||
return true;
|
||||
}
|
||||
|
||||
ICableBusContainer cb = this.cb( world, target.getBlockPos() );
|
||||
if (target.getType() != Type.BLOCK) {
|
||||
return false;
|
||||
}
|
||||
BlockPos blockPos = new BlockPos(target.getHitVec().x, target.getHitVec().y, target.getHitVec().z);
|
||||
|
||||
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() );
|
||||
@@ -280,22 +243,19 @@ public class BlockCableBus extends AEBaseTileBlock<TileCableBus> /* FIXME implem
|
||||
TextureAtlasSprite texture = Platform.pickRandom( cableBusModel.getParticleTextures( renderState ) );
|
||||
if( texture != null )
|
||||
{
|
||||
double x = target.hitVec.x;
|
||||
double y = target.hitVec.y;
|
||||
double z = target.hitVec.z;
|
||||
|
||||
Particle fx = new DestroyFX( world, x, y, z, 0.0D, 0.0D, 0.0D, state ).setBlockPos( target.getBlockPos() ).multipleParticleScaleBy( 0.8F );
|
||||
fx.setParticleTexture( texture );
|
||||
effectRenderer.addEffect( fx );
|
||||
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 ));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public boolean addDestroyEffects( final World world, final BlockPos pos, final ParticleManager effectRenderer )
|
||||
{
|
||||
public boolean addDestroyEffects(BlockState state, World world, BlockPos pos, ParticleManager effectRenderer) {
|
||||
ICableBusContainer cb = this.cb( world, pos );
|
||||
|
||||
// Our built-in model has the actual baked sprites we need
|
||||
@@ -325,14 +285,14 @@ public class BlockCableBus extends AEBaseTileBlock<TileCableBus> /* FIXME implem
|
||||
// Randomly select one of the textures if the cable bus has more than just one possibility here
|
||||
final TextureAtlasSprite texture = Platform.pickRandom( textures );
|
||||
|
||||
final double d0 = pos.getX() + ( j + 0.5D ) / 4.0D;
|
||||
final double d1 = pos.getY() + ( k + 0.5D ) / 4.0D;
|
||||
final double d2 = pos.getZ() + ( l + 0.5D ) / 4.0D;
|
||||
final ParticleDigging particle = new DestroyFX( world, d0, d1, d2, d0 - pos.getX() - 0.5D, d1 - pos
|
||||
.getY() - 0.5D, d2 - pos.getZ() - 0.5D, this.getDefaultState() ).setBlockPos( pos );
|
||||
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;
|
||||
|
||||
particle.setParticleTexture( texture );
|
||||
effectRenderer.addEffect( particle );
|
||||
// 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,
|
||||
y - pos.getY() - 0.5D, z - pos.getZ() - 0.5D, texture);
|
||||
effectRenderer.addEffect(effect);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -378,20 +338,21 @@ public class BlockCableBus extends AEBaseTileBlock<TileCableBus> /* FIXME implem
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockClicked( World worldIn, BlockPos pos, PlayerEntity playerIn )
|
||||
{
|
||||
public void onBlockClicked(BlockState state, World worldIn, BlockPos pos, PlayerEntity player) {
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
final RayTraceResult rtr = Minecraft.getInstance().objectMouseOver;
|
||||
if( rtr != null && rtr.typeOfHit == Type.BLOCK && pos.equals( rtr.getBlockPos() ) )
|
||||
if( rtr instanceof BlockRayTraceResult)
|
||||
{
|
||||
final Vec3d hitVec = rtr.hitVec.subtract( new Vec3d( pos ) );
|
||||
BlockRayTraceResult brtr = (BlockRayTraceResult) rtr;
|
||||
if (brtr.getPos().equals(pos)) {
|
||||
final Vec3d hitVec = rtr.getHitVec().subtract(new Vec3d(pos));
|
||||
|
||||
if( this.cb( worldIn, pos ).clicked( playerIn, Hand.MAIN_HAND, hitVec ) )
|
||||
{
|
||||
NetworkHandler.instance()
|
||||
.sendToServer(
|
||||
new PacketClick( pos, rtr.sideHit, (float) hitVec.x, (float) hitVec.y, (float) hitVec.z, Hand.MAIN_HAND, true ) );
|
||||
if (this.cb(worldIn, pos).clicked(player, Hand.MAIN_HAND, hitVec)) {
|
||||
NetworkHandler.instance()
|
||||
.sendToServer(
|
||||
new PacketClick(pos, ((BlockRayTraceResult) rtr).getFace(), (float) hitVec.x, (float) hitVec.y, (float) hitVec.z, Hand.MAIN_HAND, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -405,7 +366,8 @@ public class BlockCableBus extends AEBaseTileBlock<TileCableBus> /* FIXME implem
|
||||
@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, new Vec3d( hitX, hitY, hitZ ) );
|
||||
return this.cb( w, pos ).activate( player, hand, hit.getHitVec() ) ? ActionResultType.SUCCESS
|
||||
: ActionResultType.PASS;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -435,9 +397,9 @@ public class BlockCableBus extends AEBaseTileBlock<TileCableBus> /* FIXME implem
|
||||
public void setupTile()
|
||||
{
|
||||
noTesrTile = TileCableBus.class;
|
||||
this.setTileEntity( noTesrTile );
|
||||
// FIXME ... uh ... this.setTileEntity( noTesrTile );
|
||||
|
||||
GameRegistry.registerTileEntity( noTesrTile, AppEng.MOD_ID.toLowerCase() + ":" + "BlockCableBus" );
|
||||
// FIXME oh no... GameRegistry.registerTileEntity( noTesrTile, AppEng.MOD_ID.toLowerCase() + ":" + "BlockCableBus" );
|
||||
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
@@ -449,33 +411,27 @@ public class BlockCableBus extends AEBaseTileBlock<TileCableBus> /* FIXME implem
|
||||
private static void setupTesr()
|
||||
{
|
||||
tesrTile = TileCableBusTESR.class;
|
||||
GameRegistry.registerTileEntity( tesrTile, AppEng.MOD_ID.toLowerCase() + ":" + "ClientOnly_TESR_CableBus" );
|
||||
ClientRegistry.bindTileEntitySpecialRenderer( BlockCableBus.getTesrTile(), new CableBusTESR() );
|
||||
// FIXME oh no... GameRegistry.registerTileEntity( tesrTile, AppEng.MOD_ID.toLowerCase() + ":" + "ClientOnly_TESR_CableBus" );
|
||||
// FIXME oh no... ClientRegistry.bindTileEntitySpecialRenderer( BlockCableBus.getTesrTile(), new CableBusTESR() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRenderInLayer( BlockState state, BlockRenderLayer layer )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getFacadeState( IBlockReader world, BlockPos pos, Direction side )
|
||||
{
|
||||
if( side != null )
|
||||
{
|
||||
IFacadeContainer container = this.fc( world, pos );
|
||||
if( container != null )
|
||||
{
|
||||
IFacadePart facade = container.getFacade( AEPartLocation.fromFacing( side ) );
|
||||
if( facade != null )
|
||||
{
|
||||
return facade.getBlockState();
|
||||
}
|
||||
}
|
||||
}
|
||||
return world.getBlockState( pos );
|
||||
}
|
||||
// FIXME FACADES @Override
|
||||
// FIXME FACADES public BlockState getFacadeState( IBlockReader world, BlockPos pos, Direction side )
|
||||
// FIXME FACADES {
|
||||
// FIXME FACADES if( side != null )
|
||||
// FIXME FACADES {
|
||||
// FIXME FACADES IFacadeContainer container = this.fc( world, pos );
|
||||
// FIXME FACADES if( container != null )
|
||||
// FIXME FACADES {
|
||||
// FIXME FACADES IFacadePart facade = container.getFacade( AEPartLocation.fromFacing( side ) );
|
||||
// FIXME FACADES if( facade != null )
|
||||
// FIXME FACADES {
|
||||
// FIXME FACADES return facade.getBlockState();
|
||||
// FIXME FACADES }
|
||||
// FIXME FACADES }
|
||||
// FIXME FACADES }
|
||||
// FIXME FACADES return world.getBlockState( pos );
|
||||
// FIXME FACADES }
|
||||
|
||||
public static Class<? extends AEBaseTile> getNoTesrTile()
|
||||
{
|
||||
@@ -487,16 +443,6 @@ public class BlockCableBus extends AEBaseTileBlock<TileCableBus> /* FIXME implem
|
||||
return tesrTile;
|
||||
}
|
||||
|
||||
// Helper to get access to the protected constructor
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
private static class DestroyFX extends ParticleDigging
|
||||
{
|
||||
DestroyFX( World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, BlockState state )
|
||||
{
|
||||
super( worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, state );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState state, IBlockReader w, BlockPos pos, ISelectionContext context) {
|
||||
|
||||
|
||||
@@ -21,21 +21,22 @@ package appeng.block.networking;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.BlockStateContainer;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.state.EnumProperty;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.tile.networking.TileController;
|
||||
|
||||
|
||||
public class BlockController extends AEBaseTileBlock
|
||||
public class BlockController extends AEBaseTileBlock<TileController>
|
||||
{
|
||||
|
||||
public enum ControllerBlockState implements IStringSerializable
|
||||
@@ -67,29 +68,23 @@ public class BlockController extends AEBaseTileBlock
|
||||
|
||||
}
|
||||
|
||||
public static final PropertyEnum<ControllerBlockState> CONTROLLER_STATE = PropertyEnum.create( "state", ControllerBlockState.class );
|
||||
public static final EnumProperty<ControllerBlockState> CONTROLLER_STATE = EnumProperty.create( "state", ControllerBlockState.class );
|
||||
|
||||
public static final PropertyEnum<ControllerRenderType> CONTROLLER_TYPE = PropertyEnum.create( "type", ControllerRenderType.class );
|
||||
public static final EnumProperty<ControllerRenderType> CONTROLLER_TYPE = EnumProperty.create( "type", ControllerRenderType.class );
|
||||
|
||||
public BlockController()
|
||||
{
|
||||
super( Material.IRON );
|
||||
this.setHardness( 6 );
|
||||
super( Block.Properties.create(Material.IRON).hardnessAndResistance(6) );
|
||||
this.setDefaultState( this.getDefaultState()
|
||||
.with( CONTROLLER_STATE, ControllerBlockState.offline )
|
||||
.with( CONTROLLER_TYPE, ControllerRenderType.block ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IProperty[] getAEStates()
|
||||
{
|
||||
return new IProperty[] { CONTROLLER_STATE, CONTROLLER_TYPE };
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new BlockStateContainer( this, this.getAEStates() );
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||
super.fillStateContainer(builder);
|
||||
builder.add(CONTROLLER_STATE);
|
||||
builder.add(CONTROLLER_TYPE);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,8 +93,9 @@ public class BlockController extends AEBaseTileBlock
|
||||
* get a rudimentary connected texture feel for the controller based on how it is placed.
|
||||
*/
|
||||
@Override
|
||||
public BlockState getActualState( BlockState state, IBlockReader world, BlockPos pos )
|
||||
{
|
||||
public BlockState updatePostPlacement(BlockState state, Direction facing, BlockState facingState, IWorld world, BlockPos pos, BlockPos facingPos) {
|
||||
|
||||
// FIXME: this might work, or might _NOT_ work, but needs to be investigated
|
||||
|
||||
// Only used for columns, really
|
||||
ControllerRenderType type = ControllerRenderType.block;
|
||||
@@ -109,12 +105,12 @@ public class BlockController extends AEBaseTileBlock
|
||||
int z = pos.getZ();
|
||||
|
||||
// Detect whether controllers are on both sides of the x, y, and z axes
|
||||
final boolean xx = this.getTileEntity( world, x - 1, y, z ) instanceof TileController && this.getTileEntity( world, x + 1, y,
|
||||
z ) instanceof TileController;
|
||||
final boolean yy = this.getTileEntity( world, x, y - 1, z ) instanceof TileController && this.getTileEntity( world, x, y + 1,
|
||||
z ) instanceof TileController;
|
||||
final boolean zz = this.getTileEntity( world, x, y, z - 1 ) instanceof TileController && this.getTileEntity( world, x, y,
|
||||
z + 1 ) instanceof TileController;
|
||||
final boolean xx = this.getTileEntity(world, x - 1, y, z) != null
|
||||
&& this.getTileEntity(world, x + 1, y, z) != null;
|
||||
final boolean yy = this.getTileEntity(world, x, y - 1, z) != null
|
||||
&& this.getTileEntity(world, x, y + 1, z) != null;
|
||||
final boolean zz = this.getTileEntity(world, x, y, z - 1) != null
|
||||
&& this.getTileEntity(world, x, y, z + 1) != null;
|
||||
|
||||
if( xx && !yy && !zz )
|
||||
{
|
||||
@@ -153,25 +149,6 @@ public class BlockController extends AEBaseTileBlock
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState( final BlockState state )
|
||||
{
|
||||
return state.get( CONTROLLER_STATE ).ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getStateFromMeta( final int meta )
|
||||
{
|
||||
ControllerBlockState state = ControllerBlockState.values()[meta];
|
||||
return this.getDefaultState().with( CONTROLLER_STATE, state );
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer()
|
||||
{
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving )
|
||||
{
|
||||
|
||||
@@ -21,13 +21,14 @@ package appeng.block.networking;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.tile.networking.TileCreativeEnergyCell;
|
||||
|
||||
|
||||
public class BlockCreativeEnergyCell extends AEBaseTileBlock
|
||||
public class BlockCreativeEnergyCell extends AEBaseTileBlock<TileCreativeEnergyCell>
|
||||
{
|
||||
|
||||
public BlockCreativeEnergyCell()
|
||||
{
|
||||
super( AEGlassMaterial.INSTANCE );
|
||||
super( Properties.create(AEGlassMaterial.INSTANCE) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,16 +19,18 @@
|
||||
package appeng.block.networking;
|
||||
|
||||
|
||||
import appeng.tile.networking.TileEnergyAcceptor;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
|
||||
|
||||
public class BlockEnergyAcceptor extends AEBaseTileBlock
|
||||
public class BlockEnergyAcceptor extends AEBaseTileBlock<TileEnergyAcceptor>
|
||||
{
|
||||
|
||||
public BlockEnergyAcceptor()
|
||||
{
|
||||
super( Material.IRON );
|
||||
super(Block.Properties.create(Material.IRON) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,12 +19,14 @@
|
||||
package appeng.block.networking;
|
||||
|
||||
|
||||
import net.minecraft.state.IProperty;
|
||||
import net.minecraft.block.properties.PropertyInteger;
|
||||
import appeng.tile.networking.TileEnergyCell;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.state.IntegerProperty;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -32,34 +34,21 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
|
||||
|
||||
public class BlockEnergyCell extends AEBaseTileBlock
|
||||
public class BlockEnergyCell extends AEBaseTileBlock<TileEnergyCell>
|
||||
{
|
||||
|
||||
public static final PropertyInteger ENERGY_STORAGE = PropertyInteger.create( "fullness", 0, 7 );
|
||||
|
||||
@Override
|
||||
public int getMetaFromState( final BlockState state )
|
||||
{
|
||||
return state.get( ENERGY_STORAGE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getStateFromMeta( final int meta )
|
||||
{
|
||||
return this.getDefaultState().with( ENERGY_STORAGE, Math.min( 7, Math.max( 0, meta ) ) );
|
||||
}
|
||||
public static final IntegerProperty ENERGY_STORAGE = IntegerProperty.create( "fullness", 0, 7 );
|
||||
|
||||
public BlockEnergyCell()
|
||||
{
|
||||
super( AEGlassMaterial.INSTANCE );
|
||||
super( Properties.create(AEGlassMaterial.INSTANCE) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> itemStacks)
|
||||
{
|
||||
super.getSubBlocks( tabs, itemStacks );
|
||||
super.fillItemGroup( group, itemStacks );
|
||||
|
||||
final ItemStack charged = new ItemStack( this, 1 );
|
||||
final CompoundNBT tag = charged.getOrCreateTag();
|
||||
@@ -75,9 +64,9 @@ public class BlockEnergyCell extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IProperty[] getAEStates()
|
||||
{
|
||||
return new IProperty[] { ENERGY_STORAGE };
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||
super.fillStateContainer(builder);
|
||||
builder.add(ENERGY_STORAGE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
package appeng.block.networking;
|
||||
|
||||
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
@@ -28,7 +27,6 @@ import appeng.block.AEBaseBlockItemChargeable;
|
||||
import appeng.bootstrap.BlockRenderingCustomizer;
|
||||
import appeng.bootstrap.IBlockRendering;
|
||||
import appeng.bootstrap.IItemRendering;
|
||||
import appeng.tile.networking.TileEnergyCell;
|
||||
|
||||
|
||||
public class BlockEnergyCellRendering extends BlockRenderingCustomizer
|
||||
@@ -44,7 +42,7 @@ public class BlockEnergyCellRendering extends BlockRenderingCustomizer
|
||||
@Override
|
||||
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
|
||||
{
|
||||
itemRendering.meshDefinition( this::getItemModel );
|
||||
// FIXME itemRendering.meshDefinition( this::getItemModel );
|
||||
// Note: Since we use the block models, we dont need to register custom variants
|
||||
}
|
||||
|
||||
@@ -52,13 +50,13 @@ public class BlockEnergyCellRendering extends BlockRenderingCustomizer
|
||||
* Determines which version of the energy cell model should be used depending on the fill factor
|
||||
* of the item stack.
|
||||
*/
|
||||
private ModelResourceLocation getItemModel( ItemStack is )
|
||||
{
|
||||
double fillFactor = getFillFactor( is );
|
||||
|
||||
int storageLevel = TileEnergyCell.getStorageLevelFromFillFactor( fillFactor );
|
||||
return new ModelResourceLocation( this.baseModel, "fullness=" + storageLevel );
|
||||
}
|
||||
// FIXME private ModelResourceLocation getItemModel( ItemStack is )
|
||||
// FIXME {
|
||||
// FIXME double fillFactor = getFillFactor( is );
|
||||
// FIXME
|
||||
// FIXME int storageLevel = TileEnergyCell.getStorageLevelFromFillFactor( fillFactor );
|
||||
// FIXME return new ModelResourceLocation( this.baseModel, "fullness=" + storageLevel );
|
||||
// FIXME }
|
||||
|
||||
/**
|
||||
* Helper method that returns the energy fill factor (between 0 and 1) of a given item stack.
|
||||
|
||||
@@ -19,33 +19,30 @@
|
||||
package appeng.block.networking;
|
||||
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.tile.networking.TileWireless;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.state.EnumProperty;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import appeng.tile.networking.TileWireless;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class BlockWireless extends AEBaseTileBlock implements ICustomCollision
|
||||
public class BlockWireless extends AEBaseTileBlock<TileWireless>
|
||||
{
|
||||
|
||||
enum State implements IStringSerializable
|
||||
@@ -61,29 +58,22 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision
|
||||
}
|
||||
}
|
||||
|
||||
public static final PropertyEnum<State> STATE = PropertyEnum.create( "state", State.class );
|
||||
public static final EnumProperty<State> STATE = EnumProperty.create( "state", State.class );
|
||||
|
||||
public BlockWireless()
|
||||
{
|
||||
super( AEGlassMaterial.INSTANCE );
|
||||
this.setLightOpacity( 0 );
|
||||
super( Properties.create(AEGlassMaterial.INSTANCE) );
|
||||
this.setFullSize( false );
|
||||
this.setOpaque( false );
|
||||
this.setDefaultState( this.getDefaultState().with( STATE, State.OFF ) );
|
||||
}
|
||||
|
||||
// FIXME This has to be triggered by the tile entity's state changing directly
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer()
|
||||
{
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getActualState( BlockState state, IBlockReader worldIn, BlockPos pos )
|
||||
{
|
||||
public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld world, BlockPos pos, BlockPos facingPos) {
|
||||
State teState = State.OFF;
|
||||
|
||||
TileWireless te = this.getTileEntity( worldIn, pos );
|
||||
TileWireless te = this.getTileEntity( world, pos );
|
||||
if( te != null )
|
||||
{
|
||||
if( te.isActive() )
|
||||
@@ -96,36 +86,34 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision
|
||||
}
|
||||
}
|
||||
|
||||
return super.getActualState( state, worldIn, pos )
|
||||
return super.updatePostPlacement(stateIn, facing, facingState, world, pos, facingPos)
|
||||
.with( STATE, teState );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IProperty[] getAEStates()
|
||||
{
|
||||
return new IProperty[] { STATE };
|
||||
protected void fillStateContainer(StateContainer.Builder builder) {
|
||||
super.fillStateContainer(builder);
|
||||
builder.add(STATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated( final World w, final BlockPos pos, final BlockState state, final PlayerEntity player, final Hand hand, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
{
|
||||
public ActionResultType onBlockActivated(BlockState state, World w, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
|
||||
final TileWireless tg = this.getTileEntity( w, pos );
|
||||
|
||||
if( tg != null && !player.isCrouching() )
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
Platform.openGUI( player, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_WIRELESS );
|
||||
// FIXME Platform.openGUI( player, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_WIRELESS );
|
||||
}
|
||||
return true;
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
return super.onBlockActivated( w, pos, state, player, hand, side, hitX, hitY, hitZ );
|
||||
return super.onBlockActivated( state, w, pos, player, hand, hit );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( final World w, final BlockPos pos, final Entity thePlayer, final boolean b )
|
||||
{
|
||||
public VoxelShape getShape(BlockState state, IBlockReader w, BlockPos pos, ISelectionContext context) {
|
||||
final TileWireless tile = this.getTileEntity( w, pos );
|
||||
if( tile != null )
|
||||
{
|
||||
@@ -180,14 +168,14 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision
|
||||
break;
|
||||
}
|
||||
|
||||
return Collections.singletonList( new AxisAlignedBB( minX, minY, minZ, maxX, maxY, maxZ ) );
|
||||
return VoxelShapes.create( new AxisAlignedBB( minX, minY, minZ, maxX, maxY, maxZ ) );
|
||||
}
|
||||
return Collections.singletonList( new AxisAlignedBB( 0.0, 0, 0.0, 1.0, 1.0, 1.0 ) );
|
||||
return VoxelShapes.fullCube();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollidingBlockToList( final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e )
|
||||
{
|
||||
public VoxelShape getCollisionShape(BlockState state, IBlockReader w, BlockPos pos, ISelectionContext context) {
|
||||
|
||||
final TileWireless tile = this.getTileEntity( w, pos );
|
||||
if( tile != null )
|
||||
{
|
||||
@@ -242,18 +230,17 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision
|
||||
break;
|
||||
}
|
||||
|
||||
out.add( new AxisAlignedBB( minX, minY, minZ, maxX, maxY, maxZ ) );
|
||||
return VoxelShapes.create( new AxisAlignedBB( minX, minY, minZ, maxX, maxY, maxZ ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
out.add( new AxisAlignedBB( 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 ) );
|
||||
return VoxelShapes.fullCube();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube( BlockState state )
|
||||
{
|
||||
return false;
|
||||
public boolean propagatesSkylightDown(BlockState state, IBlockReader reader, BlockPos pos) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,17 +19,22 @@
|
||||
package appeng.block.networking;
|
||||
|
||||
|
||||
import appeng.parts.CableBusContainer;
|
||||
import appeng.tile.networking.TileCableBus;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.color.IBlockColor;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraft.world.ILightReader;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.client.render.cablebus.CableBusRenderState;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
||||
/**
|
||||
* Exposes the cable bus color as tint indices 0 (dark variant), 1 (medium variant) and 2 (bright variant).
|
||||
@@ -39,17 +44,16 @@ public class CableBusColor implements IBlockColor
|
||||
{
|
||||
|
||||
@Override
|
||||
public int colorMultiplier( BlockState state, IBlockReader worldIn, BlockPos pos, int color )
|
||||
{
|
||||
public int getColor(BlockState state, @Nullable ILightReader worldIn, @Nullable BlockPos pos, int color) {
|
||||
|
||||
// FIXME: Once COLOR becomes part of the block state, change this
|
||||
AEColor busColor = AEColor.TRANSPARENT;
|
||||
|
||||
if( state instanceof IExtendedBlockState )
|
||||
{
|
||||
CableBusRenderState renderState = ( (IExtendedBlockState) state ).getValue( BlockCableBus.RENDER_STATE_PROPERTY );
|
||||
if( renderState != null )
|
||||
{
|
||||
busColor = renderState.getCableColor();
|
||||
if (worldIn != null && pos != null) {
|
||||
TileEntity tileEntity = worldIn.getTileEntity(pos);
|
||||
if (tileEntity instanceof TileCableBus) {
|
||||
CableBusContainer container = ((TileCableBus) tileEntity).getCableBus();
|
||||
busColor = container.getColor();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,6 +45,16 @@ public class CableBusRendering extends BlockRenderingCustomizer
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
|
||||
{
|
||||
/* FIXME this was previously
|
||||
*
|
||||
@Override
|
||||
public boolean canRenderInLayer( BlockState state, BlockRenderLayer layer )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
rendering.renderType(rt -> true);
|
||||
|
||||
rendering.builtInModel( "models/block/builtin/cable_bus", new CableBusModel( this.partModels ) );
|
||||
rendering.blockColor( new CableBusColor() );
|
||||
rendering.modelCustomizer( ( loc, model ) -> model );
|
||||
|
||||
@@ -22,6 +22,7 @@ package appeng.block.networking;
|
||||
import appeng.bootstrap.BlockRenderingCustomizer;
|
||||
import appeng.bootstrap.IBlockRendering;
|
||||
import appeng.bootstrap.IItemRendering;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
|
||||
|
||||
public class ControllerRendering extends BlockRenderingCustomizer
|
||||
@@ -31,5 +32,6 @@ public class ControllerRendering extends BlockRenderingCustomizer
|
||||
{
|
||||
// Disables the default model rotator
|
||||
rendering.modelCustomizer( ( loc, model ) -> model );
|
||||
rendering.renderType(RenderType.getCutout());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
package appeng.block.networking;
|
||||
|
||||
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -18,6 +19,7 @@ public class WirelessRendering extends BlockRenderingCustomizer
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
|
||||
{
|
||||
rendering.renderType(RenderType.getCutout());
|
||||
rendering.blockColor( new StaticBlockColor( AEColor.TRANSPARENT ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,79 +19,37 @@
|
||||
package appeng.block.paint;
|
||||
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Random;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.tile.misc.TilePaint;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.MapColor;
|
||||
import net.minecraft.block.material.MaterialLiquid;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.BlockStateContainer;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.material.MaterialColor;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.item.BlockItemUseContext;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.helpers.Splotch;
|
||||
import appeng.tile.misc.TilePaint;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class BlockPaint extends AEBaseTileBlock
|
||||
public class BlockPaint extends AEBaseTileBlock<TilePaint>
|
||||
{
|
||||
|
||||
static final PaintSplotchesProperty SPLOTCHES = new PaintSplotchesProperty();
|
||||
|
||||
public BlockPaint()
|
||||
{
|
||||
super( new MaterialLiquid( MapColor.AIR ) );
|
||||
|
||||
this.setLightOpacity( 0 );
|
||||
super(Properties.create(Material.WATER, MaterialColor.AIR));
|
||||
this.setFullSize( false );
|
||||
this.setOpaque( false );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new ExtendedBlockState( this, new IProperty[0], new IUnlistedProperty[] { SPLOTCHES } );
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getExtendedState( BlockState state, IBlockReader world, BlockPos pos )
|
||||
{
|
||||
IExtendedBlockState extState = (IExtendedBlockState) state;
|
||||
|
||||
TilePaint te = this.getTileEntity( world, pos );
|
||||
|
||||
Collection<Splotch> splotches = Collections.emptyList();
|
||||
if( te != null )
|
||||
{
|
||||
splotches = te.getDots();
|
||||
}
|
||||
|
||||
return extState.with( SPLOTCHES, new PaintSplotches( splotches ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer()
|
||||
{
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void fillItemGroup(ItemGroup group, NonNullList<ItemStack> itemStacks)
|
||||
@@ -100,15 +58,8 @@ public class BlockPaint extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBox( BlockState blockState, IBlockReader worldIn, BlockPos pos )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCollideCheck( final BlockState state, final boolean hitIfLiquid )
|
||||
{
|
||||
return false;
|
||||
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
|
||||
return VoxelShapes.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -122,18 +73,6 @@ public class BlockPaint extends AEBaseTileBlock
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped( final BlockState state, final Random rand, final int fortune )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dropBlockAsItemWithChance( final World worldIn, final BlockPos pos, final BlockState state, final float chance, final int fortune )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillWithRain( final World w, final BlockPos pos )
|
||||
{
|
||||
@@ -163,8 +102,12 @@ public class BlockPaint extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReplaceable( final IBlockReader worldIn, final BlockPos pos )
|
||||
{
|
||||
public boolean isReplaceable(BlockState state, BlockItemUseContext useContext) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReplaceable(BlockState p_225541_1_, Fluid p_225541_2_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
package appeng.block.paint;
|
||||
|
||||
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -17,7 +18,8 @@ public class PaintRendering extends BlockRenderingCustomizer
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
|
||||
{
|
||||
rendering.builtInModel( "models/block/paint", new PaintModel() );
|
||||
rendering.renderType(RenderType.getCutout());
|
||||
// FIXME rendering.builtInModel( "models/block/paint", new PaintModel() );
|
||||
// Disable auto rotation
|
||||
rendering.modelCustomizer( ( location, model ) -> model );
|
||||
}
|
||||
|
||||
@@ -13,12 +13,12 @@ import appeng.helpers.Splotch;
|
||||
/**
|
||||
* Used to transfer the state about paint splotches from the game thread to the render thread.
|
||||
*/
|
||||
class PaintSplotches
|
||||
public class PaintSplotches
|
||||
{
|
||||
|
||||
private final List<Splotch> splotches;
|
||||
|
||||
PaintSplotches( Collection<Splotch> splotches )
|
||||
public PaintSplotches( Collection<Splotch> splotches )
|
||||
{
|
||||
this.splotches = ImmutableList.copyOf( splotches );
|
||||
}
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
|
||||
package appeng.block.paint;
|
||||
|
||||
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
|
||||
|
||||
class PaintSplotchesProperty implements IUnlistedProperty<PaintSplotches>
|
||||
{
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return "paint_splots";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid( PaintSplotches value )
|
||||
{
|
||||
return value != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<PaintSplotches> getType()
|
||||
{
|
||||
return PaintSplotches.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String valueToString( PaintSplotches value )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -19,87 +19,61 @@
|
||||
package appeng.block.qnb;
|
||||
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.tile.qnb.TileQuantumBridge;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.state.BooleanProperty;
|
||||
import net.minecraft.block.BlockStateContainer;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.state.BooleanProperty;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import appeng.tile.qnb.TileQuantumBridge;
|
||||
|
||||
|
||||
public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICustomCollision
|
||||
public abstract class BlockQuantumBase extends AEBaseTileBlock<TileQuantumBridge>
|
||||
{
|
||||
|
||||
public static final BooleanProperty FORMED = BooleanProperty.create( "formed" );
|
||||
|
||||
public static final QnbFormedStateProperty FORMED_STATE = new QnbFormedStateProperty();
|
||||
private static final VoxelShape SHAPE;
|
||||
|
||||
public BlockQuantumBase( final Material mat )
|
||||
{
|
||||
super( mat );
|
||||
static {
|
||||
final float shave = 2.0f / 16.0f;
|
||||
this.boundingBox = new AxisAlignedBB( shave, shave, shave, 1.0f - shave, 1.0f - shave, 1.0f - shave );
|
||||
this.setLightOpacity( 0 );
|
||||
this.setFullSize( this.setOpaque( false ) );
|
||||
this.setDefaultState( this.getDefaultState().with( FORMED, false ) );
|
||||
SHAPE = VoxelShapes.create(new AxisAlignedBB(shave, shave, shave, 1.0f - shave, 1.0f - shave, 1.0f - shave));
|
||||
}
|
||||
|
||||
public BlockQuantumBase(Block.Properties props) {
|
||||
super(props);
|
||||
this.setFullSize(this.setOpaque(false));
|
||||
this.setDefaultState(this.getDefaultState().with(FORMED, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IProperty[] getAEStates()
|
||||
{
|
||||
return new IProperty[] { FORMED };
|
||||
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
|
||||
return SHAPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new ExtendedBlockState( this, this.getAEStates(), new IUnlistedProperty[] { FORMED_STATE } );
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||
super.fillStateContainer(builder);
|
||||
builder.add(FORMED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getExtendedState( BlockState state, IBlockReader world, BlockPos pos )
|
||||
{
|
||||
IExtendedBlockState extState = (IExtendedBlockState) state;
|
||||
|
||||
TileQuantumBridge bridge = this.getTileEntity( world, pos );
|
||||
if( bridge != null )
|
||||
{
|
||||
QnbFormedState formedState = new QnbFormedState( bridge.getAdjacentQuantumBridges(), bridge.isCorner(), bridge.isPowered() );
|
||||
extState = extState.with( FORMED_STATE, formedState );
|
||||
}
|
||||
|
||||
return extState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getActualState( BlockState state, IBlockReader worldIn, BlockPos pos )
|
||||
{
|
||||
TileQuantumBridge bridge = this.getTileEntity( worldIn, pos );
|
||||
if( bridge != null )
|
||||
{
|
||||
state = state.with( FORMED, bridge.isFormed() );
|
||||
public BlockState updatePostPlacement(BlockState state, Direction facing, BlockState facingState, IWorld world, BlockPos pos, BlockPos facingPos) {
|
||||
TileQuantumBridge bridge = this.getTileEntity(world, pos);
|
||||
if (bridge != null) {
|
||||
state = state.with(FORMED, bridge.isFormed());
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer()
|
||||
{
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged( BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos, boolean isMoving )
|
||||
{
|
||||
@@ -121,9 +95,4 @@ public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICusto
|
||||
super.onReplaced( state, w, pos, newState, isMoving );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube( BlockState state )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.Random;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
@@ -34,6 +35,10 @@ import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
@@ -48,9 +53,16 @@ import appeng.util.Platform;
|
||||
public class BlockQuantumLinkChamber extends BlockQuantumBase
|
||||
{
|
||||
|
||||
private static final VoxelShape SHAPE;
|
||||
|
||||
static {
|
||||
final double onePixel = 2.0 / 16.0;
|
||||
SHAPE = VoxelShapes.create( new AxisAlignedBB( onePixel, onePixel, onePixel, 1.0 - onePixel, 1.0 - onePixel, 1.0 - onePixel ) );
|
||||
}
|
||||
|
||||
public BlockQuantumLinkChamber()
|
||||
{
|
||||
super( AEGlassMaterial.INSTANCE );
|
||||
super(Properties.create(AEGlassMaterial.INSTANCE) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -82,7 +94,7 @@ public class BlockQuantumLinkChamber extends BlockQuantumBase
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_QNB );
|
||||
// FIXME Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_QNB );
|
||||
}
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
@@ -90,16 +102,8 @@ public class BlockQuantumLinkChamber extends BlockQuantumBase
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( final World w, final BlockPos pos, final Entity thePlayer, final boolean b )
|
||||
{
|
||||
final double onePixel = 2.0 / 16.0;
|
||||
return Collections.singletonList( new AxisAlignedBB( onePixel, onePixel, onePixel, 1.0 - onePixel, 1.0 - onePixel, 1.0 - onePixel ) );
|
||||
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
|
||||
return SHAPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollidingBlockToList( final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e )
|
||||
{
|
||||
final double onePixel = 2.0 / 16.0;
|
||||
out.add( new AxisAlignedBB( onePixel, onePixel, onePixel, 1.0 - onePixel, 1.0 - onePixel, 1.0 - onePixel ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,55 +19,39 @@
|
||||
package appeng.block.qnb;
|
||||
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import appeng.tile.qnb.TileQuantumBridge;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.tile.qnb.TileQuantumBridge;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
|
||||
|
||||
public class BlockQuantumRing extends BlockQuantumBase
|
||||
{
|
||||
public class BlockQuantumRing extends BlockQuantumBase {
|
||||
|
||||
public BlockQuantumRing()
|
||||
{
|
||||
super( Material.IRON );
|
||||
}
|
||||
private static final VoxelShape SHAPE = createShape(2.0 / 16.0);
|
||||
private static final VoxelShape SHAPE_CORNER = createShape(4.0 / 16.0);
|
||||
private static final VoxelShape SHAPE_FORMED = createShape(1.0 / 16.0);
|
||||
|
||||
@Override
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( final World w, final BlockPos pos, final Entity thePlayer, final boolean b )
|
||||
{
|
||||
double onePixel = 2.0 / 16.0;
|
||||
final TileQuantumBridge bridge = this.getTileEntity( w, pos );
|
||||
if( bridge != null && bridge.isCorner() )
|
||||
{
|
||||
onePixel = 4.0 / 16.0;
|
||||
}
|
||||
else if( bridge != null && bridge.isFormed() )
|
||||
{
|
||||
onePixel = 1.0 / 16.0;
|
||||
}
|
||||
return Collections.singletonList( new AxisAlignedBB( onePixel, onePixel, onePixel, 1.0 - onePixel, 1.0 - onePixel, 1.0 - onePixel ) );
|
||||
}
|
||||
public BlockQuantumRing() {
|
||||
super(Properties.create(Material.IRON));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollidingBlockToList( final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, final Entity e )
|
||||
{
|
||||
double onePixel = 2.0 / 16.0;
|
||||
final TileQuantumBridge bridge = this.getTileEntity( w, pos );
|
||||
if( bridge != null && bridge.isCorner() )
|
||||
{
|
||||
onePixel = 4.0 / 16.0;
|
||||
}
|
||||
else if( bridge != null && bridge.isFormed() )
|
||||
{
|
||||
onePixel = 1.0 / 16.0;
|
||||
}
|
||||
out.add( new AxisAlignedBB( onePixel, onePixel, onePixel, 1.0 - onePixel, 1.0 - onePixel, 1.0 - onePixel ) );
|
||||
}
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState state, IBlockReader w, BlockPos pos, ISelectionContext context) {
|
||||
final TileQuantumBridge bridge = this.getTileEntity(w, pos);
|
||||
if (bridge != null && bridge.isCorner()) {
|
||||
return SHAPE_CORNER;
|
||||
} else if (bridge != null && bridge.isFormed()) {
|
||||
return SHAPE_FORMED;
|
||||
}
|
||||
return SHAPE;
|
||||
}
|
||||
|
||||
private static VoxelShape createShape(double onePixel) {
|
||||
return VoxelShapes.create(new AxisAlignedBB(onePixel, onePixel, onePixel, 1.0 - onePixel, 1.0 - onePixel, 1.0 - onePixel));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
|
||||
package appeng.block.qnb;
|
||||
|
||||
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
|
||||
|
||||
public class QnbFormedStateProperty implements IUnlistedProperty<QnbFormedState>
|
||||
{
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return "qnb_formed";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid( QnbFormedState value )
|
||||
{
|
||||
return value != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<QnbFormedState> getType()
|
||||
{
|
||||
return QnbFormedState.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String valueToString( QnbFormedState value )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
package appeng.block.qnb;
|
||||
|
||||
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -17,7 +18,8 @@ public class QuantumBridgeRendering extends BlockRenderingCustomizer
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
|
||||
{
|
||||
rendering.builtInModel( "models/block/qnb/qnb_formed", new QnbFormedModel() );
|
||||
rendering.renderType(RenderType.getCutout());
|
||||
// FIXME rendering.builtInModel( "models/block/qnb/qnb_formed", new QnbFormedModel() );
|
||||
// Disable auto rotation
|
||||
rendering.modelCustomizer( ( location, model ) -> model );
|
||||
}
|
||||
|
||||
@@ -39,12 +39,12 @@ import appeng.tile.spatial.TileSpatialIOPort;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class BlockSpatialIOPort extends AEBaseTileBlock
|
||||
public class BlockSpatialIOPort extends AEBaseTileBlock<TileSpatialIOPort>
|
||||
{
|
||||
|
||||
public BlockSpatialIOPort()
|
||||
{
|
||||
super( Material.IRON );
|
||||
super( Properties.create(Material.IRON) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -70,7 +70,7 @@ public class BlockSpatialIOPort extends AEBaseTileBlock
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_SPATIAL_IO_PORT );
|
||||
// FIXME Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_SPATIAL_IO_PORT );
|
||||
}
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
@@ -19,45 +19,23 @@
|
||||
package appeng.block.spatial;
|
||||
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.tile.spatial.TileSpatialPylon;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockStateContainer;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.client.render.spatial.SpatialPylonStateProperty;
|
||||
import appeng.helpers.AEGlassMaterial;
|
||||
import appeng.tile.spatial.TileSpatialPylon;
|
||||
|
||||
|
||||
public class BlockSpatialPylon extends AEBaseTileBlock
|
||||
public class BlockSpatialPylon extends AEBaseTileBlock<TileSpatialPylon>
|
||||
{
|
||||
|
||||
public static final SpatialPylonStateProperty STATE = new SpatialPylonStateProperty();
|
||||
|
||||
public BlockSpatialPylon()
|
||||
{
|
||||
super( AEGlassMaterial.INSTANCE );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new ExtendedBlockState( this, this.getAEStates(), new IUnlistedProperty[] { STATE } );
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getExtendedState( BlockState state, IBlockReader world, BlockPos pos )
|
||||
{
|
||||
IExtendedBlockState extState = (IExtendedBlockState) state;
|
||||
|
||||
return extState.with( STATE, this.getDisplayState( world, pos ) );
|
||||
super( Properties.create(AEGlassMaterial.INSTANCE) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -81,22 +59,4 @@ public class BlockSpatialPylon extends AEBaseTileBlock
|
||||
return super.getLightValue( state, w, pos );
|
||||
}
|
||||
|
||||
private int getDisplayState( IBlockReader world, BlockPos pos )
|
||||
{
|
||||
TileSpatialPylon te = this.getTileEntity( world, pos );
|
||||
|
||||
if( te == null )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return te.getDisplayBits();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer()
|
||||
{
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,56 +19,48 @@
|
||||
package appeng.block.storage;
|
||||
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.localization.PlayerMessages;
|
||||
import appeng.tile.storage.TileChest;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.state.EnumProperty;
|
||||
import net.minecraft.state.StateContainer;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
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 appeng.api.util.AEPartLocation;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.localization.PlayerMessages;
|
||||
|
||||
import appeng.tile.storage.TileChest;
|
||||
import appeng.util.Platform;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
||||
public class BlockChest extends AEBaseTileBlock
|
||||
public class BlockChest extends AEBaseTileBlock<TileChest>
|
||||
{
|
||||
|
||||
private final static PropertyEnum<DriveSlotState> SLOT_STATE = PropertyEnum.create( "slot_state", DriveSlotState.class );
|
||||
private final static EnumProperty<DriveSlotState> SLOT_STATE = EnumProperty.create( "slot_state", DriveSlotState.class );
|
||||
|
||||
public BlockChest()
|
||||
{
|
||||
super( Material.IRON );
|
||||
super( Properties.create(Material.IRON) );
|
||||
this.setDefaultState( this.getDefaultState().with( SLOT_STATE, DriveSlotState.EMPTY ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IProperty[] getAEStates()
|
||||
{
|
||||
return new IProperty[] { SLOT_STATE };
|
||||
protected void fillStateContainer(StateContainer.Builder builder) {
|
||||
super.fillStateContainer(builder);
|
||||
builder.add(SLOT_STATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer()
|
||||
{
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
public BlockState updatePostPlacement(BlockState state, Direction facing, BlockState facingState, IWorld worldIn, BlockPos pos, BlockPos facingPos) {
|
||||
// FIXME Check tile-entity updated prop
|
||||
|
||||
@Override
|
||||
public BlockState getActualState( BlockState state, IBlockReader worldIn, BlockPos pos )
|
||||
{
|
||||
DriveSlotState slotState = DriveSlotState.EMPTY;
|
||||
|
||||
TileChest te = this.getTileEntity( worldIn, pos );
|
||||
@@ -86,8 +78,7 @@ public class BlockChest extends AEBaseTileBlock
|
||||
}
|
||||
}
|
||||
|
||||
return super.getActualState( state, worldIn, pos )
|
||||
.with( SLOT_STATE, slotState );
|
||||
return state.with( SLOT_STATE, slotState );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -101,9 +92,9 @@ public class BlockChest extends AEBaseTileBlock
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
if( hit != tg.getUp() )
|
||||
if( hit.getFace() != tg.getUp() )
|
||||
{
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_CHEST );
|
||||
// FIXME Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_CHEST );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -19,64 +19,27 @@
|
||||
package appeng.block.storage;
|
||||
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.tile.storage.TileDrive;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.BlockStateContainer;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
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.World;
|
||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.client.UnlistedProperty;
|
||||
|
||||
import appeng.tile.storage.TileDrive;
|
||||
import appeng.util.Platform;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
||||
public class BlockDrive extends AEBaseTileBlock
|
||||
public class BlockDrive extends AEBaseTileBlock<TileDrive>
|
||||
{
|
||||
|
||||
public static final UnlistedProperty<DriveSlotsState> SLOTS_STATE = new UnlistedProperty<>( "drive_slots_state", DriveSlotsState.class );
|
||||
|
||||
public BlockDrive()
|
||||
{
|
||||
super( Material.IRON );
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer()
|
||||
{
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new ExtendedBlockState( this, this.getAEStates(), new IUnlistedProperty[] {
|
||||
SLOTS_STATE,
|
||||
FORWARD,
|
||||
UP
|
||||
} );
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockState getExtendedState( BlockState state, IBlockReader world, BlockPos pos )
|
||||
{
|
||||
TileDrive te = this.getTileEntity( world, pos );
|
||||
IExtendedBlockState extState = (IExtendedBlockState) super.getExtendedState( state, world, pos );
|
||||
return extState.with( SLOTS_STATE, te == null ? DriveSlotsState.createEmpty( 10 ) : DriveSlotsState.fromChestOrDrive( te ) );
|
||||
super( Properties.create(Material.IRON) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -92,7 +55,7 @@ public class BlockDrive extends AEBaseTileBlock
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_DRIVE );
|
||||
// FIXME Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_DRIVE );
|
||||
}
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
@@ -19,11 +19,12 @@
|
||||
package appeng.block.storage;
|
||||
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.tile.storage.TileIOPort;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
@@ -32,19 +33,15 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
|
||||
import appeng.tile.storage.TileIOPort;
|
||||
import appeng.util.Platform;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
||||
public class BlockIOPort extends AEBaseTileBlock
|
||||
public class BlockIOPort extends AEBaseTileBlock<TileIOPort>
|
||||
{
|
||||
|
||||
public BlockIOPort()
|
||||
{
|
||||
super( Material.IRON );
|
||||
super( Properties.create(Material.IRON) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -70,7 +67,7 @@ public class BlockIOPort extends AEBaseTileBlock
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_IOPORT );
|
||||
// FIXME Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_IOPORT );
|
||||
}
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
@@ -19,15 +19,14 @@
|
||||
package appeng.block.storage;
|
||||
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.container.implementations.ContainerSkyChest;
|
||||
import appeng.tile.storage.TileSkyChest;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.block.BlockRenderType;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.inventory.container.INamedContainerProvider;
|
||||
import net.minecraft.inventory.container.SimpleNamedContainerProvider;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
@@ -41,10 +40,7 @@ import net.minecraft.util.math.shapes.VoxelShapes;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.tile.storage.TileSkyChest;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraftforge.fml.network.NetworkHooks;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
||||
public class BlockSkyChest extends AEBaseTileBlock<TileSkyChest>
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package appeng.block.storage;
|
||||
|
||||
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -37,6 +38,8 @@ public class ChestRendering extends BlockRenderingCustomizer
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
|
||||
{
|
||||
rendering.renderType(RenderType.getCutout());
|
||||
|
||||
// I checked, the ME chest doesn't keep its color in item form
|
||||
itemRendering.color( new StaticItemColor( AEColor.TRANSPARENT ) );
|
||||
rendering.blockColor( new ColorableTileBlockColor() );
|
||||
|
||||
@@ -22,7 +22,7 @@ package appeng.block.storage;
|
||||
import appeng.bootstrap.BlockRenderingCustomizer;
|
||||
import appeng.bootstrap.IBlockRendering;
|
||||
import appeng.bootstrap.IItemRendering;
|
||||
import appeng.client.render.model.DriveModel;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
|
||||
|
||||
public class DriveRendering extends BlockRenderingCustomizer
|
||||
@@ -30,6 +30,7 @@ public class DriveRendering extends BlockRenderingCustomizer
|
||||
@Override
|
||||
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
|
||||
{
|
||||
rendering.builtInModel( "models/block/builtin/drive", new DriveModel() );
|
||||
rendering.renderType(RenderType.getCutout());
|
||||
// FIXME rendering.builtInModel( "models/block/builtin/drive", new DriveModel() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
|
||||
class BlockRendering implements IBlockRendering
|
||||
@@ -56,6 +57,9 @@ class BlockRendering implements IBlockRendering
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
private RenderType renderType;
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
private Predicate<RenderType> renderTypes;
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public IBlockRendering modelCustomizer( BiFunction<ResourceLocation, IBakedModel, IBakedModel> customizer )
|
||||
@@ -85,13 +89,11 @@ class BlockRendering implements IBlockRendering
|
||||
return this;
|
||||
}
|
||||
|
||||
// FIXME @OnlyIn( Dist.CLIENT )
|
||||
// FIXME @Override
|
||||
// FIXME public IBlockRendering stateMapper( IStateMapper mapper )
|
||||
// FIXME {
|
||||
// FIXME this.stateMapper = mapper;
|
||||
// FIXME return this;
|
||||
// FIXME }
|
||||
@Override
|
||||
public IBlockRendering renderType(Predicate<RenderType> typePredicate) {
|
||||
this.renderTypes = typePredicate;
|
||||
return this;
|
||||
}
|
||||
|
||||
void apply( FeatureFactory factory, Block block )
|
||||
{
|
||||
@@ -114,13 +116,8 @@ class BlockRendering implements IBlockRendering
|
||||
factory.addBootstrapComponent( new BlockColorComponent( block, this.blockColor ) );
|
||||
}
|
||||
|
||||
if (this.renderType != null) {
|
||||
factory.addBootstrapComponent( new RenderTypeComponent( block, this.renderType));
|
||||
if (this.renderType != null || this.renderTypes != null) {
|
||||
factory.addBootstrapComponent( new RenderTypeComponent( block, this.renderType, this.renderTypes));
|
||||
}
|
||||
|
||||
// FIXME if( this.stateMapper != null )
|
||||
// FIXME {
|
||||
// FIXME factory.addBootstrapComponent( new StateMapperComponent( block, this.stateMapper ) );
|
||||
// FIXME }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.RenderTypeLookup;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
/**
|
||||
* Sets the rendering type for a block.
|
||||
*/
|
||||
@@ -13,14 +15,23 @@ public class RenderTypeComponent implements IClientSetupComponent {
|
||||
|
||||
private final RenderType renderType;
|
||||
|
||||
public RenderTypeComponent(Block block, RenderType renderType) {
|
||||
private final Predicate<RenderType> renderTypes;
|
||||
|
||||
public RenderTypeComponent(Block block, RenderType renderType, Predicate<RenderType> renderTypes) {
|
||||
this.block = block;
|
||||
this.renderType = renderType;
|
||||
this.renderTypes = renderTypes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setup() {
|
||||
RenderTypeLookup.setRenderLayer(block, renderType);
|
||||
if (renderType != null) {
|
||||
RenderTypeLookup.setRenderLayer(block, renderType);
|
||||
}
|
||||
|
||||
if (renderTypes != null) {
|
||||
RenderTypeLookup.setRenderLayer(block, renderTypes);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ public class FluidRepo
|
||||
continue;
|
||||
}
|
||||
|
||||
final String dspName = searchMod ? Platform.getModId( fs ) : Platform.getFluidDisplayName( fs );
|
||||
final String dspName = searchMod ? Platform.getModId( fs ) : Platform.getFluidDisplayName( fs ).getString();
|
||||
boolean foundMatchingFluidStack = false;
|
||||
notDone = true;
|
||||
|
||||
|
||||
@@ -169,7 +169,7 @@ public class ItemRepo
|
||||
continue;
|
||||
}
|
||||
|
||||
final String dspName = searchMod ? Platform.getModId( is ) : Platform.getItemDisplayName( is );
|
||||
final String dspName = searchMod ? Platform.getModId( is ) : Platform.getItemDisplayName( is ).getString();
|
||||
boolean foundMatchingItemStack = false;
|
||||
notDone = true;
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import net.minecraft.world.ILightReader;
|
||||
|
||||
|
||||
/**
|
||||
@@ -43,7 +44,7 @@ public class StaticBlockColor implements IBlockColor
|
||||
}
|
||||
|
||||
@Override
|
||||
public int colorMultiplier( BlockState state, @Nullable IBlockReader worldIn, @Nullable BlockPos pos, int tintIndex )
|
||||
public int getColor( BlockState state, @Nullable ILightReader worldIn, @Nullable BlockPos pos, int tintIndex )
|
||||
{
|
||||
return this.color.getVariantByTintIndex( tintIndex );
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package appeng.client.render.cablebus;
|
||||
|
||||
import net.minecraft.client.particle.IParticleRenderType;
|
||||
import net.minecraft.client.particle.SpriteTexturedParticle;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
// Derived from Vanilla's BreakingParticle, but allows
|
||||
// a texture to be specified directly rather than via an itemstack
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class CableBusBreakingParticle extends SpriteTexturedParticle {
|
||||
|
||||
private final float field_217571_C;
|
||||
private final float field_217572_F;
|
||||
|
||||
public CableBusBreakingParticle(World world, double x, double y, double z, double speedX, double speedY, double speedZ, TextureAtlasSprite sprite) {
|
||||
super(world, x, y, z, speedX, speedY, speedZ);
|
||||
this.setSprite(sprite);
|
||||
this.particleGravity = 1.0F;
|
||||
this.particleScale /= 2.0F;
|
||||
this.field_217571_C = this.rand.nextFloat() * 3.0F;
|
||||
this.field_217572_F = this.rand.nextFloat() * 3.0F;
|
||||
}
|
||||
|
||||
public CableBusBreakingParticle(World world, double x, double y, double z, TextureAtlasSprite sprite) {
|
||||
this(world, x, y, z, 0, 0, 0, sprite);
|
||||
}
|
||||
|
||||
public IParticleRenderType getRenderType() {
|
||||
return IParticleRenderType.TERRAIN_SHEET;
|
||||
}
|
||||
|
||||
protected float getMinU() {
|
||||
return this.sprite.getInterpolatedU((this.field_217571_C + 1.0F) / 4.0F * 16.0F);
|
||||
}
|
||||
|
||||
protected float getMaxU() {
|
||||
return this.sprite.getInterpolatedU(this.field_217571_C / 4.0F * 16.0F);
|
||||
}
|
||||
|
||||
protected float getMinV() {
|
||||
return this.sprite.getInterpolatedV(this.field_217572_F / 4.0F * 16.0F);
|
||||
}
|
||||
|
||||
protected float getMaxV() {
|
||||
return this.sprite.getInterpolatedV((this.field_217572_F + 1.0F) / 4.0F * 16.0F);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,14 +22,13 @@ package appeng.client.render.renderable;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.util.function.Function;
|
||||
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.Matrix4f;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.util.vector.Matrix4f;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
@@ -45,28 +44,22 @@ public class ItemRenderable<T extends TileEntity> implements Renderable<T>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt( T te, double x, double y, double z, float partialTicks, int destroyStage )
|
||||
public void renderTileEntityAt(T te, float partialTicks, com.mojang.blaze3d.matrix.MatrixStack matrixStack, IRenderTypeBuffer buffers, int combinedLight, int combinedOverlay)
|
||||
{
|
||||
Pair<ItemStack, Matrix4f> pair = this.f.apply( te );
|
||||
if( pair != null && pair.getLeft() != null )
|
||||
{
|
||||
GlStateManager.pushMatrix();
|
||||
matrixStack.push();
|
||||
if( pair.getRight() != null )
|
||||
{
|
||||
FloatBuffer matrix = BufferUtils.createFloatBuffer( 16 );
|
||||
pair.getRight().store( matrix );
|
||||
matrix.flip();
|
||||
GlStateManager.multMatrix( matrix );
|
||||
// FIXME pair.getRight().store( matrix );
|
||||
// FIXME matrix.flip();
|
||||
// FIXME matrixStack.( matrix );
|
||||
}
|
||||
Minecraft.getInstance().getRenderItem().renderItem( pair.getLeft(), TransformType.GROUND );
|
||||
GlStateManager.popMatrix();
|
||||
Minecraft.getInstance().getItemRenderer().renderItem( pair.getLeft(), ItemCameraTransforms.TransformType.GROUND, combinedLight, combinedOverlay, matrixStack, buffers );
|
||||
matrixStack.pop();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityFast( T te, double x, double y, double z, float partialTicks, int destroyStage, BufferBuilder buffer )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,15 +19,14 @@
|
||||
package appeng.client.render.renderable;
|
||||
|
||||
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
|
||||
public interface Renderable<T extends TileEntity>
|
||||
{
|
||||
|
||||
public void renderTileEntityAt( T te, double x, double y, double z, float partialTicks, int destroyStage );
|
||||
|
||||
public void renderTileEntityFast( T te, double x, double y, double z, float partialTicks, int destroyStage, BufferBuilder buffer );
|
||||
void renderTileEntityAt(T te, float partialTicks, MatrixStack matrixStack, IRenderTypeBuffer buffers, int combinedLight, int combinedOverlay);
|
||||
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -45,13 +45,14 @@ public class SpatialPylonRendering extends BlockRenderingCustomizer
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
|
||||
{
|
||||
rendering.builtInModel( MODEL_ID.getResourcePath(), new SpatialPylonModel() );
|
||||
rendering.stateMapper( this::mapState );
|
||||
rendering.renderType(RenderType.getCutout());
|
||||
// FIXME rendering.builtInModel( MODEL_ID.getResourcePath(), new SpatialPylonModel() );
|
||||
// FIXME rendering.stateMapper( this::mapState );
|
||||
}
|
||||
|
||||
private Map<BlockState, ModelResourceLocation> mapState( Block block )
|
||||
{
|
||||
return ImmutableMap.of( block.getDefaultState(), new ModelResourceLocation( MODEL_ID, "normal" ) );
|
||||
}
|
||||
// FIXME private Map<BlockState, ModelResourceLocation> mapState( Block block )
|
||||
// FIXME {
|
||||
// FIXME return ImmutableMap.of( block.getDefaultState(), new ModelResourceLocation( MODEL_ID, "normal" ) );
|
||||
// FIXME }
|
||||
|
||||
}
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* 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.client.render.spatial;
|
||||
|
||||
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
|
||||
|
||||
/**
|
||||
* Models the rendering state of the spatial pylon, which is largely determined by the state of neighboring tiles.
|
||||
*/
|
||||
public class SpatialPylonStateProperty implements IUnlistedProperty<Integer>
|
||||
{
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return "spatial_state";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid( Integer value )
|
||||
{
|
||||
int val = value;
|
||||
// The lower 6 bits are used
|
||||
return ( val & ~0x3F ) == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Integer> getType()
|
||||
{
|
||||
return Integer.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String valueToString( Integer value )
|
||||
{
|
||||
return value.toString();
|
||||
}
|
||||
}
|
||||
@@ -19,8 +19,8 @@
|
||||
package appeng.client.render.tesr;
|
||||
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
@@ -32,32 +32,34 @@ import appeng.client.render.FacingToRotation;
|
||||
import appeng.client.render.renderable.Renderable;
|
||||
import appeng.tile.AEBaseTile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public class ModularTESR<T extends AEBaseTile> extends TileEntityRenderer<T>
|
||||
{
|
||||
|
||||
private final Renderable[] renderables;
|
||||
private final List<Renderable<? super T>> renderables;
|
||||
|
||||
public ModularTESR( TileEntityRendererDispatcher rendererDispatcherIn, Renderable... renderables )
|
||||
@SafeVarargs
|
||||
public ModularTESR( TileEntityRendererDispatcher rendererDispatcherIn, Renderable<? super T>... renderables )
|
||||
{
|
||||
super( rendererDispatcherIn );
|
||||
this.renderables = renderables;
|
||||
this.renderables = ImmutableList.copyOf(renderables);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render( T te, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn )
|
||||
public void render( T te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffers, int combinedLight, int combinedOverlay )
|
||||
{
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate( x, y, z );
|
||||
GlStateManager.translate( 0.5, 0.5, 0.5 );
|
||||
FacingToRotation.get( te.getForward(), te.getUp() ).push(matrixStackIn);
|
||||
GlStateManager.translate( -0.5, -0.5, -0.5 );
|
||||
for( Renderable renderable : this.renderables )
|
||||
ms.push();
|
||||
ms.translate( 0.5, 0.5, 0.5 );
|
||||
FacingToRotation.get( te.getForward(), te.getUp() ).push(ms);
|
||||
ms.translate( -0.5, -0.5, -0.5 );
|
||||
for( Renderable<? super T> renderable : this.renderables )
|
||||
{
|
||||
renderable.renderTileEntityAt( te, x, y, z, partialTicks, destroyStage );
|
||||
renderable.renderTileEntityAt( te, partialTicks, ms, buffers, combinedLight, combinedOverlay);
|
||||
}
|
||||
GlStateManager.popMatrix();
|
||||
ms.pop();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1091,7 +1091,7 @@ public abstract class AEBaseContainer extends Container
|
||||
{
|
||||
if( name.hasCustomInventoryName() )
|
||||
{
|
||||
this.setCustomName( name.getCustomInventoryName() );
|
||||
this.setCustomName( name.getCustomInventoryName().getString() );
|
||||
}
|
||||
|
||||
if( this.getCustomName() != null )
|
||||
|
||||
@@ -114,7 +114,7 @@ public class ContainerCraftConfirm extends AEBaseContainer
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setName( this.cpus.get( this.getSelectedCpu() ).getName() );
|
||||
this.setName( this.cpus.get( this.getSelectedCpu() ).getName().getString() );
|
||||
this.setCpuAvailableBytes( this.cpus.get( this.getSelectedCpu() ).getSize() );
|
||||
this.setCpuCoProcessors( this.cpus.get( this.getSelectedCpu() ).getProcessors() );
|
||||
}
|
||||
@@ -306,7 +306,7 @@ public class ContainerCraftConfirm extends AEBaseContainer
|
||||
}
|
||||
else if( this.getSelectedCpu() != -1 )
|
||||
{
|
||||
this.setName( this.cpus.get( this.getSelectedCpu() ).getName() );
|
||||
this.setName( this.cpus.get( this.getSelectedCpu() ).getName().getString() );
|
||||
this.setCpuAvailableBytes( this.cpus.get( this.getSelectedCpu() ).getSize() );
|
||||
this.setCpuCoProcessors( this.cpus.get( this.getSelectedCpu() ).getProcessors() );
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ public class ContainerCraftingStatus extends ContainerCraftingCPU
|
||||
}
|
||||
else if( this.selectedCpu != -1 )
|
||||
{
|
||||
this.myName = this.cpus.get( this.selectedCpu ).getName();
|
||||
this.myName = this.cpus.get( this.selectedCpu ).getName().getString();
|
||||
}
|
||||
|
||||
if( this.selectedCpu == -1 && this.cpus.size() > 0 )
|
||||
@@ -174,7 +174,7 @@ public class ContainerCraftingStatus extends ContainerCraftingCPU
|
||||
}
|
||||
else
|
||||
{
|
||||
this.myName = this.cpus.get( this.selectedCpu ).getName();
|
||||
this.myName = this.cpus.get( this.selectedCpu ).getName().getString();
|
||||
this.setCPU( this.cpus.get( this.selectedCpu ).getCpu() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -329,7 +329,7 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
|
||||
final DualityInterface dual = ih.getInterfaceDuality();
|
||||
if( gn.isActive() && dual.getConfigManager().getSetting( Settings.INTERFACE_TERMINAL ) == YesNo.YES )
|
||||
{
|
||||
this.diList.put( ih, new InvTracker( dual, dual.getPatterns(), dual.getTermName() ) );
|
||||
this.diList.put( ih, new InvTracker( dual, dual.getPatterns(), dual.getTermName().getString() ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -339,7 +339,7 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
|
||||
final DualityInterface dual = ih.getInterfaceDuality();
|
||||
if( gn.isActive() && dual.getConfigManager().getSetting( Settings.INTERFACE_TERMINAL ) == YesNo.YES )
|
||||
{
|
||||
this.diList.put( ih, new InvTracker( dual, dual.getPatterns(), dual.getTermName() ) );
|
||||
this.diList.put( ih, new InvTracker( dual, dual.getPatterns(), dual.getTermName().getString() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ import appeng.bootstrap.components.IClientSetupComponent;
|
||||
import appeng.client.ClientHelper;
|
||||
import appeng.client.render.model.GlassModelLoader;
|
||||
import appeng.client.render.model.SkyCompassModelLoader;
|
||||
import appeng.core.stats.AdvancementTriggers;
|
||||
import appeng.server.ServerHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.EntityType;
|
||||
@@ -152,12 +153,12 @@ public final class AppEng
|
||||
// {
|
||||
// return this.registration.storageDimensionID;
|
||||
// }
|
||||
//
|
||||
// public AdvancementTriggers getAdvancementTriggers()
|
||||
// {
|
||||
// return this.registration.advancementTriggers;
|
||||
// }
|
||||
//
|
||||
|
||||
public AdvancementTriggers getAdvancementTriggers()
|
||||
{
|
||||
return null; // FIXME this.registration.advancementTriggers;
|
||||
}
|
||||
|
||||
// @EventHandler
|
||||
// private void preInit( final FMLPreInitializationEvent event )
|
||||
// {
|
||||
|
||||
@@ -22,36 +22,56 @@ package appeng.core.api.definitions;
|
||||
import appeng.api.definitions.IBlockDefinition;
|
||||
import appeng.api.definitions.IBlocks;
|
||||
import appeng.api.definitions.ITileDefinition;
|
||||
import appeng.block.AEBaseBlockItemChargeable;
|
||||
import appeng.block.crafting.*;
|
||||
import appeng.block.grindstone.BlockCrank;
|
||||
import appeng.block.grindstone.BlockGrinder;
|
||||
import appeng.block.misc.*;
|
||||
import appeng.block.networking.*;
|
||||
import appeng.block.paint.BlockPaint;
|
||||
import appeng.block.qnb.BlockQuantumLinkChamber;
|
||||
import appeng.block.qnb.BlockQuantumRing;
|
||||
import appeng.block.qnb.QuantumBridgeRendering;
|
||||
import appeng.block.spatial.BlockMatrixFrame;
|
||||
import appeng.block.storage.BlockSkyChest;
|
||||
import appeng.block.spatial.BlockSpatialIOPort;
|
||||
import appeng.block.spatial.BlockSpatialPylon;
|
||||
import appeng.block.storage.*;
|
||||
import appeng.bootstrap.*;
|
||||
import appeng.bootstrap.components.IEntityRegistrationComponent;
|
||||
import appeng.bootstrap.components.IPreInitComponent;
|
||||
import appeng.bootstrap.definitions.TileEntityDefinition;
|
||||
import appeng.client.render.crafting.CraftingCubeRendering;
|
||||
import appeng.client.render.spatial.SpatialPylonRendering;
|
||||
import appeng.client.render.tesr.CrankTESR;
|
||||
import appeng.client.render.tesr.SkyChestTESR;
|
||||
import appeng.api.features.AEFeature;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.features.registries.PartModels;
|
||||
import appeng.debug.*;
|
||||
import appeng.decorative.AEDecorativeBlock;
|
||||
import appeng.decorative.solid.*;
|
||||
import appeng.fluids.block.BlockFluidInterface;
|
||||
import appeng.fluids.tile.TileFluidInterface;
|
||||
import appeng.hooks.DispenserBehaviorTinyTNT;
|
||||
import appeng.tile.crafting.TileCraftingMonitorTile;
|
||||
import appeng.tile.crafting.TileCraftingStorageTile;
|
||||
import appeng.tile.crafting.TileCraftingTile;
|
||||
import appeng.tile.crafting.TileMolecularAssembler;
|
||||
import appeng.tile.grindstone.TileCrank;
|
||||
import appeng.tile.grindstone.TileGrinder;
|
||||
import appeng.tile.misc.TileInscriber;
|
||||
import appeng.tile.misc.TileSkyCompass;
|
||||
import appeng.tile.misc.*;
|
||||
import appeng.tile.networking.*;
|
||||
import appeng.tile.qnb.TileQuantumBridge;
|
||||
import appeng.tile.spatial.TileSpatialIOPort;
|
||||
import appeng.tile.spatial.TileSpatialPylon;
|
||||
import appeng.tile.storage.TileChest;
|
||||
import appeng.tile.storage.TileDrive;
|
||||
import appeng.tile.storage.TileIOPort;
|
||||
import appeng.tile.storage.TileSkyChest;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SlabBlock;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.StairsBlock;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
@@ -265,131 +285,128 @@ public final class ApiBlocks implements IBlocks
|
||||
.rendering(new InscriberRendering())
|
||||
.build() )
|
||||
.build();
|
||||
// this.wirelessAccessPoint = registry.block( "wireless_access_point", BlockWireless::new )
|
||||
// .features( AEFeature.WIRELESS_ACCESS_TERMINAL )
|
||||
// .tileEntity( registry.tileEntity("", TileWireless.class, TileWireless::new).build() )
|
||||
// .rendering( new WirelessRendering() )
|
||||
// .build();
|
||||
// this.charger = registry.block( "charger", BlockCharger::new )
|
||||
// .features( AEFeature.CHARGER )
|
||||
// .tileEntity( registry.tileEntity("", TileCharger.class, TileCharger::new).build() )
|
||||
// .rendering( new BlockRenderingCustomizer()
|
||||
// {
|
||||
// @Override
|
||||
// @OnlyIn( Dist.CLIENT )
|
||||
// public void customize( IBlockRendering rendering, IItemRendering itemRendering )
|
||||
// {
|
||||
// rendering.tesr( BlockCharger.createTesr() );
|
||||
// }
|
||||
// } )
|
||||
// .build();
|
||||
// this.tinyTNT = registry.block( "tiny_tnt", BlockTinyTNT::new )
|
||||
// .features( AEFeature.TINY_TNT )
|
||||
// FIXME .bootstrap( ( block, item ) -> (IPreInitComponent) side -> DispenserBlock.registerDispenseBehavior( item,
|
||||
// new DispenserBehaviorTinyTNT() ) )
|
||||
// .bootstrap( ( block, item ) -> (IEntityRegistrationComponent) r ->
|
||||
// {
|
||||
// r.register( EntityEntryBuilder.create()
|
||||
// .entity( EntityTinyTNTPrimed.class )
|
||||
// .id( new ResourceLocation( "appliedenergistics2", EntityTinyTNTPrimed.class.getName() ),
|
||||
// EntityIds.get( EntityTinyTNTPrimed.class ) )
|
||||
// .name( "EntityTinyTNTPrimed" )
|
||||
// .tracker( 16, 4, true )
|
||||
// .build() );
|
||||
// } )
|
||||
// .build();
|
||||
// this.securityStation = registry.block( "security_station", BlockSecurityStation::new )
|
||||
// .features( AEFeature.SECURITY )
|
||||
// .tileEntity( registry.tileEntity("", TileSecurityStation.class, TileSecurityStation::new).build() )
|
||||
// .rendering( new SecurityStationRendering() )
|
||||
// .build();
|
||||
// this.quantumRing = registry.block( "quantum_ring", BlockQuantumRing::new )
|
||||
// .features( AEFeature.QUANTUM_NETWORK_BRIDGE )
|
||||
// .tileEntity( registry.tileEntity( TileQuantumBridge.class, "quantum_ring" ) )
|
||||
// .rendering( new QuantumBridgeRendering() )
|
||||
// .build();
|
||||
// this.quantumLink = registry.block( "quantum_link", BlockQuantumLinkChamber::new )
|
||||
// .features( AEFeature.QUANTUM_NETWORK_BRIDGE )
|
||||
// .tileEntity( registry.tileEntity( TileQuantumBridge.class, "quantum_ring" ) )
|
||||
// .rendering( new QuantumBridgeRendering() )
|
||||
// .build();
|
||||
// this.spatialPylon = registry.block( "spatial_pylon", BlockSpatialPylon::new )
|
||||
// .features( AEFeature.SPATIAL_IO )
|
||||
// .tileEntity( registry.tileEntity("", TileSpatialPylon.class, TileSpatialPylon::new).build() )
|
||||
// .useCustomItemModel()
|
||||
// .rendering( new SpatialPylonRendering() )
|
||||
// .build();
|
||||
// this.spatialIOPort = registry.block( "spatial_io_port", BlockSpatialIOPort::new )
|
||||
// .features( AEFeature.SPATIAL_IO )
|
||||
// .tileEntity( registry.tileEntity("", TileSpatialIOPort.class, TileSpatialIOPort::new).build() )
|
||||
// .build();
|
||||
// this.controller = registry.block( "controller", BlockController::new )
|
||||
// .features( AEFeature.CHANNELS )
|
||||
// .tileEntity( registry.tileEntity("", TileController.class, TileController::new).build() )
|
||||
// .useCustomItemModel()
|
||||
// .rendering( new ControllerRendering() )
|
||||
// .build();
|
||||
// this.drive = registry.block( "drive", BlockDrive::new )
|
||||
// .features( AEFeature.STORAGE_CELLS, AEFeature.ME_DRIVE )
|
||||
// .tileEntity( registry.tileEntity("", TileDrive.class, TileDrive::new).build() )
|
||||
// .useCustomItemModel()
|
||||
// .rendering( new DriveRendering() )
|
||||
// .build();
|
||||
// this.chest = registry.block( "chest", BlockChest::new )
|
||||
// .features( AEFeature.STORAGE_CELLS, AEFeature.ME_CHEST )
|
||||
// .tileEntity( registry.tileEntity("", TileChest.class, TileChest::new).build() )
|
||||
// .useCustomItemModel()
|
||||
// .rendering( new ChestRendering() )
|
||||
// .build();
|
||||
// this.iface = registry.block( "interface", BlockInterface::new )
|
||||
// .features( AEFeature.INTERFACE )
|
||||
// .tileEntity( registry.tileEntity("", TileInterface.class, TileInterface::new).build() )
|
||||
// .build();
|
||||
// this.fluidIface = registry.block( "fluid_interface", BlockFluidInterface::new )
|
||||
// .features( AEFeature.FLUID_INTERFACE )
|
||||
// .tileEntity( registry.tileEntity("", TileFluidInterface.class, TileFluidInterface::new).build() )
|
||||
// .build();
|
||||
// this.cellWorkbench = registry.block( "cell_workbench", BlockCellWorkbench::new )
|
||||
// .features( AEFeature.STORAGE_CELLS )
|
||||
// .tileEntity( registry.tileEntity("", TileCellWorkbench.class, TileCellWorkbench::new).build() )
|
||||
// .build();
|
||||
// this.iOPort = registry.block( "io_port", BlockIOPort::new )
|
||||
// .features( AEFeature.STORAGE_CELLS, AEFeature.IO_PORT )
|
||||
// .tileEntity( registry.tileEntity("", TileIOPort.class, TileIOPort::new).build() )
|
||||
// .build();
|
||||
// this.condenser = registry.block( "condenser", BlockCondenser::new )
|
||||
// .features( AEFeature.CONDENSER )
|
||||
// .tileEntity( registry.tileEntity("", TileCondenser.class, TileCondenser::new).build() )
|
||||
// .build();
|
||||
// this.energyAcceptor = registry.block( "energy_acceptor", BlockEnergyAcceptor::new )
|
||||
// .features( AEFeature.ENERGY_ACCEPTOR )
|
||||
// .tileEntity( registry.tileEntity("", TileEnergyAcceptor.class, TileEnergyAcceptor::new).build() )
|
||||
// .build();
|
||||
// this.vibrationChamber = registry.block( "vibration_chamber", BlockVibrationChamber::new )
|
||||
// .features( AEFeature.POWER_GEN )
|
||||
// .tileEntity( registry.tileEntity("", TileVibrationChamber.class, TileVibrationChamber::new).build() )
|
||||
// .build();
|
||||
// this.quartzGrowthAccelerator = registry.block( "quartz_growth_accelerator", BlockQuartzGrowthAccelerator::new )
|
||||
// .tileEntity( registry.tileEntity("", TileQuartzGrowthAccelerator.class, TileQuartzGrowthAccelerator::new).build() )
|
||||
// .features( AEFeature.CRYSTAL_GROWTH_ACCELERATOR )
|
||||
// .build();
|
||||
// this.energyCell = registry.block( "energy_cell", BlockEnergyCell::new )
|
||||
// .features( AEFeature.ENERGY_CELLS )
|
||||
// .item( AEBaseBlockItemChargeable::new )
|
||||
// .tileEntity( registry.tileEntity("", TileEnergyCell.class, TileEnergyCell::new).build() )
|
||||
// .rendering( new BlockEnergyCellRendering( new ResourceLocation( AppEng.MOD_ID, "energy_cell" ) ) )
|
||||
// .build();
|
||||
// this.energyCellDense = registry.block( "dense_energy_cell", BlockDenseEnergyCell::new )
|
||||
// .features( AEFeature.ENERGY_CELLS, AEFeature.DENSE_ENERGY_CELLS )
|
||||
// .item( AEBaseBlockItemChargeable::new )
|
||||
// .tileEntity( registry.tileEntity("", TileDenseEnergyCell.class, TileDenseEnergyCell::new).build() )
|
||||
// .rendering( new BlockEnergyCellRendering( new ResourceLocation( AppEng.MOD_ID, "dense_energy_cell" ) ) )
|
||||
// .build();
|
||||
// this.energyCellCreative = registry.block( "creative_energy_cell", BlockCreativeEnergyCell::new )
|
||||
// .features( AEFeature.CREATIVE )
|
||||
// .tileEntity( registry.tileEntity("", TileCreativeEnergyCell.class, TileCreativeEnergyCell::new).build() )
|
||||
// .build();
|
||||
//
|
||||
this.wirelessAccessPoint = registry.block( "wireless_access_point", BlockWireless::new )
|
||||
.features( AEFeature.WIRELESS_ACCESS_TERMINAL )
|
||||
.tileEntity( registry.tileEntity("wireless_access_point", TileWireless.class, TileWireless::new).build() )
|
||||
.rendering( new WirelessRendering() )
|
||||
.build();
|
||||
this.charger = registry.block( "charger", BlockCharger::new )
|
||||
.features( AEFeature.CHARGER )
|
||||
.tileEntity( registry.tileEntity("charger", TileCharger.class, TileCharger::new)
|
||||
.rendering( new TileEntityRenderingCustomizer<TileCharger>()
|
||||
{
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void customize( TileEntityRendering<TileCharger> rendering )
|
||||
{
|
||||
rendering.tileEntityRenderer( BlockCharger.createTesr() );
|
||||
}
|
||||
} )
|
||||
.build() )
|
||||
.build();
|
||||
this.tinyTNT = registry.block( "tiny_tnt", BlockTinyTNT::new )
|
||||
.features( AEFeature.TINY_TNT )
|
||||
.bootstrap( ( block, item ) -> (IPreInitComponent) side -> DispenserBlock.registerDispenseBehavior( item,
|
||||
new DispenserBehaviorTinyTNT() ) )
|
||||
.bootstrap( ( block, item ) -> (IEntityRegistrationComponent) r ->
|
||||
{
|
||||
// FIXME r.register( EntityEntryBuilder.create()
|
||||
// FIXME .entity( EntityTinyTNTPrimed.class )
|
||||
// FIXME .id( new ResourceLocation( "appliedenergistics2", EntityTinyTNTPrimed.class.getName() ),
|
||||
// FIXME EntityIds.get( EntityTinyTNTPrimed.class ) )
|
||||
// FIXME .name( "EntityTinyTNTPrimed" )
|
||||
// FIXME .tracker( 16, 4, true )
|
||||
// FIXME .build() );
|
||||
} )
|
||||
.build();
|
||||
this.securityStation = registry.block( "security_station", BlockSecurityStation::new )
|
||||
.features( AEFeature.SECURITY )
|
||||
.tileEntity( registry.tileEntity("security_station", TileSecurityStation.class, TileSecurityStation::new).build() )
|
||||
.rendering( new SecurityStationRendering() )
|
||||
.build();
|
||||
this.quantumRing = registry.block( "quantum_ring", BlockQuantumRing::new )
|
||||
.features( AEFeature.QUANTUM_NETWORK_BRIDGE )
|
||||
.tileEntity( registry.tileEntity( "quantum_ring", TileQuantumBridge.class, TileQuantumBridge::new ).build() )
|
||||
.rendering( new QuantumBridgeRendering() )
|
||||
.build();
|
||||
this.quantumLink = registry.block( "quantum_link", BlockQuantumLinkChamber::new )
|
||||
.features( AEFeature.QUANTUM_NETWORK_BRIDGE )
|
||||
.tileEntity( registry.tileEntity( "quantum_ring", TileQuantumBridge.class, TileQuantumBridge::new ).build() )
|
||||
.rendering( new QuantumBridgeRendering() )
|
||||
.build();
|
||||
this.spatialPylon = registry.block( "spatial_pylon", BlockSpatialPylon::new )
|
||||
.features( AEFeature.SPATIAL_IO )
|
||||
.tileEntity( registry.tileEntity("spatial_pylon", TileSpatialPylon.class, TileSpatialPylon::new).build() )
|
||||
.rendering( new SpatialPylonRendering() )
|
||||
.build();
|
||||
this.spatialIOPort = registry.block( "spatial_io_port", BlockSpatialIOPort::new )
|
||||
.features( AEFeature.SPATIAL_IO )
|
||||
.tileEntity( registry.tileEntity("spatial_io_port", TileSpatialIOPort.class, TileSpatialIOPort::new).build() )
|
||||
.build();
|
||||
this.controller = registry.block( "controller", BlockController::new )
|
||||
.features( AEFeature.CHANNELS )
|
||||
.tileEntity( registry.tileEntity("controller", TileController.class, TileController::new).build() )
|
||||
.rendering( new ControllerRendering() )
|
||||
.build();
|
||||
this.drive = registry.block( "drive", BlockDrive::new )
|
||||
.features( AEFeature.STORAGE_CELLS, AEFeature.ME_DRIVE )
|
||||
.tileEntity( registry.tileEntity("drive", TileDrive.class, TileDrive::new).build() )
|
||||
.rendering( new DriveRendering() )
|
||||
.build();
|
||||
this.chest = registry.block( "chest", BlockChest::new )
|
||||
.features( AEFeature.STORAGE_CELLS, AEFeature.ME_CHEST )
|
||||
.tileEntity( registry.tileEntity("chest", TileChest.class, TileChest::new).build() )
|
||||
.rendering( new ChestRendering() )
|
||||
.build();
|
||||
this.iface = registry.block( "interface", BlockInterface::new )
|
||||
.features( AEFeature.INTERFACE )
|
||||
.tileEntity( registry.tileEntity("interface", TileInterface.class, TileInterface::new).build() )
|
||||
.build();
|
||||
this.fluidIface = registry.block( "fluid_interface", BlockFluidInterface::new )
|
||||
.features( AEFeature.FLUID_INTERFACE )
|
||||
.tileEntity( registry.tileEntity("fluid_interface", TileFluidInterface.class, TileFluidInterface::new).build() )
|
||||
.build();
|
||||
this.cellWorkbench = registry.block( "cell_workbench", BlockCellWorkbench::new )
|
||||
.features( AEFeature.STORAGE_CELLS )
|
||||
.tileEntity( registry.tileEntity("cell_workbench", TileCellWorkbench.class, TileCellWorkbench::new).build() )
|
||||
.build();
|
||||
this.iOPort = registry.block( "io_port", BlockIOPort::new )
|
||||
.features( AEFeature.STORAGE_CELLS, AEFeature.IO_PORT )
|
||||
.tileEntity( registry.tileEntity("io_port", TileIOPort.class, TileIOPort::new).build() )
|
||||
.build();
|
||||
this.condenser = registry.block( "condenser", BlockCondenser::new )
|
||||
.features( AEFeature.CONDENSER )
|
||||
.tileEntity( registry.tileEntity("condenser", TileCondenser.class, TileCondenser::new).build() )
|
||||
.build();
|
||||
this.energyAcceptor = registry.block( "energy_acceptor", BlockEnergyAcceptor::new )
|
||||
.features( AEFeature.ENERGY_ACCEPTOR )
|
||||
.tileEntity( registry.tileEntity("energy_acceptor", TileEnergyAcceptor.class, TileEnergyAcceptor::new).build() )
|
||||
.build();
|
||||
this.vibrationChamber = registry.block( "vibration_chamber", BlockVibrationChamber::new )
|
||||
.features( AEFeature.POWER_GEN )
|
||||
.tileEntity( registry.tileEntity("vibration_chamber", TileVibrationChamber.class, TileVibrationChamber::new).build() )
|
||||
.build();
|
||||
this.quartzGrowthAccelerator = registry.block( "quartz_growth_accelerator", BlockQuartzGrowthAccelerator::new )
|
||||
.tileEntity( registry.tileEntity("quartz_growth_accelerator", TileQuartzGrowthAccelerator.class, TileQuartzGrowthAccelerator::new).build() )
|
||||
.features( AEFeature.CRYSTAL_GROWTH_ACCELERATOR )
|
||||
.build();
|
||||
this.energyCell = registry.block( "energy_cell", BlockEnergyCell::new )
|
||||
.features( AEFeature.ENERGY_CELLS )
|
||||
.item( AEBaseBlockItemChargeable::new )
|
||||
.tileEntity( registry.tileEntity("energy_cell", TileEnergyCell.class, TileEnergyCell::new).build() )
|
||||
.rendering( new BlockEnergyCellRendering( new ResourceLocation( AppEng.MOD_ID, "energy_cell" ) ) )
|
||||
.build();
|
||||
this.energyCellDense = registry.block( "dense_energy_cell", BlockDenseEnergyCell::new )
|
||||
.features( AEFeature.ENERGY_CELLS, AEFeature.DENSE_ENERGY_CELLS )
|
||||
.item( AEBaseBlockItemChargeable::new )
|
||||
.tileEntity( registry.tileEntity("dense_energy_cell", TileDenseEnergyCell.class, TileDenseEnergyCell::new).build() )
|
||||
.rendering( new BlockEnergyCellRendering( new ResourceLocation( AppEng.MOD_ID, "dense_energy_cell" ) ) )
|
||||
.build();
|
||||
this.energyCellCreative = registry.block( "creative_energy_cell", BlockCreativeEnergyCell::new )
|
||||
.features( AEFeature.CREATIVE )
|
||||
.tileEntity( registry.tileEntity("creative_energy_cell", TileCreativeEnergyCell.class, TileCreativeEnergyCell::new).build() )
|
||||
.build();
|
||||
|
||||
|
||||
TileEntityDefinition craftingUnit = registry.tileEntity("crafting_unit", TileCraftingTile.class, TileCraftingTile::new)
|
||||
.build();
|
||||
@@ -428,7 +445,7 @@ public final class ApiBlocks implements IBlocks
|
||||
.rendering( new CraftingCubeRendering( "crafting_storage_64k", CraftingUnitType.STORAGE_64K ) )
|
||||
.build();
|
||||
this.craftingMonitor = crafting.block( "crafting_monitor", () -> new BlockCraftingMonitor(craftingBlockProps) )
|
||||
.tileEntity( registry.tileEntity("", TileCraftingMonitorTile.class, TileCraftingMonitorTile::new)
|
||||
.tileEntity( registry.tileEntity("crafting_monitor", TileCraftingMonitorTile.class, TileCraftingMonitorTile::new)
|
||||
.rendering(new TileEntityRenderingCustomizer<TileCraftingMonitorTile>() {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
@Override
|
||||
@@ -458,17 +475,23 @@ public final class ApiBlocks implements IBlocks
|
||||
.tileEntity( registry.tileEntity("molecular_assembler", TileMolecularAssembler.class, TileMolecularAssembler::new).build() )
|
||||
.build();
|
||||
|
||||
// this.lightDetector = registry.block( "light_detector", BlockLightDetector::new )
|
||||
// .features( AEFeature.LIGHT_DETECTOR )
|
||||
// .tileEntity( registry.tileEntity("", TileLightDetector.class, TileLightDetector::new).build() )
|
||||
// .useCustomItemModel()
|
||||
// .build();
|
||||
// this.paint = registry.block( "paint", BlockPaint::new )
|
||||
// .features( AEFeature.PAINT_BALLS )
|
||||
// .tileEntity( registry.tileEntity("", TilePaint.class, TilePaint::new).build() )
|
||||
// .rendering( new PaintRendering() )
|
||||
// .build();
|
||||
//
|
||||
this.lightDetector = registry.block( "light_detector", BlockLightDetector::new )
|
||||
.features( AEFeature.LIGHT_DETECTOR )
|
||||
.tileEntity( registry.tileEntity("light_detector", TileLightDetector.class, TileLightDetector::new).build() )
|
||||
.rendering(new BlockRenderingCustomizer() {
|
||||
@Override
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void customize(IBlockRendering rendering, IItemRendering itemRendering) {
|
||||
rendering.renderType(RenderType.getCutout());
|
||||
}
|
||||
})
|
||||
.build();
|
||||
this.paint = registry.block( "paint", BlockPaint::new )
|
||||
.features( AEFeature.PAINT_BALLS )
|
||||
.tileEntity( registry.tileEntity("paint", TilePaint.class, TilePaint::new).build() )
|
||||
// FIXME .rendering( new PaintRendering() )
|
||||
.build();
|
||||
|
||||
this.skyStoneStairs = deco.block( "sky_stone_stairs", () -> new StairsBlock(this.skyStoneBlock().block()::getDefaultState, SKYSTONE_PROPERTIES ) )
|
||||
.addFeatures( AEFeature.SKY_STONE )
|
||||
.build();
|
||||
@@ -529,31 +552,26 @@ public final class ApiBlocks implements IBlocks
|
||||
.addFeatures( AEFeature.CERTUS )
|
||||
.build();
|
||||
|
||||
// this.itemGen = registry.block( "debug_item_gen", BlockItemGen::new )
|
||||
// .features( AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE )
|
||||
// .tileEntity( registry.tileEntity("", TileItemGen.class, TileItemGen::new).build() )
|
||||
// .useCustomItemModel()
|
||||
// .build();
|
||||
// this.chunkLoader = registry.block( "debug_chunk_loader", BlockChunkloader::new )
|
||||
// .features( AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE )
|
||||
// .tileEntity( registry.tileEntity("", TileChunkLoader.class, TileChunkLoader::new).build() )
|
||||
// .useCustomItemModel()
|
||||
// .build();
|
||||
// this.phantomNode = registry.block( "debug_phantom_node", BlockPhantomNode::new )
|
||||
// .features( AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE )
|
||||
// .tileEntity( registry.tileEntity("", TilePhantomNode.class, TilePhantomNode::new).build() )
|
||||
// .useCustomItemModel()
|
||||
// .build();
|
||||
// this.cubeGenerator = registry.block( "debug_cube_gen", BlockCubeGenerator::new )
|
||||
// .features( AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE )
|
||||
// .tileEntity( registry.tileEntity("", TileCubeGenerator.class, TileCubeGenerator::new).build() )
|
||||
// .useCustomItemModel()
|
||||
// .build();
|
||||
// this.energyGenerator = registry.block( "debug_energy_gen", BlockEnergyGenerator::new )
|
||||
// .features( AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE )
|
||||
// .tileEntity( registry.tileEntity("", TileEnergyGenerator.class, TileEnergyGenerator::new).build() )
|
||||
// .useCustomItemModel()
|
||||
// .build();
|
||||
this.itemGen = registry.block( "debug_item_gen", BlockItemGen::new )
|
||||
.features( AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE )
|
||||
.tileEntity( registry.tileEntity("debug_item_gen", TileItemGen.class, TileItemGen::new).build() )
|
||||
.build();
|
||||
this.chunkLoader = registry.block( "debug_chunk_loader", BlockChunkloader::new )
|
||||
.features( AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE )
|
||||
.tileEntity( registry.tileEntity("debug_chunk_loader", TileChunkLoader.class, TileChunkLoader::new).build() )
|
||||
.build();
|
||||
this.phantomNode = registry.block( "debug_phantom_node", BlockPhantomNode::new )
|
||||
.features( AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE )
|
||||
.tileEntity( registry.tileEntity("debug_phantom_node", TilePhantomNode.class, TilePhantomNode::new).build() )
|
||||
.build();
|
||||
this.cubeGenerator = registry.block( "debug_cube_gen", BlockCubeGenerator::new )
|
||||
.features( AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE )
|
||||
.tileEntity( registry.tileEntity("debug_cube_gen", TileCubeGenerator.class, TileCubeGenerator::new).build() )
|
||||
.build();
|
||||
this.energyGenerator = registry.block( "debug_energy_gen", BlockEnergyGenerator::new )
|
||||
.features( AEFeature.UNSUPPORTED_DEVELOPER_TOOLS, AEFeature.CREATIVE )
|
||||
.tileEntity( registry.tileEntity("debug_energy_gen", TileEnergyGenerator.class, TileEnergyGenerator::new).build() )
|
||||
.build();
|
||||
}
|
||||
|
||||
private Block createQuartzOreBlock() {
|
||||
|
||||
@@ -54,6 +54,16 @@ public final class DamagedItemDefinition implements IItemDefinition
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item item() {
|
||||
return source.get().getItem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack stack(int stackSize) {
|
||||
return source.get().stack(stackSize);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String identifier()
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package appeng.core.sync.packets;
|
||||
|
||||
|
||||
import appeng.block.networking.BlockCableBus;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -36,6 +37,7 @@ import appeng.api.implementations.items.MemoryCardMessages;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
||||
|
||||
public class PacketClick extends AppEngPacket
|
||||
@@ -115,10 +117,10 @@ public class PacketClick extends AppEngPacket
|
||||
if( this.leftClick )
|
||||
{
|
||||
final Block block = player.world.getBlockState( pos ).getBlock();
|
||||
// FIXME if( block instanceof BlockCableBus )
|
||||
// FIXME {
|
||||
// FIXME ( (BlockCableBus) block ).onBlockClickPacket( player.world, pos, player, this.hand, new Vec3d( this.hitX, this.hitY, this.hitZ ) );
|
||||
// FIXME }
|
||||
if( block instanceof BlockCableBus)
|
||||
{
|
||||
( (BlockCableBus) block ).onBlockClickPacket( player.world, pos, player, this.hand, new Vec3d( this.hitX, this.hitY, this.hitZ ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -71,6 +71,6 @@ public class PacketCompassResponse extends AppEngPacket
|
||||
@Override
|
||||
public void clientPacketData( final INetworkInfo network, final PlayerEntity player )
|
||||
{
|
||||
CompassManager.INSTANCE.postResult( this.attunement, this.cx << 4, this.cdy << 5, this.cz << 4, this.cr );
|
||||
// TODO CompassManager.INSTANCE.postResult( this.attunement, this.cx << 4, this.cdy << 5, this.cz << 4, this.cr );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,31 +19,15 @@
|
||||
package appeng.debug;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeChunkManager;
|
||||
import net.minecraftforge.common.ForgeChunkManager.LoadingCallback;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.AppEng;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
|
||||
public class BlockChunkloader extends AEBaseTileBlock implements LoadingCallback
|
||||
{
|
||||
public class BlockChunkloader extends AEBaseTileBlock<TileChunkLoader> {
|
||||
|
||||
public BlockChunkloader()
|
||||
{
|
||||
super( Material.IRON );
|
||||
ForgeChunkManager.setForcedChunkLoadingCallback( AppEng.instance(), this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ticketsLoaded( final List<Ticket> tickets, final World world )
|
||||
{
|
||||
|
||||
}
|
||||
public BlockChunkloader() {
|
||||
super(Block.Properties.create(Material.IRON));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ package appeng.debug;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -38,7 +39,7 @@ public class BlockCubeGenerator extends AEBaseTileBlock<TileCubeGenerator>
|
||||
|
||||
public BlockCubeGenerator()
|
||||
{
|
||||
super( Material.IRON );
|
||||
super(Block.Properties.create(Material.IRON) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,17 +19,18 @@
|
||||
package appeng.debug;
|
||||
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
|
||||
|
||||
public class BlockEnergyGenerator extends AEBaseTileBlock
|
||||
public class BlockEnergyGenerator extends AEBaseTileBlock<TileEnergyGenerator>
|
||||
{
|
||||
|
||||
public BlockEnergyGenerator()
|
||||
{
|
||||
super( Material.IRON );
|
||||
super( Block.Properties.create(Material.IRON) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,17 +19,18 @@
|
||||
package appeng.debug;
|
||||
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
|
||||
|
||||
public class BlockItemGen extends AEBaseTileBlock
|
||||
public class BlockItemGen extends AEBaseTileBlock<TileItemGen>
|
||||
{
|
||||
|
||||
public BlockItemGen()
|
||||
{
|
||||
super( Material.IRON );
|
||||
super( Block.Properties.create(Material.IRON) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ package appeng.debug;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -38,7 +39,7 @@ public class BlockPhantomNode extends AEBaseTileBlock<TilePhantomNode>
|
||||
|
||||
public BlockPhantomNode()
|
||||
{
|
||||
super( Material.IRON );
|
||||
super( Block.Properties.create(Material.IRON) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,76 +19,53 @@
|
||||
package appeng.debug;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraftforge.common.ForgeChunkManager;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Type;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
|
||||
|
||||
public class TileChunkLoader extends AEBaseTile implements ITickableTileEntity
|
||||
{
|
||||
public class TileChunkLoader extends AEBaseTile implements ITickableTileEntity {
|
||||
|
||||
private boolean requestTicket = true;
|
||||
private Ticket ct = null;
|
||||
public TileChunkLoader(TileEntityType<?> tileEntityTypeIn) {
|
||||
super(tileEntityTypeIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick()
|
||||
{
|
||||
if( this.requestTicket )
|
||||
{
|
||||
this.requestTicket = false;
|
||||
this.initTicket();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onLoad() {
|
||||
super.onLoad();
|
||||
|
||||
private void initTicket()
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
World world = getWorld();
|
||||
if (world instanceof ServerWorld) {
|
||||
ChunkPos chunkPos = new ChunkPos(getPos());
|
||||
((ServerWorld) world).forceChunk(chunkPos.x, chunkPos.z, true);
|
||||
}
|
||||
}
|
||||
|
||||
this.ct = ForgeChunkManager.requestTicket( AppEng.instance(), this.world, Type.NORMAL );
|
||||
@Override
|
||||
public void remove() {
|
||||
World world = getWorld();
|
||||
if (world instanceof ServerWorld) {
|
||||
ChunkPos chunkPos = new ChunkPos(getPos());
|
||||
((ServerWorld) world).forceChunk(chunkPos.x, chunkPos.z, false);
|
||||
}
|
||||
}
|
||||
|
||||
if( this.ct == null )
|
||||
{
|
||||
final MinecraftServer server = ServerLifecycleHooks.getCurrentServer();
|
||||
if( server != null )
|
||||
{
|
||||
final List<ServerPlayerEntity> pl = server.getPlayerList().getPlayers();
|
||||
for( final ServerPlayerEntity p : pl )
|
||||
{
|
||||
p.sendMessage( new StringTextComponent( "Can't chunk load.." ) );
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
@Override
|
||||
public void tick() {
|
||||
// Validate the force-status
|
||||
World world = getWorld();
|
||||
if (world instanceof ServerWorld) {
|
||||
ChunkPos chunkPos = new ChunkPos(getPos());
|
||||
ServerWorld serverWorld = (ServerWorld) world;
|
||||
|
||||
AELog.info( "New Ticket " + this.ct.toString() );
|
||||
ForgeChunkManager.forceChunk( this.ct, new ChunkPos( this.pos.getX() >> 4, this.pos.getZ() >> 4 ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate()
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AELog.info( "Released Ticket " + this.ct.toString() );
|
||||
ForgeChunkManager.releaseTicket( this.ct );
|
||||
}
|
||||
if (!serverWorld.getForcedChunks().contains(chunkPos.asLong())) {
|
||||
AELog.debug("Force-loading chunk @ %d,%d in %s", chunkPos.x, chunkPos.z, serverWorld.dimension.getType().getRegistryName());
|
||||
serverWorld.forceChunk(chunkPos.x, chunkPos.z, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,18 +19,19 @@
|
||||
package appeng.debug;
|
||||
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.DirectionalPlaceContext;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
|
||||
|
||||
public class TileCubeGenerator extends AEBaseTile implements ITickableTileEntity
|
||||
@@ -41,6 +42,10 @@ public class TileCubeGenerator extends AEBaseTile implements ITickableTileEntity
|
||||
private int countdown = 20 * 10;
|
||||
private PlayerEntity who = null;
|
||||
|
||||
public TileCubeGenerator(TileEntityType<?> tileEntityTypeIn) {
|
||||
super(tileEntityTypeIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick()
|
||||
{
|
||||
@@ -79,7 +84,10 @@ public class TileCubeGenerator extends AEBaseTile implements ITickableTileEntity
|
||||
for( int z = -half; z < half; z++ )
|
||||
{
|
||||
final BlockPos p = this.pos.add( x, y - 1, z );
|
||||
i.onItemUse( this.who, this.world, p, Hand.MAIN_HAND, side, 0.5f, 0.0f, 0.5f );
|
||||
ItemUseContext useContext = new DirectionalPlaceContext(
|
||||
this.world, p, side, this.is, side.getOpposite()
|
||||
);
|
||||
i.onItemUse(useContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,10 @@ import com.google.common.math.IntMath;
|
||||
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.energy.CapabilityEnergy;
|
||||
@@ -44,40 +47,41 @@ public class TileEnergyGenerator extends AEBaseTile implements ITickableTileEnti
|
||||
*/
|
||||
private static final int BASE_ENERGY = 8;
|
||||
|
||||
public TileEnergyGenerator(TileEntityType<?> tileEntityTypeIn) {
|
||||
super(tileEntityTypeIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick()
|
||||
{
|
||||
int tier = 1;
|
||||
final EnumSet<Direction> validEnergyReceivers = EnumSet.noneOf( Direction.class );
|
||||
World world = this.getWorld();
|
||||
if (world == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
int tier = 1;
|
||||
for( Direction facing : Direction.values() )
|
||||
{
|
||||
final TileEntity te = this.getWorld().getTileEntity( this.getPos().offset( facing ) );
|
||||
final TileEntity te = world.getTileEntity( this.getPos().offset( facing ) );
|
||||
|
||||
if( te instanceof TileEnergyGenerator )
|
||||
{
|
||||
tier++;
|
||||
}
|
||||
|
||||
if( te != null && te.hasCapability( CapabilityEnergy.ENERGY, facing.getOpposite() ) )
|
||||
{
|
||||
validEnergyReceivers.add( facing );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
final int energyToInsert = IntMath.pow( BASE_ENERGY, tier );
|
||||
|
||||
for( Direction facing : validEnergyReceivers )
|
||||
for( Direction facing : Direction.values() )
|
||||
{
|
||||
final TileEntity te = this.getWorld().getTileEntity( this.getPos().offset( facing ) );
|
||||
final IEnergyStorage cap = te.getCapability( CapabilityEnergy.ENERGY, facing.getOpposite() );
|
||||
final LazyOptional<IEnergyStorage> cap = te.getCapability( CapabilityEnergy.ENERGY, facing.getOpposite() );
|
||||
|
||||
if( cap.canReceive() )
|
||||
{
|
||||
|
||||
cap.receiveEnergy( energyToInsert, false );
|
||||
}
|
||||
cap.ifPresent(consumer -> {
|
||||
if (consumer.canReceive()) {
|
||||
consumer.receiveEnergy( energyToInsert, false );
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,14 +28,17 @@ import javax.annotation.Nullable;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.tile.AEBaseTile;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
|
||||
public class TileItemGen extends AEBaseTile
|
||||
@@ -45,26 +48,32 @@ public class TileItemGen extends AEBaseTile
|
||||
|
||||
private final IItemHandler handler = new QueuedItemHandler();
|
||||
|
||||
public TileItemGen()
|
||||
{
|
||||
public TileItemGen(TileEntityType<?> tileEntityTypeIn) {
|
||||
super(tileEntityTypeIn);
|
||||
if( POSSIBLE_ITEMS.isEmpty() )
|
||||
{
|
||||
for( final Object obj : Item.REGISTRY )
|
||||
for( final Item mi : ForgeRegistries.ITEMS)
|
||||
{
|
||||
final Item mi = (Item) obj;
|
||||
if( mi != null && mi != Items.AIR )
|
||||
{
|
||||
if( mi.isDamageable() )
|
||||
{
|
||||
// FIXME: Rethink if this branch is necessary
|
||||
for( int dmg = 0; dmg < mi.getMaxDamage(); dmg++ )
|
||||
{
|
||||
POSSIBLE_ITEMS.add( new ItemStack( mi, 1, dmg ) );
|
||||
ItemStack item = new ItemStack(mi, 1);
|
||||
item.setDamage(dmg);
|
||||
POSSIBLE_ITEMS.add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mi.getGroup() == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
final NonNullList<ItemStack> list = NonNullList.create();
|
||||
mi.getSubItems( mi.getCreativeTab(), list );
|
||||
mi.fillItemGroup( mi.getGroup(), list );
|
||||
POSSIBLE_ITEMS.addAll( list );
|
||||
}
|
||||
}
|
||||
@@ -101,6 +110,11 @@ public class TileItemGen extends AEBaseTile
|
||||
return POSSIBLE_ITEMS.peek() != null ? POSSIBLE_ITEMS.peek().copy() : ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(int slot, @Nonnull ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlots()
|
||||
{
|
||||
|
||||
@@ -21,6 +21,7 @@ package appeng.debug;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Direction;
|
||||
|
||||
import appeng.api.networking.IGridNode;
|
||||
@@ -35,6 +36,10 @@ public class TilePhantomNode extends AENetworkTile
|
||||
private AENetworkProxy proxy = null;
|
||||
private boolean crashMode = false;
|
||||
|
||||
public TilePhantomNode(TileEntityType<?> tileEntityTypeIn) {
|
||||
super(tileEntityTypeIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridNode getGridNode( final AEPartLocation dir )
|
||||
{
|
||||
|
||||
@@ -19,19 +19,6 @@
|
||||
package appeng.debug;
|
||||
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
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.text.StringTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.networking.IGridConnection;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
@@ -51,18 +38,44 @@ import appeng.me.cache.TickManagerCache;
|
||||
import appeng.parts.p2p.PartP2PTunnel;
|
||||
import appeng.tile.networking.TileController;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
public class ToolDebugCard extends AEBaseItem
|
||||
{
|
||||
|
||||
public ToolDebugCard(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onItemUseFirst( final PlayerEntity player, final World world, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final Hand hand )
|
||||
{
|
||||
public ActionResultType onItemUseFirst(ItemStack stack, ItemUseContext context) {
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
PlayerEntity player = context.getPlayer();
|
||||
World world = context.getWorld();
|
||||
BlockPos pos = context.getPos();
|
||||
Direction side = context.getFace();
|
||||
|
||||
if (player == null) {
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
if( player.isCrouching() )
|
||||
{
|
||||
int grids = 0;
|
||||
@@ -133,7 +146,7 @@ public class ToolDebugCard extends AEBaseItem
|
||||
|
||||
if( center.getMachine() instanceof PartP2PTunnel )
|
||||
{
|
||||
this.outputMsg( player, "Freq: " + ( (PartP2PTunnel) center.getMachine() ).getFrequency() );
|
||||
this.outputMsg( player, "Freq: " + ( (PartP2PTunnel<?>) center.getMachine() ).getFrequency() );
|
||||
}
|
||||
|
||||
final TickManagerCache tmc = g.getCache( ITickManager.class );
|
||||
@@ -205,7 +218,7 @@ public class ToolDebugCard extends AEBaseItem
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
private void outputMsg( final ICommandSender player, final String string )
|
||||
private void outputMsg(final Entity player, final String string )
|
||||
{
|
||||
player.sendMessage( new StringTextComponent( string ) );
|
||||
}
|
||||
|
||||
@@ -19,20 +19,19 @@
|
||||
package appeng.debug;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.core.AELog;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class ToolEraser extends AEBaseItem
|
||||
@@ -40,14 +39,25 @@ public class ToolEraser extends AEBaseItem
|
||||
|
||||
private static final int BLOCK_ERASE_LIMIT = 90000;
|
||||
|
||||
public ToolEraser(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onItemUseFirst( final PlayerEntity player, final World world, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final Hand hand )
|
||||
{
|
||||
public ActionResultType onItemUseFirst(ItemStack stack, ItemUseContext context) {
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
PlayerEntity player = context.getPlayer();
|
||||
World world = context.getWorld();
|
||||
BlockPos pos = context.getPos();
|
||||
|
||||
if (player == null) {
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
final BlockState state = world.getBlockState( pos );
|
||||
|
||||
List<BlockPos> next = new ArrayList<>();
|
||||
|
||||
@@ -20,37 +20,47 @@ package appeng.debug;
|
||||
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
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.text.StringTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.util.Platform;
|
||||
import appeng.worldgen.MeteoritePlacer;
|
||||
import appeng.worldgen.meteorite.StandardWorld;
|
||||
|
||||
|
||||
public class ToolMeteoritePlacer extends AEBaseItem
|
||||
{
|
||||
|
||||
public ToolMeteoritePlacer(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onItemUseFirst( final PlayerEntity player, final World world, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final Hand hand )
|
||||
{
|
||||
public ActionResultType onItemUseFirst(ItemStack stack, ItemUseContext context) {
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
final MeteoritePlacer mp = new MeteoritePlacer();
|
||||
final boolean worked = mp.spawnMeteorite( new StandardWorld( world ), pos.getX(), pos.getY(), pos.getZ() );
|
||||
PlayerEntity player = context.getPlayer();
|
||||
World world = context.getWorld();
|
||||
BlockPos pos = context.getPos();
|
||||
|
||||
if( !worked )
|
||||
{
|
||||
player.sendMessage( new StringTextComponent( "Un-suitable Location." ) );
|
||||
if (player == null) {
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
//FIXME final MeteoritePlacer mp = new MeteoritePlacer();
|
||||
//FIXME final boolean worked = mp.spawnMeteorite( new StandardWorld( world ), pos.getX(), pos.getY(), pos.getZ() );
|
||||
//FIXME
|
||||
//FIXME if( !worked )
|
||||
//FIXME {
|
||||
//FIXME player.sendMessage( new StringTextComponent( "Un-suitable Location." ) );
|
||||
//FIXME }
|
||||
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,20 +19,6 @@
|
||||
package appeng.debug;
|
||||
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
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.text.StringTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
@@ -41,18 +27,47 @@ import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
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.text.StringTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
|
||||
|
||||
public class ToolReplicatorCard extends AEBaseItem
|
||||
{
|
||||
|
||||
public ToolReplicatorCard(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onItemUseFirst( final PlayerEntity player, final World world, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final Hand hand )
|
||||
{
|
||||
public ActionResultType onItemUseFirst(ItemStack stack, ItemUseContext context) {
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
PlayerEntity player = context.getPlayer();
|
||||
World world = context.getWorld();
|
||||
BlockPos pos = context.getPos();
|
||||
Direction side = context.getFace();
|
||||
Hand hand = context.getHand();
|
||||
|
||||
if (player == null) {
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
int x = pos.getX();
|
||||
int y = pos.getY();
|
||||
int z = pos.getZ();
|
||||
@@ -66,8 +81,8 @@ public class ToolReplicatorCard extends AEBaseItem
|
||||
tag.putInt( "y", y );
|
||||
tag.putInt( "z", z );
|
||||
tag.putInt( "side", side.ordinal() );
|
||||
tag.putInt( "dimid", world.provider.getDimension() );
|
||||
player.getHeldItem( hand ).setTagCompound( tag );
|
||||
tag.putInt( "dimid", world.getDimension().getType().getId() );
|
||||
player.getHeldItem( hand ).setTag( tag );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -84,7 +99,7 @@ public class ToolReplicatorCard extends AEBaseItem
|
||||
final int src_z = ish.getInt( "z" );
|
||||
final int src_side = ish.getInt( "side" );
|
||||
final int dimid = ish.getInt( "dimid" );
|
||||
final World src_w = DimensionManager.getWorld( dimid );
|
||||
final World src_w = world.getServer().getWorld(DimensionType.getById(dimid));
|
||||
|
||||
final TileEntity te = src_w.getTileEntity( new BlockPos( src_x, src_y, src_z ) );
|
||||
if( te instanceof IGridHost )
|
||||
@@ -136,10 +151,10 @@ public class ToolReplicatorCard extends AEBaseItem
|
||||
if( blk != null && blk.hasTileEntity( state ) )
|
||||
{
|
||||
final TileEntity ote = src_w.getTileEntity( p );
|
||||
final TileEntity nte = blk.createTileEntity( world, state );
|
||||
final TileEntity nte = blk.createTileEntity( state, world );
|
||||
final CompoundNBT data = new CompoundNBT();
|
||||
ote.writeToNBT( data );
|
||||
nte.readFromNBT( data.copy() );
|
||||
ote.write( data );
|
||||
nte.read( data.copy() );
|
||||
world.setTileEntity( d, nte );
|
||||
}
|
||||
world.notifyBlockUpdate( d, prev, state, 3 );
|
||||
@@ -175,7 +190,7 @@ public class ToolReplicatorCard extends AEBaseItem
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
private void outputMsg( final ICommandSender player, final String string )
|
||||
private void outputMsg(final Entity player, final String string )
|
||||
{
|
||||
player.sendMessage( new StringTextComponent( string ) );
|
||||
}
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* 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.helpers;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
|
||||
public interface ICustomCollision
|
||||
{
|
||||
Iterable<VoxelShape> getSelectedBoundingBoxesFromPool(IBlockReader w, BlockPos pos, Entity thePlayer, boolean b );
|
||||
|
||||
void addCollidingBlockToList( World w, BlockPos pos, AxisAlignedBB bb, List<AxisAlignedBB> out, Entity e );
|
||||
}
|
||||
@@ -28,6 +28,7 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import appeng.fluids.parts.*;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
@@ -186,20 +187,20 @@ public enum PartType
|
||||
DARK_MONITOR( 200, "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 ),
|
||||
// FIXME FLUID_STORAGE_BUS( 221, "fluid_storage_bus", EnumSet.of( AEFeature.FLUID_STORAGE_BUS ), EnumSet
|
||||
// FIXME .noneOf( IntegrationType.class ), PartFluidStorageBus.class ),
|
||||
FLUID_STORAGE_BUS( 221, "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 ),
|
||||
|
||||
// FIXME FLUID_IMPORT_BUS( 241, "fluid_import_bus", EnumSet.of( AEFeature.FLUID_IMPORT_BUS ), EnumSet.noneOf( IntegrationType.class ), PartFluidImportBus.class ),
|
||||
FLUID_IMPORT_BUS( 241, "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 ),
|
||||
|
||||
// FIXME FLUID_EXPORT_BUS( 261, "fluid_export_bus", EnumSet.of( AEFeature.FLUID_EXPORT_BUS ), EnumSet.noneOf( IntegrationType.class ), PartFluidExportBus.class ),
|
||||
FLUID_EXPORT_BUS( 261, "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 ),
|
||||
// FIXME FLUID_LEVEL_EMITTER( 281, "fluid_level_emitter", EnumSet.of( AEFeature.FLUID_LEVEL_EMITTER ), EnumSet
|
||||
// FIXME .noneOf( IntegrationType.class ), PartFluidLevelEmitter.class ),
|
||||
FLUID_LEVEL_EMITTER( 281, "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
|
||||
.noneOf( IntegrationType.class ), PartAnnihilationPlane.class ),
|
||||
@@ -207,13 +208,13 @@ public enum PartType
|
||||
IDENTITY_ANNIHILATION_PLANE( 301, "identity_annihilation_plane", EnumSet.of( AEFeature.ANNIHILATION_PLANE, AEFeature.IDENTITY_ANNIHILATION_PLANE ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartIdentityAnnihilationPlane.class ),
|
||||
|
||||
// FIXME FLUID_ANNIHILATION_PLANE( 302, "fluid_annihilation_plane", EnumSet.of( AEFeature.FLUID_ANNIHILATION_PLANE ), EnumSet
|
||||
// FIXME .noneOf( IntegrationType.class ), PartFluidAnnihilationPlane.class ),
|
||||
FLUID_ANNIHILATION_PLANE( 302, "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 ),
|
||||
|
||||
// FIXME FLUID_FORMATION_PLANE( 321, "fluid_formation_plane", EnumSet.of( AEFeature.FLUID_FORMATION_PLANE ), EnumSet
|
||||
// FIXME .noneOf( IntegrationType.class ), PartFluidFormationPlane.class ),
|
||||
FLUID_FORMATION_PLANE( 321, "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 ),
|
||||
|
||||
@@ -228,7 +229,7 @@ public enum PartType
|
||||
.noneOf( IntegrationType.class ), PartConversionMonitor.class ),
|
||||
|
||||
INTERFACE( 440, "interface", EnumSet.of( AEFeature.INTERFACE ), EnumSet.noneOf( IntegrationType.class ), PartInterface.class ),
|
||||
// FIXME FLUID_INTERFACE( 441, "fluid_interface", EnumSet.of( AEFeature.FLUID_INTERFACE ), EnumSet.noneOf( IntegrationType.class ), PartFluidInterface.class ),
|
||||
FLUID_INTERFACE( 441, "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
|
||||
.noneOf( IntegrationType.class ), PartP2PTunnelME.class, GuiText.METunnel )
|
||||
@@ -304,9 +305,9 @@ public enum PartType
|
||||
// IntegrationType.OpenComputers ), PartP2POpenComputers.class, GuiText.OCTunnel ),
|
||||
|
||||
INTERFACE_TERMINAL( 480, "interface_terminal", EnumSet.of( AEFeature.INTERFACE_TERMINAL ), EnumSet
|
||||
.noneOf( IntegrationType.class ), PartInterfaceTerminal.class );
|
||||
.noneOf( IntegrationType.class ), PartInterfaceTerminal.class ),
|
||||
|
||||
// FIXME FLUID_TERMINAL( 520, "fluid_terminal", EnumSet.of( AEFeature.FLUID_TERMINAL ), EnumSet.noneOf( IntegrationType.class ), PartFluidTerminal.class );
|
||||
FLUID_TERMINAL( 520, "fluid_terminal", EnumSet.of( AEFeature.FLUID_TERMINAL ), EnumSet.noneOf( IntegrationType.class ), PartFluidTerminal.class );
|
||||
|
||||
private final int baseDamage;
|
||||
private final Set<AEFeature> features;
|
||||
|
||||
@@ -27,6 +27,7 @@ import java.util.Map.Entry;
|
||||
import java.util.NavigableMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
|
||||
import net.minecraftforge.fluids.FluidAttributes;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
|
||||
@@ -131,19 +132,28 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack>, ITicki
|
||||
int high = 0;
|
||||
boolean changed = false;
|
||||
|
||||
final IFluidTankProperties[] props = this.handler.getTankProperties();
|
||||
for( int slot = 0; slot < this.handler.getTankProperties().length; ++slot )
|
||||
int tankCount = this.handler.getTanks();
|
||||
for( int tank = 0; tank < tankCount; ++tank )
|
||||
{
|
||||
final CachedFluidStack old = this.memory.get( slot );
|
||||
high = Math.max( high, slot );
|
||||
final CachedFluidStack old = this.memory.get( tank );
|
||||
high = Math.max( high, tank );
|
||||
|
||||
final FluidStack newIS = !props[slot].canDrain() && this.getMode() == StorageFilter.EXTRACTABLE_ONLY ? null : props[slot].getContents();
|
||||
final FluidStack oldIS = old == null ? null : old.fluidStack;
|
||||
FluidStack newIS = this.handler.getFluidInTank(tank);
|
||||
if (!newIS.isEmpty() && this.getMode() == StorageFilter.EXTRACTABLE_ONLY) {
|
||||
// We have to actually check if we could extract _anything_
|
||||
if (this.handler.drain(1, IFluidHandler.FluidAction.SIMULATE).isEmpty()) {
|
||||
// Just to safeguard against tanks that prevent non-bucket-size extractions
|
||||
if (this.handler.drain(FluidAttributes.BUCKET_VOLUME, IFluidHandler.FluidAction.SIMULATE).isEmpty()) {
|
||||
newIS = FluidStack.EMPTY;
|
||||
}
|
||||
}
|
||||
}
|
||||
final FluidStack oldIS = old == null ? FluidStack.EMPTY : old.fluidStack;
|
||||
|
||||
if( isDifferent( newIS, oldIS ) )
|
||||
{
|
||||
final CachedFluidStack cis = new CachedFluidStack( newIS );
|
||||
this.memory.put( slot, cis );
|
||||
this.memory.put( tank, cis );
|
||||
|
||||
if( old != null && old.aeStack != null )
|
||||
{
|
||||
@@ -161,12 +171,12 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack>, ITicki
|
||||
}
|
||||
else
|
||||
{
|
||||
final int newSize = newIS == null ? 0 : newIS.getAmount();
|
||||
final int diff = newSize - ( oldIS == null ? 0 : oldIS.getAmount() );
|
||||
final int newSize = newIS.isEmpty() ? 0 : newIS.getAmount();
|
||||
final int diff = newSize - ( oldIS.isEmpty() ? 0 : oldIS.getAmount() );
|
||||
|
||||
IAEFluidStack stack = null;
|
||||
|
||||
if( newIS != null )
|
||||
if( !newIS.isEmpty() )
|
||||
{
|
||||
stack = ( old == null || old.aeStack == null ? Api.INSTANCE
|
||||
.storage()
|
||||
@@ -182,7 +192,7 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack>, ITicki
|
||||
if( diff != 0 && stack != null )
|
||||
{
|
||||
final CachedFluidStack cis = new CachedFluidStack( newIS );
|
||||
this.memory.put( slot, cis );
|
||||
this.memory.put( tank, cis );
|
||||
|
||||
final IAEFluidStack a = stack.copy();
|
||||
a.setStackSize( diff );
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import appeng.core.Api;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
|
||||
@@ -26,6 +26,7 @@ import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import appeng.block.paint.PaintSplotches;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
@@ -42,11 +43,18 @@ import appeng.api.util.AEColor;
|
||||
import appeng.helpers.Splotch;
|
||||
import appeng.items.misc.ItemPaintBall;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
import net.minecraftforge.client.model.data.ModelDataMap;
|
||||
import net.minecraftforge.client.model.data.ModelProperty;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
public class TilePaint extends AEBaseTile
|
||||
{
|
||||
|
||||
public static final ModelProperty<PaintSplotches> SPLOTCHES = new ModelProperty<>();
|
||||
|
||||
private static final int LIGHT_PER_DOT = 12;
|
||||
|
||||
private int isLit = 0;
|
||||
@@ -283,4 +291,13 @@ public class TilePaint extends AEBaseTile
|
||||
|
||||
return this.dots;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IModelData getModelData() {
|
||||
// FIXME update trigger
|
||||
return new ModelDataMap.Builder()
|
||||
.withInitial(SPLOTCHES, new PaintSplotches(getDots()))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.block.networking.BlockCableBus;
|
||||
import appeng.client.render.cablebus.CableBusRenderState;
|
||||
import appeng.helpers.AEMultiTile;
|
||||
import appeng.hooks.TickHandler;
|
||||
import appeng.parts.CableBusContainer;
|
||||
@@ -44,6 +45,10 @@ import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.model.data.EmptyModelData;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
import net.minecraftforge.client.model.data.ModelDataMap;
|
||||
import net.minecraftforge.client.model.data.ModelProperty;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
|
||||
@@ -57,6 +62,8 @@ 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
|
||||
@@ -382,4 +389,20 @@ public class TileCableBus extends AEBaseTile implements AEMultiTile
|
||||
return super.getCapability( capabilityClass, fromSide );
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IModelData getModelData() {
|
||||
World world = getWorld();
|
||||
if (world == null) {
|
||||
return EmptyModelData.INSTANCE;
|
||||
}
|
||||
|
||||
CableBusRenderState renderState = this.cb.getRenderState();
|
||||
renderState.setWorld(world);
|
||||
renderState.setPos(pos);
|
||||
return new ModelDataMap.Builder()
|
||||
.withInitial(RENDER_STATE_PROPERTY, renderState)
|
||||
.build();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.io.IOException;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Optional;
|
||||
|
||||
import appeng.block.qnb.QnbFormedState;
|
||||
import appeng.core.Api;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -32,6 +33,9 @@ import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
import net.minecraftforge.client.model.data.ModelDataMap;
|
||||
import net.minecraftforge.client.model.data.ModelProperty;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.wrapper.EmptyHandler;
|
||||
|
||||
@@ -52,9 +56,14 @@ import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.inv.InvOperation;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock, ITickableTileEntity
|
||||
{
|
||||
|
||||
public static final ModelProperty<QnbFormedState> FORMED_STATE = new ModelProperty<>();
|
||||
|
||||
private final byte corner = 16;
|
||||
private final AppEngInternalInventory internalInventory = new AppEngInternalInventory( this, 1, 1 );
|
||||
private final byte hasSingularity = 32;
|
||||
@@ -348,4 +357,16 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
|
||||
{
|
||||
return this.corner;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IModelData getModelData() {
|
||||
// FIXME must trigger model data updates
|
||||
|
||||
return new ModelDataMap.Builder()
|
||||
.withInitial(FORMED_STATE, new QnbFormedState( getAdjacentQuantumBridges(), isCorner(), isPowered() ))
|
||||
.build();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -37,11 +37,21 @@ import appeng.me.cluster.implementations.SpatialPylonCluster;
|
||||
import appeng.me.helpers.AENetworkProxy;
|
||||
import appeng.me.helpers.AENetworkProxyMultiblock;
|
||||
import appeng.tile.grid.AENetworkTile;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
import net.minecraftforge.client.model.data.ModelDataMap;
|
||||
import net.minecraftforge.client.model.data.ModelProperty;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
|
||||
{
|
||||
|
||||
public static final ModelProperty<Integer> STATE = new ModelProperty<>(value -> {
|
||||
// The lower 6 bits are used
|
||||
return ( value & ~0x3F ) == 0;
|
||||
});
|
||||
|
||||
public static final int DISPLAY_END_MIN = 0x01;
|
||||
public static final int DISPLAY_END_MAX = 0x02;
|
||||
public static final int DISPLAY_MIDDLE = 0x01 + 0x02;
|
||||
@@ -247,4 +257,14 @@ public class TileSpatialPylon extends AENetworkTile implements IAEMultiBlock
|
||||
{
|
||||
return this.displayBits;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IModelData getModelData() {
|
||||
// FIXME: Must force model data update on changes, should potentially be moved to block state (?)
|
||||
return new ModelDataMap.Builder()
|
||||
.withInitial(STATE, getDisplayBits())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,11 +27,16 @@ import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.block.storage.DriveSlotsState;
|
||||
import appeng.core.Api;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
import net.minecraftforge.client.model.data.ModelDataMap;
|
||||
import net.minecraftforge.client.model.data.ModelProperty;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.implementations.tiles.IChestOrDrive;
|
||||
@@ -63,10 +68,14 @@ import appeng.util.Platform;
|
||||
import appeng.util.inv.InvOperation;
|
||||
import appeng.util.inv.filter.IAEItemFilter;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
|
||||
public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPriorityHost
|
||||
{
|
||||
|
||||
public static final ModelProperty<DriveSlotsState> SLOTS_STATE = new ModelProperty<>();
|
||||
|
||||
private static final int BIT_POWER_MASK = 0x80000000;
|
||||
private static final int BIT_BLINK_MASK = 0x24924924;
|
||||
private static final int BIT_STATE_MASK = 0xDB6DB6DB;
|
||||
@@ -405,7 +414,19 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
|
||||
return Api.INSTANCE.definitions().blocks().drive().maybeStack( 1 ).orElse( ItemStack.EMPTY );
|
||||
}
|
||||
|
||||
// FIXME @Override
|
||||
@Nonnull
|
||||
@Override
|
||||
public IModelData getModelData() {
|
||||
|
||||
return new ModelDataMap.Builder()
|
||||
.withInitial(AEBaseTileBlock.UP, getUp())
|
||||
.withInitial(AEBaseTileBlock.FORWARD, getForward())
|
||||
.withInitial(SLOTS_STATE, DriveSlotsState.fromChestOrDrive( this ))
|
||||
.build();
|
||||
|
||||
}
|
||||
|
||||
// FIXME @Override
|
||||
// FIXME public GuiBridge getGuiBridge()
|
||||
// FIXME {
|
||||
// FIXME return GuiBridge.GUI_DRIVE;
|
||||
|
||||
@@ -33,7 +33,7 @@ public class ItemSorters
|
||||
|
||||
public static final Comparator<IAEItemStack> CONFIG_BASED_SORT_BY_NAME = ( o1, o2 ) ->
|
||||
{
|
||||
final int cmp = Platform.getItemDisplayName( o1 ).compareToIgnoreCase( Platform.getItemDisplayName( o2 ) );
|
||||
final int cmp = Platform.getItemDisplayName( o1 ).getString().compareToIgnoreCase( Platform.getItemDisplayName( o2 ).getString() );
|
||||
return applyDirection( cmp );
|
||||
};
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ItemSorters
|
||||
|
||||
if( cmp == 0 )
|
||||
{
|
||||
cmp = Platform.getItemDisplayName( o1 ).compareToIgnoreCase( Platform.getItemDisplayName( o2 ) );
|
||||
cmp = Platform.getItemDisplayName( o1 ).getString().compareToIgnoreCase( Platform.getItemDisplayName( o2 ).getString() );
|
||||
}
|
||||
|
||||
return applyDirection( cmp );
|
||||
|
||||
@@ -58,6 +58,7 @@ import appeng.util.helpers.P2PHelper;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import appeng.util.prioritylist.IPartitionList;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Iterables;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
@@ -89,6 +90,7 @@ import net.minecraftforge.fml.common.thread.SidedThreadGroups;
|
||||
import net.minecraftforge.fml.loading.FMLEnvironment;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -169,62 +171,62 @@ public class Platform
|
||||
// final DecimalFormat df = new DecimalFormat( "#.##" );
|
||||
// return df.format( p ) + ' ' + level + unitName + ( isRate ? "/t" : "" );
|
||||
// }
|
||||
//
|
||||
// public static AEPartLocation crossProduct( final AEPartLocation forward, final AEPartLocation up )
|
||||
// {
|
||||
// final int west_x = forward.yOffset * up.zOffset - forward.zOffset * up.yOffset;
|
||||
// final int west_y = forward.zOffset * up.xOffset - forward.xOffset * up.zOffset;
|
||||
// final int west_z = forward.xOffset * up.yOffset - forward.yOffset * up.xOffset;
|
||||
//
|
||||
// switch( west_x + west_y * 2 + west_z * 3 )
|
||||
// {
|
||||
// case 1:
|
||||
// return AEPartLocation.EAST;
|
||||
// case -1:
|
||||
// return AEPartLocation.WEST;
|
||||
//
|
||||
// case 2:
|
||||
// return AEPartLocation.UP;
|
||||
// case -2:
|
||||
// return AEPartLocation.DOWN;
|
||||
//
|
||||
// case 3:
|
||||
// return AEPartLocation.SOUTH;
|
||||
// case -3:
|
||||
// return AEPartLocation.NORTH;
|
||||
// }
|
||||
//
|
||||
// return AEPartLocation.INTERNAL;
|
||||
// }
|
||||
//
|
||||
// public static Direction crossProduct(final Direction forward, final Direction up )
|
||||
// {
|
||||
// final int west_x = forward.getYOffset() * up.getZOffset() - forward.getZOffset() * up.getYOffset();
|
||||
// final int west_y = forward.getZOffset() * up.getXOffset() - forward.getXOffset() * up.getZOffset();
|
||||
// final int west_z = forward.getXOffset() * up.getYOffset() - forward.getYOffset() * up.getXOffset();
|
||||
//
|
||||
// switch( west_x + west_y * 2 + west_z * 3 )
|
||||
// {
|
||||
// case 1:
|
||||
// return Direction.EAST;
|
||||
// case -1:
|
||||
// return Direction.WEST;
|
||||
//
|
||||
// case 2:
|
||||
// return Direction.UP;
|
||||
// case -2:
|
||||
// return Direction.DOWN;
|
||||
//
|
||||
// case 3:
|
||||
// return Direction.SOUTH;
|
||||
// case -3:
|
||||
// return Direction.NORTH;
|
||||
// }
|
||||
//
|
||||
// // something is better then nothing?
|
||||
// return Direction.NORTH;
|
||||
// }
|
||||
//
|
||||
|
||||
public static AEPartLocation crossProduct( final AEPartLocation forward, final AEPartLocation up )
|
||||
{
|
||||
final int west_x = forward.yOffset * up.zOffset - forward.zOffset * up.yOffset;
|
||||
final int west_y = forward.zOffset * up.xOffset - forward.xOffset * up.zOffset;
|
||||
final int west_z = forward.xOffset * up.yOffset - forward.yOffset * up.xOffset;
|
||||
|
||||
switch( west_x + west_y * 2 + west_z * 3 )
|
||||
{
|
||||
case 1:
|
||||
return AEPartLocation.EAST;
|
||||
case -1:
|
||||
return AEPartLocation.WEST;
|
||||
|
||||
case 2:
|
||||
return AEPartLocation.UP;
|
||||
case -2:
|
||||
return AEPartLocation.DOWN;
|
||||
|
||||
case 3:
|
||||
return AEPartLocation.SOUTH;
|
||||
case -3:
|
||||
return AEPartLocation.NORTH;
|
||||
}
|
||||
|
||||
return AEPartLocation.INTERNAL;
|
||||
}
|
||||
|
||||
public static Direction crossProduct(final Direction forward, final Direction up )
|
||||
{
|
||||
final int west_x = forward.getYOffset() * up.getZOffset() - forward.getZOffset() * up.getYOffset();
|
||||
final int west_y = forward.getZOffset() * up.getXOffset() - forward.getXOffset() * up.getZOffset();
|
||||
final int west_z = forward.getXOffset() * up.getYOffset() - forward.getYOffset() * up.getXOffset();
|
||||
|
||||
switch( west_x + west_y * 2 + west_z * 3 )
|
||||
{
|
||||
case 1:
|
||||
return Direction.EAST;
|
||||
case -1:
|
||||
return Direction.WEST;
|
||||
|
||||
case 2:
|
||||
return Direction.UP;
|
||||
case -2:
|
||||
return Direction.DOWN;
|
||||
|
||||
case 3:
|
||||
return Direction.SOUTH;
|
||||
case -3:
|
||||
return Direction.NORTH;
|
||||
}
|
||||
|
||||
// something is better then nothing?
|
||||
return Direction.NORTH;
|
||||
}
|
||||
|
||||
public static <T extends Enum> T rotateEnum( T ce, final boolean backwards, final EnumSet validOptions )
|
||||
{
|
||||
do
|
||||
@@ -725,23 +727,23 @@ public class Platform
|
||||
// }
|
||||
// return -1;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Returns a random element from the given collection.
|
||||
// *
|
||||
// * @return null if the collection is empty
|
||||
// */
|
||||
// @Nullable
|
||||
// public static <T> T pickRandom( final Collection<T> outs )
|
||||
// {
|
||||
// if( outs.isEmpty() )
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// int index = RANDOM_GENERATOR.nextInt( outs.size() );
|
||||
// return Iterables.get( outs, index, null );
|
||||
// }
|
||||
|
||||
/**
|
||||
* Returns a random element from the given collection.
|
||||
*
|
||||
* @return null if the collection is empty
|
||||
*/
|
||||
@Nullable
|
||||
public static <T> T pickRandom( final Collection<T> outs )
|
||||
{
|
||||
if( outs.isEmpty() )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
int index = RANDOM_GENERATOR.nextInt( outs.size() );
|
||||
return Iterables.get( outs, index, null );
|
||||
}
|
||||
|
||||
public static AEPartLocation rotateAround( final AEPartLocation forward, final AEPartLocation axis )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user