Fixes #2432: New model for wireless access point which includes status indicators, correct model rotation, and lit/unlit torch variants.
This commit is contained in:
@@ -21,9 +21,10 @@ package appeng.block.networking;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -31,8 +32,10 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
@@ -46,6 +49,22 @@ import appeng.util.Platform;
|
||||
public class BlockWireless extends AEBaseTileBlock implements ICustomCollision
|
||||
{
|
||||
|
||||
enum State implements IStringSerializable
|
||||
{
|
||||
OFF,
|
||||
ON,
|
||||
HAS_CHANNEL;
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return name().toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static final PropertyEnum<State> STATE = PropertyEnum.create( "state", State.class );
|
||||
|
||||
public BlockWireless()
|
||||
{
|
||||
super( AEGlassMaterial.INSTANCE );
|
||||
@@ -53,6 +72,7 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision
|
||||
this.setLightOpacity( 0 );
|
||||
this.setFullSize( false );
|
||||
this.setOpaque( false );
|
||||
this.setDefaultState( getDefaultState().withProperty( STATE, State.OFF ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -61,6 +81,34 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getActualState( IBlockState state, IBlockAccess worldIn, BlockPos pos )
|
||||
{
|
||||
State teState = State.OFF;
|
||||
|
||||
TileWireless te = getTileEntity( worldIn, pos );
|
||||
if( te != null )
|
||||
{
|
||||
if( te.isActive() )
|
||||
{
|
||||
teState = State.HAS_CHANNEL;
|
||||
}
|
||||
else if( te.isPowered() )
|
||||
{
|
||||
teState = State.ON;
|
||||
}
|
||||
}
|
||||
|
||||
return super.getActualState( state, worldIn, pos )
|
||||
.withProperty( STATE, teState );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IProperty[] getAEStates()
|
||||
{
|
||||
return new IProperty[] { STATE };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated( final World w, final BlockPos pos, final IBlockState state, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
||||
{
|
||||
@@ -207,4 +255,11 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision
|
||||
out.add( new AxisAlignedBB( 0.0, 0.0, 0.0, 1.0, 1.0, 1.0 ) );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFullCube( IBlockState state )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package appeng.block.networking;
|
||||
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.bootstrap.BlockRenderingCustomizer;
|
||||
import appeng.bootstrap.IBlockRendering;
|
||||
import appeng.bootstrap.IItemRendering;
|
||||
import appeng.client.render.StaticBlockColor;
|
||||
|
||||
|
||||
public class WirelessRendering extends BlockRenderingCustomizer
|
||||
{
|
||||
@Override
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void customize( IBlockRendering rendering, IItemRendering itemRendering )
|
||||
{
|
||||
rendering.blockColor( new StaticBlockColor( AEColor.TRANSPARENT ) );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||
*
|
||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package appeng.client.render;
|
||||
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.color.IBlockColor;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
|
||||
|
||||
/**
|
||||
* Returns the shades of a single AE color for tint indices 0, 1, and 2.
|
||||
*/
|
||||
public class StaticBlockColor implements IBlockColor
|
||||
{
|
||||
|
||||
private final AEColor color;
|
||||
|
||||
public StaticBlockColor( AEColor color )
|
||||
{
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int colorMultiplier( IBlockState state, @Nullable IBlockAccess worldIn, @Nullable BlockPos pos, int tintIndex )
|
||||
{
|
||||
return color.getVariantByTintIndex( tintIndex );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -66,6 +66,7 @@ import appeng.block.networking.BlockEnergyCellRendering;
|
||||
import appeng.block.networking.BlockWireless;
|
||||
import appeng.block.networking.CableBusRendering;
|
||||
import appeng.block.networking.ControllerRendering;
|
||||
import appeng.block.networking.WirelessRendering;
|
||||
import appeng.block.qnb.BlockQuantumLinkChamber;
|
||||
import appeng.block.qnb.BlockQuantumRing;
|
||||
import appeng.block.spatial.BlockMatrixFrame;
|
||||
@@ -258,7 +259,10 @@ public final class ApiBlocks implements IBlocks
|
||||
.features( AEFeature.Inscriber )
|
||||
.rendering( new InscriberRendering() )
|
||||
.build();
|
||||
this.wirelessAccessPoint = registry.block( "wireless_access_point", BlockWireless::new ).features( AEFeature.WirelessAccessTerminal ).build();
|
||||
this.wirelessAccessPoint = registry.block( "wireless_access_point", BlockWireless::new )
|
||||
.features( AEFeature.WirelessAccessTerminal )
|
||||
.rendering( new WirelessRendering() )
|
||||
.build();
|
||||
this.charger = registry.block( "charger", BlockCharger::new )
|
||||
.rendering( new BlockRenderingCustomizer()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user