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() );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user