More stuff ingame and showing up.
This commit is contained in:
@@ -19,9 +19,6 @@
|
||||
package appeng.block;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -30,16 +27,13 @@ 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.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.*;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.util.math.shapes.VoxelShapePart;
|
||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorld;
|
||||
@@ -56,7 +50,6 @@ public abstract class AEBaseBlock extends Block
|
||||
|
||||
private boolean isOpaque = true;
|
||||
private boolean isFullSize = true;
|
||||
private boolean hasSubtypes = false;
|
||||
private boolean isInventory = false;
|
||||
|
||||
protected VoxelShape boundingBox = VoxelShapes.fullCube();
|
||||
@@ -316,9 +309,9 @@ public abstract class AEBaseBlock extends Block
|
||||
return new Direction[0];
|
||||
}
|
||||
|
||||
public boolean onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
return false;
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
public final Direction mapRotation(final IOrientable ori, final Direction dir )
|
||||
@@ -408,7 +401,7 @@ public abstract class AEBaseBlock extends Block
|
||||
|
||||
}
|
||||
|
||||
protected IOrientable getOrientable( final IWorldReader w, final BlockPos pos )
|
||||
protected IOrientable getOrientable( final IBlockReader w, final BlockPos pos )
|
||||
{
|
||||
if( this instanceof IOrientableBlock )
|
||||
{
|
||||
@@ -448,16 +441,6 @@ public abstract class AEBaseBlock extends Block
|
||||
return isOpaque;
|
||||
}
|
||||
|
||||
protected boolean hasSubtypes()
|
||||
{
|
||||
return this.hasSubtypes;
|
||||
}
|
||||
|
||||
protected void setHasSubtypes( final boolean hasSubtypes )
|
||||
{
|
||||
this.hasSubtypes = hasSubtypes;
|
||||
}
|
||||
|
||||
protected boolean isFullSize()
|
||||
{
|
||||
return this.isFullSize;
|
||||
|
||||
@@ -0,0 +1,195 @@
|
||||
/*
|
||||
* 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 java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
||||
public class AEBaseBlockItem extends BlockItem
|
||||
{
|
||||
|
||||
private final AEBaseBlock blockType;
|
||||
|
||||
public AEBaseBlockItem(final Block id, Item.Properties props )
|
||||
{
|
||||
super( id, props );
|
||||
this.blockType = (AEBaseBlock) id;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public final void addInformation( final ItemStack itemStack, final World world, final List<ITextComponent> toolTip, final ITooltipFlag advancedTooltips )
|
||||
{
|
||||
this.addCheckedInformation( itemStack, world, toolTip, advancedTooltips );
|
||||
}
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void addCheckedInformation(final ItemStack itemStack, final World world, final List<ITextComponent> toolTip, final ITooltipFlag advancedTooltips )
|
||||
{
|
||||
this.blockType.addInformation( itemStack, world, toolTip, advancedTooltips );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBookEnchantable( final ItemStack itemstack1, final ItemStack itemstack2 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTranslationKey( final ItemStack is )
|
||||
{
|
||||
return this.blockType.getTranslationKey();
|
||||
}
|
||||
|
||||
|
||||
// @Override
|
||||
// public boolean placeBlock( final ItemStack stack, final PlayerEntity player, final World w, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final BlockState newState )
|
||||
// {
|
||||
// Direction up = null;
|
||||
// Direction forward = null;
|
||||
//
|
||||
// if( this.blockType instanceof AEBaseTileBlock )
|
||||
// {
|
||||
// if( this.blockType instanceof BlockLightDetector )
|
||||
// {
|
||||
// up = side;
|
||||
// if( up == Direction.UP || up == Direction.DOWN )
|
||||
// {
|
||||
// forward = Direction.SOUTH;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// forward = Direction.UP;
|
||||
// }
|
||||
// }
|
||||
// else if( this.blockType instanceof BlockWireless || this.blockType instanceof BlockSkyCompass )
|
||||
// {
|
||||
// forward = side;
|
||||
// if( forward == Direction.UP || forward == Direction.DOWN )
|
||||
// {
|
||||
// up = Direction.SOUTH;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// up = Direction.UP;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// up = Direction.UP;
|
||||
//
|
||||
// final byte rotation = (byte) ( MathHelper.floor( ( player.rotationYaw * 4F ) / 360F + 2.5D ) & 3 );
|
||||
//
|
||||
// switch( rotation )
|
||||
// {
|
||||
// default:
|
||||
// case 0:
|
||||
// forward = Direction.SOUTH;
|
||||
// break;
|
||||
// case 1:
|
||||
// forward = Direction.WEST;
|
||||
// break;
|
||||
// case 2:
|
||||
// forward = Direction.NORTH;
|
||||
// break;
|
||||
// case 3:
|
||||
// forward = Direction.EAST;
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// if( player.rotationPitch > 65 )
|
||||
// {
|
||||
// up = forward.getOpposite();
|
||||
// forward = Direction.UP;
|
||||
// }
|
||||
// else if( player.rotationPitch < -65 )
|
||||
// {
|
||||
// up = forward.getOpposite();
|
||||
// forward = Direction.DOWN;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// IOrientable ori = null;
|
||||
// if( this.blockType instanceof IOrientableBlock )
|
||||
// {
|
||||
// ori = ( (IOrientableBlock) this.blockType ).getOrientable( w, pos );
|
||||
// up = side;
|
||||
// forward = Direction.SOUTH;
|
||||
// if( up.getYOffset() == 0 )
|
||||
// {
|
||||
// forward = Direction.UP;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if( !this.blockType.isValidOrientation( w, pos, forward, up ) )
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// if( super.placeBlock( stack, player, w, pos, side, hitX, hitY, hitZ, newState ) )
|
||||
// {
|
||||
// if( this.blockType instanceof AEBaseTileBlock && !( this.blockType instanceof BlockLightDetector ) )
|
||||
// {
|
||||
// final AEBaseTile tile = ( (AEBaseTileBlock) this.blockType ).getTileEntity( w, pos );
|
||||
// ori = tile;
|
||||
//
|
||||
// if( tile == null )
|
||||
// {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// if( ori.canBeRotated() && !this.blockType.hasCustomRotation() )
|
||||
// {
|
||||
// ori.setOrientation( forward, up );
|
||||
// }
|
||||
//
|
||||
// if( tile instanceof IGridProxyable )
|
||||
// {
|
||||
// ( (IGridProxyable) tile ).getProxy().setOwner( player );
|
||||
// }
|
||||
//
|
||||
// tile.onPlacement( stack, player, side );
|
||||
// }
|
||||
// else if( this.blockType instanceof IOrientableBlock )
|
||||
// {
|
||||
// ori.setOrientation( forward, up );
|
||||
// }
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
}
|
||||
@@ -1,211 +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 java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
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.misc.BlockLightDetector;
|
||||
import appeng.block.misc.BlockSkyCompass;
|
||||
import appeng.block.networking.BlockWireless;
|
||||
import appeng.me.helpers.IGridProxyable;
|
||||
import appeng.tile.AEBaseTile;
|
||||
|
||||
|
||||
public class AEBaseBlockItem extends BlockItem
|
||||
{
|
||||
|
||||
private final AEBaseBlock blockType;
|
||||
|
||||
public AEBaseBlockItem( final Block id )
|
||||
{
|
||||
super( id );
|
||||
this.blockType = (AEBaseBlock) id;
|
||||
this.hasSubtypes = this.blockType.hasSubtypes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata( final int dmg )
|
||||
{
|
||||
if( this.hasSubtypes )
|
||||
{
|
||||
return dmg;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public final void addInformation( final ItemStack itemStack, final World world, final List<String> toolTip, final ITooltipFlag advancedTooltips )
|
||||
{
|
||||
this.addCheckedInformation( itemStack, world, toolTip, advancedTooltips );
|
||||
}
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void addCheckedInformation( final ItemStack itemStack, final World world, final List<String> toolTip, final ITooltipFlag advancedTooltips )
|
||||
{
|
||||
this.blockType.addInformation( itemStack, world, toolTip, advancedTooltips );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBookEnchantable( final ItemStack itemstack1, final ItemStack itemstack2 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTranslationKey( final ItemStack is )
|
||||
{
|
||||
return this.blockType.getTranslationKey( is );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean placeBlockAt( final ItemStack stack, final PlayerEntity player, final World w, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final BlockState newState )
|
||||
{
|
||||
Direction up = null;
|
||||
Direction forward = null;
|
||||
|
||||
if( this.blockType instanceof AEBaseTileBlock )
|
||||
{
|
||||
if( this.blockType instanceof BlockLightDetector )
|
||||
{
|
||||
up = side;
|
||||
if( up == Direction.UP || up == Direction.DOWN )
|
||||
{
|
||||
forward = Direction.SOUTH;
|
||||
}
|
||||
else
|
||||
{
|
||||
forward = Direction.UP;
|
||||
}
|
||||
}
|
||||
else if( this.blockType instanceof BlockWireless || this.blockType instanceof BlockSkyCompass )
|
||||
{
|
||||
forward = side;
|
||||
if( forward == Direction.UP || forward == Direction.DOWN )
|
||||
{
|
||||
up = Direction.SOUTH;
|
||||
}
|
||||
else
|
||||
{
|
||||
up = Direction.UP;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
up = Direction.UP;
|
||||
|
||||
final byte rotation = (byte) ( MathHelper.floor( ( player.rotationYaw * 4F ) / 360F + 2.5D ) & 3 );
|
||||
|
||||
switch( rotation )
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
forward = Direction.SOUTH;
|
||||
break;
|
||||
case 1:
|
||||
forward = Direction.WEST;
|
||||
break;
|
||||
case 2:
|
||||
forward = Direction.NORTH;
|
||||
break;
|
||||
case 3:
|
||||
forward = Direction.EAST;
|
||||
break;
|
||||
}
|
||||
|
||||
if( player.rotationPitch > 65 )
|
||||
{
|
||||
up = forward.getOpposite();
|
||||
forward = Direction.UP;
|
||||
}
|
||||
else if( player.rotationPitch < -65 )
|
||||
{
|
||||
up = forward.getOpposite();
|
||||
forward = Direction.DOWN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IOrientable ori = null;
|
||||
if( this.blockType instanceof IOrientableBlock )
|
||||
{
|
||||
ori = ( (IOrientableBlock) this.blockType ).getOrientable( w, pos );
|
||||
up = side;
|
||||
forward = Direction.SOUTH;
|
||||
if( up.getYOffset() == 0 )
|
||||
{
|
||||
forward = Direction.UP;
|
||||
}
|
||||
}
|
||||
|
||||
if( !this.blockType.isValidOrientation( w, pos, forward, up ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if( super.placeBlockAt( stack, player, w, pos, side, hitX, hitY, hitZ, newState ) )
|
||||
{
|
||||
if( this.blockType instanceof AEBaseTileBlock && !( this.blockType instanceof BlockLightDetector ) )
|
||||
{
|
||||
final AEBaseTile tile = ( (AEBaseTileBlock) this.blockType ).getTileEntity( w, pos );
|
||||
ori = tile;
|
||||
|
||||
if( tile == null )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if( ori.canBeRotated() && !this.blockType.hasCustomRotation() )
|
||||
{
|
||||
ori.setOrientation( forward, up );
|
||||
}
|
||||
|
||||
if( tile instanceof IGridProxyable )
|
||||
{
|
||||
( (IGridProxyable) tile ).getProxy().setOwner( player );
|
||||
}
|
||||
|
||||
tile.onPlacement( stack, player, side );
|
||||
}
|
||||
else if( this.blockType instanceof IOrientableBlock )
|
||||
{
|
||||
ori.setOrientation( forward, up );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,7 @@ import net.minecraft.block.Block;
|
||||
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.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -43,14 +44,13 @@ import appeng.util.Platform;
|
||||
public class AEBaseBlockItemChargeable extends AEBaseBlockItem implements IAEItemPowerStorage
|
||||
{
|
||||
|
||||
public AEBaseBlockItemChargeable( final Block id )
|
||||
{
|
||||
super( id );
|
||||
public AEBaseBlockItemChargeable(Block id, Properties props) {
|
||||
super(id, props);
|
||||
}
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void addCheckedInformation( final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips )
|
||||
public void addCheckedInformation(final ItemStack stack, final World world, final List<ITextComponent> lines, final ITooltipFlag advancedTooltips )
|
||||
{
|
||||
double internalCurrentPower = 0;
|
||||
final double internalMaxPower = this.getMaxEnergyCapacity();
|
||||
|
||||
@@ -29,14 +29,13 @@ import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.BlockStateContainer;
|
||||
import net.minecraft.block.ITileEntityProvider;
|
||||
import net.minecraft.block.material.Material;
|
||||
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.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
@@ -46,9 +45,6 @@ import net.minecraft.util.math.BlockRayTraceResult;
|
||||
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 net.minecraftforge.items.ItemHandlerHelper;
|
||||
|
||||
import appeng.api.implementations.items.IMemoryCard;
|
||||
@@ -56,12 +52,9 @@ import appeng.api.implementations.items.MemoryCardMessages;
|
||||
import appeng.api.implementations.tiles.IColorableTile;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.block.networking.BlockCableBus;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import appeng.tile.AEBaseInvTile;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.tile.networking.TileCableBus;
|
||||
import appeng.tile.storage.TileSkyChest;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.SettingsFrom;
|
||||
|
||||
@@ -72,46 +65,45 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
|
||||
@Nonnull
|
||||
private Class<? extends AEBaseTile> tileEntityType;
|
||||
|
||||
public AEBaseTileBlock( final Material mat )
|
||||
public AEBaseTileBlock( final Block.Properties props )
|
||||
{
|
||||
super( mat );
|
||||
super( props );
|
||||
}
|
||||
|
||||
public static final UnlistedDirection FORWARD = new UnlistedDirection( "forward" );
|
||||
public static final UnlistedDirection UP = new UnlistedDirection( "up" );
|
||||
// FIXME
|
||||
// public static final UnlistedDirection FORWARD = new UnlistedDirection( "forward" );
|
||||
// public static final UnlistedDirection UP = new UnlistedDirection( "up" );
|
||||
|
||||
@Override
|
||||
public BlockState getExtendedState( BlockState state, IBlockReader world, BlockPos pos )
|
||||
{
|
||||
// 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.withProperty( FORWARD, tile.getForward() ).withProperty( UP, tile.getUp() );
|
||||
// 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.withProperty( FORWARD, tile.getForward() ).withProperty( UP, tile.getUp() );
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new ExtendedBlockState( this, this.getAEStates(), new IUnlistedProperty[] {
|
||||
FORWARD,
|
||||
UP
|
||||
} );
|
||||
}
|
||||
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||
super.fillStateContainer(builder);
|
||||
|
||||
@Override
|
||||
public int getMetaFromState( BlockState state )
|
||||
{
|
||||
return 0;
|
||||
// TODO: Rendering stuff
|
||||
|
||||
// return new ExtendedBlockState( this, this.getAEStates(), new IUnlistedProperty[] {
|
||||
// FORWARD,
|
||||
// UP
|
||||
// } );
|
||||
}
|
||||
|
||||
// TODO : Was this change needed?
|
||||
@@ -183,8 +175,8 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock( final World w, final BlockPos pos, final BlockState state )
|
||||
{
|
||||
public void onReplaced(BlockState state, World w, BlockPos pos, BlockState newState, boolean isMoving) {
|
||||
|
||||
final AEBaseTile te = this.getTileEntity( w, pos );
|
||||
if( te != null )
|
||||
{
|
||||
@@ -203,19 +195,19 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
|
||||
}
|
||||
|
||||
// super will remove the TE, as it is not an instance of BlockContainer
|
||||
super.breakBlock( w, pos, state );
|
||||
super.onReplaced( state, w, pos, newState, isMoving );
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Direction[] getValidRotations( final World w, final BlockPos pos )
|
||||
public Direction[] getValidRotations(BlockState state, IBlockReader world, BlockPos pos)
|
||||
{
|
||||
final AEBaseTile obj = this.getTileEntity( w, pos );
|
||||
final AEBaseTile obj = this.getTileEntity( world, pos );
|
||||
if( obj != null && obj.canBeRotated() )
|
||||
{
|
||||
return Direction.values();
|
||||
}
|
||||
|
||||
return super.getValidRotations( w, pos );
|
||||
return super.getValidRotations( state, world, pos );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -271,7 +263,8 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
|
||||
final TileEntity te = this.getTileEntity( w, pos );
|
||||
if( te instanceof AEBaseTile )
|
||||
{
|
||||
( (AEBaseTile) w.getTileEntity( pos ) ).setName( is.getDisplayName() );
|
||||
// FIXME: Check if this will make it translated
|
||||
( (AEBaseTile) w.getTileEntity( pos ) ).setName( is.getDisplayName().getString() );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -284,27 +277,22 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
|
||||
{
|
||||
heldItem = player.getHeldItem( hand );
|
||||
|
||||
if( Platform.isWrench( player, heldItem, pos ) && player.isShiftKeyDown() )
|
||||
if( Platform.isWrench( player, heldItem, pos ) && player.isCrouching() )
|
||||
{
|
||||
final BlockState blockState = world.getBlockState( pos );
|
||||
final Block block = blockState.getBlock();
|
||||
|
||||
if( block == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
final AEBaseTile tile = this.getTileEntity( world, pos );
|
||||
|
||||
if( tile == null )
|
||||
{
|
||||
return false;
|
||||
return ActionResultType.FAIL;
|
||||
}
|
||||
|
||||
if( tile instanceof TileCableBus || tile instanceof TileSkyChest )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// FIXME if( tile instanceof TileCableBus || tile instanceof TileSkyChest )
|
||||
// {
|
||||
// return ActionResultType.FAIL;
|
||||
// }
|
||||
|
||||
final ItemStack[] itemDropCandidates = Platform.getBlockDrops( world, pos );
|
||||
final ItemStack op = new ItemStack( this );
|
||||
@@ -321,29 +309,29 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
|
||||
}
|
||||
}
|
||||
|
||||
if( block.removedByPlayer( blockState, world, pos, player, false ) )
|
||||
if( block.removedByPlayer( blockState, world, pos, player, false, world.getFluidState(pos) ) )
|
||||
{
|
||||
final List<ItemStack> itemsToDrop = Lists.newArrayList( itemDropCandidates );
|
||||
Platform.spawnDrops( world, pos, itemsToDrop );
|
||||
world.setBlockToAir( pos );
|
||||
world.removeBlock(pos, false);
|
||||
}
|
||||
|
||||
return false;
|
||||
return ActionResultType.FAIL;
|
||||
}
|
||||
|
||||
if( heldItem.getItem() instanceof IMemoryCard && !( this instanceof BlockCableBus ) )
|
||||
if( heldItem.getItem() instanceof IMemoryCard /* FIXME && !( this instanceof BlockCableBus ) */ )
|
||||
{
|
||||
final IMemoryCard memoryCard = (IMemoryCard) heldItem.getItem();
|
||||
final AEBaseTile tileEntity = this.getTileEntity( world, pos );
|
||||
|
||||
if( tileEntity == null )
|
||||
{
|
||||
return false;
|
||||
return ActionResultType.FAIL;
|
||||
}
|
||||
|
||||
final String name = this.getTranslationKey();
|
||||
|
||||
if( player.isShiftKeyDown() )
|
||||
if( player.isCrouching() )
|
||||
{
|
||||
final CompoundNBT data = tileEntity.downloadSettings( SettingsFrom.MEMORY_CARD );
|
||||
if( data != null )
|
||||
@@ -368,21 +356,21 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return this.onActivated( world, pos, player, hand, player.getHeldItem( hand ), facing, hitX, hitY, hitZ );
|
||||
return this.onActivated( world, pos, player, hand, player.getHeldItem( hand ), hit );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOrientable getOrientable( final IBlockReader w, final BlockPos pos )
|
||||
public IOrientable getOrientable(final IBlockReader w, final BlockPos pos )
|
||||
{
|
||||
return this.getTileEntity( w, pos );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ICustomCollision getCustomCollision( final World w, final BlockPos pos )
|
||||
public ICustomCollision getCustomCollision( final IBlockReader w, final BlockPos pos )
|
||||
{
|
||||
final AEBaseTile te = this.getTileEntity( w, pos );
|
||||
if( te instanceof ICustomCollision )
|
||||
|
||||
@@ -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.world.IBlockReader;
|
||||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
|
||||
|
||||
public final class UnlistedBlockAccess implements IUnlistedProperty<IBlockReader>
|
||||
{
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return "ba";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid( final IBlockReader value )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<IBlockReader> getType()
|
||||
{
|
||||
return IBlockReader.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String valueToString( final IBlockReader value )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -130,7 +130,7 @@ public class BlockCraftingUnit extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock( final World w, final BlockPos pos, final BlockState state )
|
||||
public void onReplaced(BlockState state, World w, BlockPos pos, BlockState newState, boolean isMoving) {
|
||||
{
|
||||
final TileCraftingTile cp = this.getTileEntity( w, pos );
|
||||
if( cp != null )
|
||||
@@ -138,7 +138,7 @@ public class BlockCraftingUnit extends AEBaseTileBlock
|
||||
cp.breakCluster();
|
||||
}
|
||||
|
||||
super.breakBlock( w, pos, state );
|
||||
super.onReplaced( state, w, pos, newState, isMoving );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,10 +29,12 @@ import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
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.World;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
@@ -57,7 +59,7 @@ public class BlockCrank extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
if( player instanceof FakePlayer || player == null )
|
||||
{
|
||||
|
||||
@@ -24,9 +24,10 @@ import javax.annotation.Nullable;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
@@ -47,12 +48,12 @@ public class BlockGrinder extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
final TileGrinder tg = this.getTileEntity( w, pos );
|
||||
if( tg != null && !p.isShiftKeyDown() )
|
||||
{
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_GRINDER );
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_GRINDER );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -24,9 +24,10 @@ import javax.annotation.Nullable;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
@@ -45,7 +46,7 @@ public class BlockCellWorkbench extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
if( p.isShiftKeyDown() )
|
||||
{
|
||||
@@ -57,7 +58,7 @@ public class BlockCellWorkbench extends AEBaseTileBlock
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_CELL_WORKBENCH );
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_CELL_WORKBENCH );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@ import java.util.Random;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
@@ -71,7 +73,7 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
if( player.isShiftKeyDown() )
|
||||
{
|
||||
@@ -92,7 +94,7 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void randomDisplayTick( final BlockState state, final World w, final BlockPos pos, final Random r )
|
||||
public void animateTick( final BlockState state, final World w, final BlockPos pos, final Random r )
|
||||
{
|
||||
if( !AEConfig.instance().isEnableEffects() )
|
||||
{
|
||||
|
||||
@@ -24,9 +24,10 @@ import javax.annotation.Nullable;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
@@ -45,7 +46,7 @@ public class BlockCondenser extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
if( player.isShiftKeyDown() )
|
||||
{
|
||||
@@ -57,7 +58,7 @@ public class BlockCondenser extends AEBaseTileBlock
|
||||
final TileCondenser tc = this.getTileEntity( w, pos );
|
||||
if( tc != null && !player.isShiftKeyDown() )
|
||||
{
|
||||
Platform.openGUI( player, tc, AEPartLocation.fromFacing( side ), GuiBridge.GUI_CONDENSER );
|
||||
Platform.openGUI( player, tc, AEPartLocation.fromFacing(hit), GuiBridge.GUI_CONDENSER );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,10 +25,11 @@ import net.minecraft.block.material.Material;
|
||||
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.EnumBlockRenderType;
|
||||
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.World;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
@@ -50,7 +51,7 @@ public class BlockInscriber extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
if( p.isShiftKeyDown() )
|
||||
{
|
||||
@@ -62,7 +63,7 @@ public class BlockInscriber extends AEBaseTileBlock
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_INSCRIBER );
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_INSCRIBER );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -27,9 +27,11 @@ import net.minecraft.block.properties.PropertyBool;
|
||||
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.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -73,7 +75,7 @@ public class BlockInterface extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
if( p.isShiftKeyDown() )
|
||||
{
|
||||
@@ -85,7 +87,7 @@ public class BlockInterface extends AEBaseTileBlock
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_INTERFACE );
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_INTERFACE );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick( final BlockState state, final World worldIn, final BlockPos pos, final Random rand )
|
||||
public void animateTick( final BlockState state, final World worldIn, final BlockPos pos, final Random rand )
|
||||
{
|
||||
// cancel out lightning
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock,
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void randomDisplayTick( final BlockState state, final World w, final BlockPos pos, final Random r )
|
||||
public void animateTick( final BlockState state, final World w, final BlockPos pos, final Random r )
|
||||
{
|
||||
if( !AEConfig.instance().isEnableEffects() )
|
||||
{
|
||||
|
||||
@@ -73,7 +73,7 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOr
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
@Override
|
||||
public void randomDisplayTick( final BlockState state, final World w, final BlockPos pos, final Random r )
|
||||
public void animateTick( final BlockState state, final World w, final BlockPos pos, final Random r )
|
||||
{
|
||||
if( !AEConfig.instance().isEnableEffects() )
|
||||
{
|
||||
|
||||
@@ -27,10 +27,11 @@ import net.minecraft.block.properties.PropertyBool;
|
||||
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.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.World;
|
||||
|
||||
@@ -80,7 +81,7 @@ public class BlockSecurityStation extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
if( p.isShiftKeyDown() )
|
||||
{
|
||||
@@ -95,7 +96,7 @@ public class BlockSecurityStation extends AEBaseTileBlock
|
||||
return true;
|
||||
}
|
||||
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_SECURITY );
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_SECURITY );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -31,21 +31,23 @@ import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.projectile.EntityArrow;
|
||||
import net.minecraft.entity.projectile.AbstractArrowEntity;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.entity.EntityTinyTNTPrimed;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
|
||||
|
||||
public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
|
||||
@@ -72,18 +74,18 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
if( heldItem != null && heldItem.getItem() == Items.FLINT_AND_STEEL )
|
||||
{
|
||||
this.startFuse( w, pos, player );
|
||||
w.setBlockToAir( pos );
|
||||
w.removeBlock(pos, false);
|
||||
heldItem.damageItem( 1, player );
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return super.onActivated( w, pos, player, hand, heldItem, side, hitX, hitY, hitZ );
|
||||
return super.onActivated( w, pos, player, hand, heldItem, hit);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +106,7 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
|
||||
if( world.isBlockIndirectlyGettingPowered( pos ) > 0 )
|
||||
{
|
||||
this.startFuse( world, pos, null );
|
||||
world.setBlockToAir( pos );
|
||||
world.removeBlock(pos, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,21 +118,31 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
|
||||
if( w.isBlockIndirectlyGettingPowered( pos ) > 0 )
|
||||
{
|
||||
this.startFuse( w, pos, null );
|
||||
w.setBlockToAir( pos );
|
||||
w.removeBlock(pos, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityWalk( final World w, final BlockPos pos, final Entity entity )
|
||||
{
|
||||
if( entity instanceof EntityArrow && !w.isRemote )
|
||||
if( entity instanceof AbstractArrowEntity && !w.isRemote )
|
||||
{
|
||||
final EntityArrow entityarrow = (EntityArrow) entity;
|
||||
final AbstractArrowEntity entityarrow = (AbstractArrowEntity) entity;
|
||||
|
||||
if( entityarrow.isBurning() )
|
||||
{
|
||||
this.startFuse( w, pos, entityarrow.shootingEntity instanceof LivingEntity ? (LivingEntity) entityarrow.shootingEntity : null );
|
||||
w.setBlockToAir( pos );
|
||||
LivingEntity igniter = null;
|
||||
// Check if the shooter still exists
|
||||
if (w instanceof ServerWorld) {
|
||||
ServerWorld serverWorld = (ServerWorld) w;
|
||||
Entity shooter = serverWorld.getEntityByUuid(entityarrow.shootingEntity);
|
||||
if (shooter instanceof LivingEntity) {
|
||||
igniter = (LivingEntity) shooter;
|
||||
}
|
||||
|
||||
}
|
||||
this.startFuse( w, pos, igniter );
|
||||
w.removeBlock(pos, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,10 +29,12 @@ import net.minecraft.block.properties.PropertyBool;
|
||||
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;
|
||||
|
||||
@@ -75,7 +77,7 @@ public final class BlockVibrationChamber extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
if( player.isShiftKeyDown() )
|
||||
{
|
||||
@@ -87,7 +89,7 @@ public final class BlockVibrationChamber extends AEBaseTileBlock
|
||||
final TileVibrationChamber tc = this.getTileEntity( w, pos );
|
||||
if( tc != null && !player.isShiftKeyDown() )
|
||||
{
|
||||
Platform.openGUI( player, tc, AEPartLocation.fromFacing( side ), GuiBridge.GUI_VIBRATION_CHAMBER );
|
||||
Platform.openGUI( player, tc, AEPartLocation.fromFacing(hit), GuiBridge.GUI_VIBRATION_CHAMBER );
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -96,7 +98,7 @@ public final class BlockVibrationChamber extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick( final BlockState state, final World w, final BlockPos pos, final Random r )
|
||||
public void animateTick( final BlockState state, final World w, final BlockPos pos, final Random r )
|
||||
{
|
||||
if( !AEConfig.instance().isEnableEffects() )
|
||||
{
|
||||
|
||||
@@ -43,11 +43,13 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.state.IProperty;
|
||||
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;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceResult.Type;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
@@ -130,9 +132,9 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick( final BlockState state, final World worldIn, final BlockPos pos, final Random rand )
|
||||
public void animateTick( final BlockState state, final World worldIn, final BlockPos pos, final Random rand )
|
||||
{
|
||||
this.cb( worldIn, pos ).randomDisplayTick( worldIn, pos, rand );
|
||||
this.cb( worldIn, pos ).animateTick( worldIn, pos, rand );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -401,7 +403,7 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
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 ) );
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ public class BlockPaint extends AEBaseTileBlock
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
w.setBlockToAir( pos );
|
||||
w.removeBlock(pos, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -111,15 +111,14 @@ public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICusto
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock( final World w, final BlockPos pos, final BlockState state )
|
||||
{
|
||||
public void onReplaced(BlockState state, World w, BlockPos pos, BlockState newState, boolean isMoving) {
|
||||
final TileQuantumBridge bridge = this.getTileEntity( w, pos );
|
||||
if( bridge != null )
|
||||
{
|
||||
bridge.breakCluster();
|
||||
}
|
||||
|
||||
super.breakBlock( w, pos, state );
|
||||
super.onReplaced( state, w, pos, newState, isMoving );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,10 +29,11 @@ import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
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.world.World;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
@@ -53,7 +54,7 @@ public class BlockQuantumLinkChamber extends BlockQuantumBase
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick( final BlockState state, final World w, final BlockPos pos, final Random rand )
|
||||
public void animateTick( final BlockState state, final World w, final BlockPos pos, final Random rand )
|
||||
{
|
||||
final TileQuantumBridge bridge = this.getTileEntity( w, pos );
|
||||
if( bridge != null )
|
||||
@@ -69,7 +70,7 @@ public class BlockQuantumLinkChamber extends BlockQuantumBase
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
if( p.isShiftKeyDown() )
|
||||
{
|
||||
@@ -81,7 +82,7 @@ public class BlockQuantumLinkChamber extends BlockQuantumBase
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_QNB );
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_QNB );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,9 +26,10 @@ import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
@@ -57,7 +58,7 @@ public class BlockSpatialIOPort extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
if( p.isShiftKeyDown() )
|
||||
{
|
||||
@@ -69,7 +70,7 @@ public class BlockSpatialIOPort extends AEBaseTileBlock
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_SPATIAL_IO_PORT );
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_SPATIAL_IO_PORT );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -27,10 +27,11 @@ import net.minecraft.block.properties.PropertyEnum;
|
||||
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.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.World;
|
||||
|
||||
@@ -90,7 +91,7 @@ public class BlockChest extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
final TileChest tg = this.getTileEntity( w, pos );
|
||||
if( tg != null && !p.isShiftKeyDown() )
|
||||
@@ -100,9 +101,9 @@ public class BlockChest extends AEBaseTileBlock
|
||||
return true;
|
||||
}
|
||||
|
||||
if( side != tg.getUp() )
|
||||
if( hit != tg.getUp() )
|
||||
{
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_CHEST );
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_CHEST );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -26,10 +26,11 @@ 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.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.World;
|
||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||
@@ -79,7 +80,7 @@ public class BlockDrive extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
if( p.isShiftKeyDown() )
|
||||
{
|
||||
@@ -91,7 +92,7 @@ public class BlockDrive extends AEBaseTileBlock
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_DRIVE );
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_DRIVE );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -26,9 +26,10 @@ import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
@@ -57,7 +58,7 @@ public class BlockIOPort extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
if( p.isShiftKeyDown() )
|
||||
{
|
||||
@@ -69,7 +70,7 @@ public class BlockIOPort extends AEBaseTileBlock
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_IOPORT );
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_IOPORT );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -29,11 +29,13 @@ import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.Direction;
|
||||
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.world.World;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
@@ -75,11 +77,11 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
Platform.openGUI( player, this.getTileEntity( w, pos ), AEPartLocation.fromFacing( side ), GuiBridge.GUI_SKYCHEST );
|
||||
Platform.openGUI( player, this.getTileEntity( w, pos ), AEPartLocation.fromFacing(hit), GuiBridge.GUI_SKYCHEST );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -30,6 +30,7 @@ import java.util.function.Supplier;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -93,8 +94,8 @@ class BlockDefinitionBuilder implements IBlockBuilder
|
||||
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
this.blockRendering = new BlockRendering();
|
||||
this.itemRendering = new ItemRendering();
|
||||
this.blockRendering = new BlockRendering();
|
||||
this.itemRendering = new ItemRendering();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +121,7 @@ class BlockDefinitionBuilder implements IBlockBuilder
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public BlockDefinitionBuilder rendering( BlockRenderingCustomizer callback )
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
@@ -179,11 +180,6 @@ class BlockDefinitionBuilder implements IBlockBuilder
|
||||
@Override
|
||||
public <T extends IBlockDefinition> T build()
|
||||
{
|
||||
if( !AEConfig.instance().areFeaturesEnabled( this.features ) )
|
||||
{
|
||||
return (T) new TileDefinition( this.registryName, null, null );
|
||||
}
|
||||
|
||||
// Create block and matching item, and set factory name of both
|
||||
Block block = this.blockSupplier.get();
|
||||
block.setRegistryName( AppEng.MOD_ID, this.registryName );
|
||||
@@ -268,7 +264,7 @@ class BlockDefinitionBuilder implements IBlockBuilder
|
||||
}
|
||||
else if( block instanceof AEBaseBlock )
|
||||
{
|
||||
return new AEBaseBlockItem( block );
|
||||
return new AEBaseBlockItem( block, new Item.Properties() /* FIXME THIS IS THE IMPORTANT BIT */ );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -19,25 +19,20 @@
|
||||
package appeng.bootstrap;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.bootstrap.components.BlockColorComponent;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.block.statemap.IStateMapper;
|
||||
import net.minecraft.client.renderer.color.IBlockColor;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraftforge.client.model.IModel;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.IUnbakedModel;
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.bootstrap.components.BlockColorComponent;
|
||||
import appeng.bootstrap.components.StateMapperComponent;
|
||||
import appeng.bootstrap.components.TesrComponent;
|
||||
import appeng.client.render.model.AutoRotatingModel;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
|
||||
class BlockRendering implements IBlockRendering
|
||||
@@ -50,13 +45,13 @@ class BlockRendering implements IBlockRendering
|
||||
private IBlockColor blockColor;
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
private TileEntitySpecialRenderer<?> tesr;
|
||||
private TileEntityRenderer<?> tesr;
|
||||
|
||||
// FIXME @OnlyIn( Dist.CLIENT )
|
||||
// FIXME private IStateMapper stateMapper;
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
private IStateMapper stateMapper;
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
private Map<String, IModel> builtInModels = new HashMap<>();
|
||||
private Map<String, IUnbakedModel> builtInModels = new HashMap<>();
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
@@ -76,47 +71,47 @@ class BlockRendering implements IBlockRendering
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
@Override
|
||||
public IBlockRendering tesr( TileEntitySpecialRenderer<?> tesr )
|
||||
public IBlockRendering tesr( TileEntityRenderer<?> tesr )
|
||||
{
|
||||
this.tesr = tesr;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockRendering builtInModel( String name, IModel model )
|
||||
public IBlockRendering builtInModel( String name, IUnbakedModel model )
|
||||
{
|
||||
this.builtInModels.put( name, model );
|
||||
return this;
|
||||
}
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
@Override
|
||||
public IBlockRendering stateMapper( IStateMapper mapper )
|
||||
{
|
||||
this.stateMapper = mapper;
|
||||
return this;
|
||||
}
|
||||
// FIXME @OnlyIn( Dist.CLIENT )
|
||||
// FIXME @Override
|
||||
// FIXME public IBlockRendering stateMapper( IStateMapper mapper )
|
||||
// FIXME {
|
||||
// FIXME this.stateMapper = mapper;
|
||||
// FIXME return this;
|
||||
// FIXME }
|
||||
|
||||
void apply( FeatureFactory factory, Block block, Class<?> tileEntityClass )
|
||||
{
|
||||
if( this.tesr != null )
|
||||
{
|
||||
if( tileEntityClass == null )
|
||||
{
|
||||
throw new IllegalStateException( "Tried to register a TESR for " + block + " even though no tile entity has been specified." );
|
||||
}
|
||||
factory.addBootstrapComponent( new TesrComponent( tileEntityClass, this.tesr ) );
|
||||
}
|
||||
// FIXME if( this.tesr != null )
|
||||
// FIXME {
|
||||
// FIXME if( tileEntityClass == null )
|
||||
// FIXME {
|
||||
// FIXME throw new IllegalStateException( "Tried to register a TESR for " + block + " even though no tile entity has been specified." );
|
||||
// FIXME }
|
||||
// FIXME factory.addBootstrapComponent( new TesrComponent( tileEntityClass, this.tesr ) );
|
||||
// FIXME }
|
||||
|
||||
if( this.modelCustomizer != null )
|
||||
{
|
||||
factory.addModelOverride( block.getRegistryName().getResourcePath(), this.modelCustomizer );
|
||||
factory.addModelOverride( block.getRegistryName().getPath(), this.modelCustomizer );
|
||||
}
|
||||
else if( block instanceof AEBaseTileBlock )
|
||||
{
|
||||
// This is a default rotating model if the base-block uses an AE tile entity which exposes UP/FRONT as
|
||||
// extended props
|
||||
factory.addModelOverride( block.getRegistryName().getResourcePath(), ( l, m ) -> new AutoRotatingModel( m ) );
|
||||
// FIXME factory.addModelOverride( block.getRegistryName().getPath(), ( l, m ) -> new AutoRotatingModel( m ) );
|
||||
}
|
||||
|
||||
// TODO : 1.12
|
||||
@@ -127,9 +122,9 @@ class BlockRendering implements IBlockRendering
|
||||
factory.addBootstrapComponent( new BlockColorComponent( block, this.blockColor ) );
|
||||
}
|
||||
|
||||
if( this.stateMapper != null )
|
||||
{
|
||||
factory.addBootstrapComponent( new StateMapperComponent( block, this.stateMapper ) );
|
||||
}
|
||||
// FIXME if( this.stateMapper != null )
|
||||
// FIXME {
|
||||
// FIXME factory.addBootstrapComponent( new StateMapperComponent( block, this.stateMapper ) );
|
||||
// FIXME }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,8 +40,6 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEColoredItemDefinition;
|
||||
import appeng.bootstrap.components.BuiltInModelComponent;
|
||||
import appeng.bootstrap.components.ModelOverrideComponent;
|
||||
import appeng.bootstrap.components.TileEntityComponent;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.ActivityState;
|
||||
@@ -57,11 +55,11 @@ public class FeatureFactory
|
||||
|
||||
private final Map<Class<? extends IBootstrapComponent>, List<IBootstrapComponent>> bootstrapComponents;
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
private ModelOverrideComponent modelOverrideComponent;
|
||||
//FIXME @OnlyIn( Dist.CLIENT )
|
||||
//FIXME private ModelOverrideComponent modelOverrideComponent;
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
private BuiltInModelComponent builtInModelComponent;
|
||||
//FIXME @OnlyIn( Dist.CLIENT )
|
||||
//FIXME private BuiltInModelComponent builtInModelComponent;
|
||||
|
||||
public final TileEntityComponent tileEntityComponent;
|
||||
|
||||
@@ -75,11 +73,10 @@ public class FeatureFactory
|
||||
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
this.modelOverrideComponent = new ModelOverrideComponent();
|
||||
this.addBootstrapComponent( this.modelOverrideComponent );
|
||||
|
||||
this.builtInModelComponent = new BuiltInModelComponent();
|
||||
this.addBootstrapComponent( this.builtInModelComponent );
|
||||
// FIXME this.modelOverrideComponent = new ModelOverrideComponent();
|
||||
// FIXME this.addBootstrapComponent( this.modelOverrideComponent );
|
||||
// FIXME this.builtInModelComponent = new BuiltInModelComponent();
|
||||
// FIXME this.addBootstrapComponent( this.builtInModelComponent );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,8 +87,8 @@ public class FeatureFactory
|
||||
this.tileEntityComponent = parent.tileEntityComponent;
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
this.modelOverrideComponent = parent.modelOverrideComponent;
|
||||
this.builtInModelComponent = parent.builtInModelComponent;
|
||||
// FIXME this.modelOverrideComponent = parent.modelOverrideComponent;
|
||||
// FIXME this.builtInModelComponent = parent.builtInModelComponent;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,13 +139,13 @@ public class FeatureFactory
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
void addBuiltInModel( String path, IUnbakedModel model )
|
||||
{
|
||||
this.builtInModelComponent.addModel( path, model );
|
||||
// FIXME this.builtInModelComponent.addModel( path, model );
|
||||
}
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
void addModelOverride( String resourcePath, BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> customizer )
|
||||
{
|
||||
this.modelOverrideComponent.addOverride( resourcePath, customizer );
|
||||
// FIXME this.modelOverrideComponent.addOverride( resourcePath, customizer );
|
||||
}
|
||||
|
||||
public <T extends IBootstrapComponent> Iterator<T> getBootstrapComponents( Class<T> eventType )
|
||||
|
||||
@@ -42,8 +42,8 @@ public interface IBlockRendering
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
IBlockRendering blockColor( IBlockColor blockColor );
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
IBlockRendering stateMapper( IStateMapper mapper );
|
||||
//FIXME @OnlyIn( Dist.CLIENT )
|
||||
// IBlockRendering stateMapper( IStateMapper mapper );
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
IBlockRendering tesr( TileEntityRenderer<?> ter );
|
||||
|
||||
@@ -44,7 +44,7 @@ public interface IItemBuilder
|
||||
|
||||
IItemBuilder itemGroup( ItemGroup tab );
|
||||
|
||||
IItemBuilder rendering( ItemRenderingCustomizer callback );
|
||||
//FIXME IItemBuilder rendering( ItemRenderingCustomizer callback );
|
||||
|
||||
/**
|
||||
* Registers a custom dispenser behavior for this item.
|
||||
|
||||
@@ -22,13 +22,12 @@ package appeng.bootstrap;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.renderer.color.IItemColor;
|
||||
import net.minecraft.client.renderer.model.IUnbakedModel;
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.model.IModel;
|
||||
|
||||
|
||||
/**
|
||||
@@ -42,8 +41,8 @@ public interface IItemRendering
|
||||
* item model to be used for rendering by inspecting the item stack (i.e. for NBT data).
|
||||
* Please
|
||||
*/
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
IItemRendering meshDefinition( ItemMeshDefinition meshDefinition );
|
||||
//FIXME @OnlyIn( Dist.CLIENT )
|
||||
//FIXME IItemRendering meshDefinition( ItemMeshDefinition meshDefinition );
|
||||
|
||||
/**
|
||||
* Registers an item model for meta=0, see {@link #model(int, ModelResourceLocation)}.
|
||||
@@ -90,6 +89,6 @@ public interface IItemRendering
|
||||
* Registers a built-in model under the given resource path.
|
||||
*/
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
IItemRendering builtInModel( String name, IModel model );
|
||||
IItemRendering builtInModel( String name, IUnbakedModel model );
|
||||
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public interface IModelRegistry
|
||||
|
||||
void setCustomModelResourceLocation( Item item, int metadata, ModelResourceLocation model );
|
||||
|
||||
void setCustomMeshDefinition( Item item, ItemMeshDefinition meshDefinition );
|
||||
// FIXME void setCustomMeshDefinition( Item item, ItemMeshDefinition meshDefinition );
|
||||
|
||||
void setCustomStateMapper( Block block, IStateMapper mapper );
|
||||
// FIXME void setCustomStateMapper( Block block, IStateMapper mapper );
|
||||
}
|
||||
|
||||
@@ -58,9 +58,10 @@ class ItemDefinitionBuilder implements IItemBuilder
|
||||
|
||||
private Supplier<IDispenseItemBehavior> dispenserBehaviorSupplier;
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
private ItemRendering itemRendering;
|
||||
|
||||
// FIXME
|
||||
// @OnlyIn( Dist.CLIENT )
|
||||
// private ItemRendering itemRendering;
|
||||
//
|
||||
private ItemGroup itemGroup = CreativeTab.instance;
|
||||
|
||||
ItemDefinitionBuilder( FeatureFactory factory, String registryName, Supplier<Item> itemSupplier )
|
||||
@@ -70,7 +71,7 @@ class ItemDefinitionBuilder implements IItemBuilder
|
||||
this.itemSupplier = itemSupplier;
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
this.itemRendering = new ItemRendering();
|
||||
// FIXME this.itemRendering = new ItemRendering();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,16 +104,16 @@ class ItemDefinitionBuilder implements IItemBuilder
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemBuilder rendering( ItemRenderingCustomizer callback )
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
this.customizeForClient( callback );
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
// FIXME @Override
|
||||
// FIXME public IItemBuilder rendering( ItemRenderingCustomizer callback )
|
||||
// FIXME {
|
||||
// FIXME if( Platform.isClient() )
|
||||
// FIXME {
|
||||
// FIXME this.customizeForClient( callback );
|
||||
// FIXME }
|
||||
// FIXME
|
||||
// FIXME return this;
|
||||
// FIXME }
|
||||
|
||||
@Override
|
||||
public IItemBuilder dispenserBehavior( Supplier<IDispenseItemBehavior> behavior )
|
||||
@@ -121,11 +122,11 @@ class ItemDefinitionBuilder implements IItemBuilder
|
||||
return this;
|
||||
}
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
private void customizeForClient( ItemRenderingCustomizer callback )
|
||||
{
|
||||
callback.customize( this.itemRendering );
|
||||
}
|
||||
// FIXME @OnlyIn( Dist.CLIENT )
|
||||
// FIXME private void customizeForClient( ItemRenderingCustomizer callback )
|
||||
// FIXME {
|
||||
// FIXME callback.customize( this.itemRendering );
|
||||
// FIXME }
|
||||
|
||||
@Override
|
||||
public ItemDefinition build()
|
||||
@@ -157,7 +158,7 @@ class ItemDefinitionBuilder implements IItemBuilder
|
||||
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
this.itemRendering.apply( this.factory, item );
|
||||
// FIXME this.itemRendering.apply( this.factory, item );
|
||||
}
|
||||
|
||||
return definition;
|
||||
|
||||
@@ -30,16 +30,15 @@ import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.color.IItemColor;
|
||||
import net.minecraft.client.renderer.model.IUnbakedModel;
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.item.BlockItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.model.IModel;
|
||||
|
||||
import appeng.bootstrap.components.ItemColorComponent;
|
||||
import appeng.bootstrap.components.ItemMeshDefinitionComponent;
|
||||
@@ -53,8 +52,9 @@ class ItemRendering implements IItemRendering
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
private IItemColor itemColor;
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
private ItemMeshDefinition itemMeshDefinition;
|
||||
// FIXME
|
||||
// @OnlyIn( Dist.CLIENT )
|
||||
// private ItemMeshDefinition itemMeshDefinition;
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
private Map<Integer, ModelResourceLocation> itemModels = new HashMap<>();
|
||||
@@ -63,15 +63,16 @@ class ItemRendering implements IItemRendering
|
||||
private Set<ResourceLocation> variants = new HashSet<>();
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
private Map<String, IModel> builtInModels = new HashMap<>();
|
||||
private Map<String, IUnbakedModel> builtInModels = new HashMap<>();
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public IItemRendering meshDefinition( ItemMeshDefinition meshDefinition )
|
||||
{
|
||||
this.itemMeshDefinition = meshDefinition;
|
||||
return this;
|
||||
}
|
||||
// FIXME
|
||||
// @Override
|
||||
// @OnlyIn( Dist.CLIENT )
|
||||
// public IItemRendering meshDefinition( ItemMeshDefinition meshDefinition )
|
||||
// {
|
||||
// this.itemMeshDefinition = meshDefinition;
|
||||
// return this;
|
||||
// }
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
@@ -97,7 +98,7 @@ class ItemRendering implements IItemRendering
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemRendering builtInModel( String name, IModel model )
|
||||
public IItemRendering builtInModel( String name, IUnbakedModel model )
|
||||
{
|
||||
this.builtInModels.put( name, model );
|
||||
return this;
|
||||
@@ -105,10 +106,10 @@ class ItemRendering implements IItemRendering
|
||||
|
||||
void apply( FeatureFactory factory, Item item )
|
||||
{
|
||||
if( this.itemMeshDefinition != null )
|
||||
{
|
||||
factory.addBootstrapComponent( new ItemMeshDefinitionComponent( item, this.itemMeshDefinition ) );
|
||||
}
|
||||
//FIXME if( this.itemMeshDefinition != null )
|
||||
//FIXME {
|
||||
//FIXME factory.addBootstrapComponent( new ItemMeshDefinitionComponent( item, this.itemMeshDefinition ) );
|
||||
//FIXME }
|
||||
|
||||
if( !this.itemModels.isEmpty() )
|
||||
{
|
||||
@@ -118,24 +119,28 @@ class ItemRendering implements IItemRendering
|
||||
Set<ResourceLocation> resources = new HashSet<>( this.variants );
|
||||
|
||||
// Register a default item model if neither items by meta nor an item mesh definition exist
|
||||
if( this.itemMeshDefinition == null && this.itemModels.isEmpty() )
|
||||
if( /* FIXME this.itemMeshDefinition == null && */ this.itemModels.isEmpty() )
|
||||
{
|
||||
ModelResourceLocation model;
|
||||
|
||||
// For block items, the default will try to use the default state of the associated block
|
||||
if( item instanceof BlockItem )
|
||||
{
|
||||
Block block = ( (BlockItem) item ).getBlock();
|
||||
|
||||
// We can only do this once the blocks are actually registered...
|
||||
StateMapperHelper helper = new StateMapperHelper( item.getRegistryName() );
|
||||
model = helper.getModelResourceLocation( block.getDefaultState() );
|
||||
}
|
||||
else
|
||||
{
|
||||
model = new ModelResourceLocation( item.getRegistryName(), "inventory" );
|
||||
}
|
||||
factory.addBootstrapComponent( new ItemModelComponent( item, ImmutableMap.of( 0, model ) ) );
|
||||
// ModelResourceLocation model;
|
||||
//
|
||||
// // For block items, the default will try to use the default state of the associated block
|
||||
// if( item instanceof BlockItem )
|
||||
// {
|
||||
// Block block = ( (BlockItem) item ).getBlock();
|
||||
//
|
||||
// // We can only do this once the blocks are actually registered...
|
||||
// model = new ModelResourceLocation(
|
||||
// new ResourceLocation(
|
||||
// block.getRegistryName().getNamespace(),
|
||||
// "block/" + block.getRegistryName().getPath()
|
||||
// )
|
||||
// , "inventory" );
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// model = new ModelResourceLocation( item.getRegistryName(), "inventory" );
|
||||
// }
|
||||
// factory.addBootstrapComponent( new ItemModelComponent( item, ImmutableMap.of( 0, model ) ) );
|
||||
}
|
||||
|
||||
// TODO : 1.12
|
||||
@@ -145,12 +150,12 @@ class ItemRendering implements IItemRendering
|
||||
{
|
||||
factory.addBootstrapComponent( new ItemVariantsComponent( item, resources ) );
|
||||
}
|
||||
else if( this.itemMeshDefinition != null )
|
||||
{
|
||||
// Adding an empty variant list here will prevent Vanilla from trying to load the default item model in this
|
||||
// case
|
||||
factory.addBootstrapComponent( new ItemVariantsComponent( item, Collections.emptyList() ) );
|
||||
}
|
||||
// FIXME else if( this.itemMeshDefinition != null )
|
||||
// FIXME {
|
||||
// FIXME // Adding an empty variant list here will prevent Vanilla from trying to load the default item model in this
|
||||
// FIXME // case
|
||||
// FIXME factory.addBootstrapComponent( new ItemVariantsComponent( item, Collections.emptyList() ) );
|
||||
// FIXME }
|
||||
|
||||
if( this.itemColor != null )
|
||||
{
|
||||
@@ -158,20 +163,4 @@ class ItemRendering implements IItemRendering
|
||||
}
|
||||
}
|
||||
|
||||
private static class StateMapperHelper extends StateMapperBase
|
||||
{
|
||||
|
||||
private final ResourceLocation registryName;
|
||||
|
||||
public StateMapperHelper( ResourceLocation registryName )
|
||||
{
|
||||
this.registryName = registryName;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ModelResourceLocation getModelResourceLocation( BlockState state )
|
||||
{
|
||||
return new ModelResourceLocation( this.registryName, this.getPropertyString( state.getProperties() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,9 +28,7 @@ import net.minecraft.client.renderer.model.IUnbakedModel;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||
|
||||
import appeng.client.render.model.BuiltInModelLoader;
|
||||
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public class BuiltInModelComponent implements IPreInitComponent
|
||||
@@ -51,7 +49,7 @@ public class BuiltInModelComponent implements IPreInitComponent
|
||||
{
|
||||
this.hasInitialized = true;
|
||||
|
||||
BuiltInModelLoader loader = new BuiltInModelLoader( this.builtInModels );
|
||||
ModelLoaderRegistry.registerLoader( loader );
|
||||
// FIXME BuiltInModelLoader loader = new BuiltInModelLoader( this.builtInModels );
|
||||
// FIXME ModelLoaderRegistry.registerLoader( loader );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,5 +12,5 @@ import appeng.bootstrap.IBootstrapComponent;
|
||||
@FunctionalInterface
|
||||
public interface IEntityRegistrationComponent extends IBootstrapComponent
|
||||
{
|
||||
void entityRegistration( IForgeRegistry<EntityType<? extends Entity>> entityRegistry );
|
||||
void entityRegistration( IForgeRegistry<EntityType<?>> entityRegistry );
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package appeng.bootstrap.components;
|
||||
|
||||
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.IRecipeSerializer;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
|
||||
@@ -12,5 +13,5 @@ import appeng.bootstrap.IBootstrapComponent;
|
||||
@FunctionalInterface
|
||||
public interface IRecipeRegistrationComponent extends IBootstrapComponent
|
||||
{
|
||||
void recipeRegistration( Dist dist, IForgeRegistry<IRecipe> recipeRegistry );
|
||||
void recipeRegistration( Dist dist, IForgeRegistry<IRecipeSerializer<?>> recipeRegistry );
|
||||
}
|
||||
|
||||
@@ -19,10 +19,7 @@
|
||||
package appeng.bootstrap.components;
|
||||
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
||||
import appeng.bootstrap.IModelRegistry;
|
||||
@@ -35,19 +32,19 @@ import appeng.bootstrap.IModelRegistry;
|
||||
public class ItemMeshDefinitionComponent implements IModelRegistrationComponent
|
||||
{
|
||||
|
||||
private final Item item;
|
||||
// FIXME private final Item item;
|
||||
// FIXME
|
||||
// FIXME private final ItemMeshDefinition meshDefinition;
|
||||
|
||||
private final ItemMeshDefinition meshDefinition;
|
||||
|
||||
public ItemMeshDefinitionComponent( @Nonnull Item item, @Nonnull ItemMeshDefinition meshDefinition )
|
||||
{
|
||||
this.item = item;
|
||||
this.meshDefinition = meshDefinition;
|
||||
}
|
||||
// FIXME public ItemMeshDefinitionComponent( @Nonnull Item item, @Nonnull ItemMeshDefinition meshDefinition )
|
||||
// FIXME {
|
||||
// FIXME this.item = item;
|
||||
// FIXME this.meshDefinition = meshDefinition;
|
||||
// FIXME }
|
||||
|
||||
@Override
|
||||
public void modelRegistration( Dist dist, IModelRegistry registry )
|
||||
{
|
||||
registry.setCustomMeshDefinition( this.item, this.meshDefinition );
|
||||
// FIXME registry.setCustomMeshDefinition( this.item, this.meshDefinition );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,12 +27,10 @@ import java.util.function.BiFunction;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.util.registry.IRegistry;
|
||||
import net.minecraft.client.renderer.model.ModelBakery;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.client.model.IModel;
|
||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
||||
@@ -42,12 +40,10 @@ import appeng.core.AppEng;
|
||||
public class ModelOverrideComponent implements IPreInitComponent
|
||||
{
|
||||
|
||||
private static final ModelResourceLocation MODEL_MISSING = new ModelResourceLocation( "builtin/missing", "missing" );
|
||||
|
||||
// Maps from resource path to customizer
|
||||
private final Map<String, BiFunction<ModelResourceLocation, IBakedModel, IBakedModel>> customizer = new HashMap<>();
|
||||
private final Map<String, BiFunction<ResourceLocation, IBakedModel, IBakedModel>> customizer = new HashMap<>();
|
||||
|
||||
public void addOverride( String resourcePath, BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> customizer )
|
||||
public void addOverride( String resourcePath, BiFunction<ResourceLocation, IBakedModel, IBakedModel> customizer )
|
||||
{
|
||||
this.customizer.put( resourcePath, customizer );
|
||||
}
|
||||
@@ -61,19 +57,18 @@ public class ModelOverrideComponent implements IPreInitComponent
|
||||
@SubscribeEvent
|
||||
public void onModelBakeEvent( final ModelBakeEvent event )
|
||||
{
|
||||
IRegistry<ModelResourceLocation, IBakedModel> modelRegistry = event.getModelRegistry();
|
||||
Set<ModelResourceLocation> keys = Sets.newHashSet( modelRegistry.getKeys() );
|
||||
// IBakedModel missingModel = modelRegistry.getObject( MODEL_MISSING );
|
||||
IModel missingModel = ModelLoaderRegistry.getMissingModel();
|
||||
Map<ResourceLocation, IBakedModel> modelRegistry = event.getModelRegistry();
|
||||
Set<ResourceLocation> keys = Sets.newHashSet( modelRegistry.keySet() );
|
||||
IBakedModel missingModel = modelRegistry.get(ModelBakery.MODEL_MISSING);
|
||||
|
||||
for( ModelResourceLocation location : keys )
|
||||
for( ResourceLocation location : keys )
|
||||
{
|
||||
if( !location.getResourceDomain().equals( AppEng.MOD_ID ) )
|
||||
if( !location.getNamespace().equals( AppEng.MOD_ID ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
IBakedModel orgModel = modelRegistry.getObject( location );
|
||||
IBakedModel orgModel = modelRegistry.get( location );
|
||||
|
||||
// Don't customize the missing model. This causes Forge to swallow exceptions
|
||||
if( orgModel == missingModel )
|
||||
@@ -81,14 +76,14 @@ public class ModelOverrideComponent implements IPreInitComponent
|
||||
continue;
|
||||
}
|
||||
|
||||
BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> customizer = this.customizer.get( location.getResourcePath() );
|
||||
BiFunction<ResourceLocation, IBakedModel, IBakedModel> customizer = this.customizer.get( location.getPath() );
|
||||
if( customizer != null )
|
||||
{
|
||||
IBakedModel newModel = customizer.apply( location, orgModel );
|
||||
|
||||
if( newModel != orgModel )
|
||||
{
|
||||
modelRegistry.putObject( location, newModel );
|
||||
modelRegistry.put( location, newModel );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,9 +21,6 @@ package appeng.bootstrap.components;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.statemap.IStateMapper;
|
||||
import net.minecraft.client.resources.IReloadableResourceManager;
|
||||
import net.minecraft.client.resources.IResourceManagerReloadListener;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
||||
import appeng.bootstrap.IModelRegistry;
|
||||
@@ -35,24 +32,24 @@ import appeng.bootstrap.IModelRegistry;
|
||||
public class StateMapperComponent implements IModelRegistrationComponent
|
||||
{
|
||||
|
||||
private final Block block;
|
||||
// FIXME private final Block block;
|
||||
|
||||
private final IStateMapper stateMapper;
|
||||
|
||||
public StateMapperComponent( Block block, IStateMapper stateMapper )
|
||||
{
|
||||
this.block = block;
|
||||
this.stateMapper = stateMapper;
|
||||
}
|
||||
// FIXME private final IStateMapper stateMapper;
|
||||
// FIXME
|
||||
// FIXME public StateMapperComponent( Block block, IStateMapper stateMapper )
|
||||
// FIXME {
|
||||
// FIXME this.block = block;
|
||||
// FIXME this.stateMapper = stateMapper;
|
||||
// FIXME }
|
||||
|
||||
@Override
|
||||
public void modelRegistration( Dist dist, IModelRegistry registry )
|
||||
{
|
||||
registry.setCustomStateMapper( this.block, this.stateMapper );
|
||||
if( this.stateMapper instanceof IResourceManagerReloadListener )
|
||||
{
|
||||
( (IReloadableResourceManager) Minecraft.getInstance().getResourceManager() )
|
||||
.registerReloadListener( (IResourceManagerReloadListener) this.stateMapper );
|
||||
}
|
||||
// FIXME registry.setCustomStateMapper( this.block, this.stateMapper );
|
||||
// FIXME if( this.stateMapper instanceof IResourceManagerReloadListener )
|
||||
// FIXME {
|
||||
// FIXME ( (IReloadableResourceManager) Minecraft.getInstance().getResourceManager() )
|
||||
// FIXME .registerReloadListener( (IResourceManagerReloadListener) this.stateMapper );
|
||||
// FIXME }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public class TileEntityComponent implements IPreInitComponent
|
||||
{
|
||||
if( !tileEntityDefinition.isRegistered() )
|
||||
{
|
||||
GameRegistry.registerTileEntity( tileEntityDefinition.getTileEntityClass(), AppEng.MOD_ID + ":" + tileEntityDefinition.getName() );
|
||||
// FIXME GameRegistry.registerTileEntity( tileEntityDefinition.getTileEntityClass(), AppEng.MOD_ID + ":" + tileEntityDefinition.getName() );
|
||||
tileEntityDefinition.setRegistered( true );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,8 +22,6 @@ package appeng.client;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
import appeng.client.render.tesr.InscriberTESR;
|
||||
import appeng.client.render.textures.ParticleTextures;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
@@ -46,12 +44,7 @@ import appeng.api.util.AEColor;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketAssemblerAnimation;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
import appeng.helpers.IMouseWheelItem;
|
||||
import appeng.hooks.TickHandler;
|
||||
import appeng.hooks.TickHandler.PlayerColor;
|
||||
import appeng.server.ServerHelper;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
@@ -213,22 +206,21 @@ public class ClientHelper extends ServerHelper
|
||||
|
||||
private void postPlayerRender( final RenderLivingEvent.Pre p )
|
||||
{
|
||||
final PlayerColor player = TickHandler.INSTANCE.getPlayerColors().get( p.getEntity().getEntityId() );
|
||||
if( player != null )
|
||||
{
|
||||
final AEColor col = player.myColor;
|
||||
|
||||
final float r = 0xff & ( col.mediumVariant >> 16 );
|
||||
final float g = 0xff & ( col.mediumVariant >> 8 );
|
||||
final float b = 0xff & ( col.mediumVariant );
|
||||
// FIXME: This is most certainly not going to work!
|
||||
GlStateManager.color4f( r / 255.0f, g / 255.0f, b / 255.0f, 1.0f );
|
||||
}
|
||||
// FIXME final PlayerColor player = TickHandler.INSTANCE.getPlayerColors().get( p.getEntity().getEntityId() );
|
||||
// FIXME if( player != null )
|
||||
// FIXME {
|
||||
// FIXME final AEColor col = player.myColor;
|
||||
// FIXME final float r = 0xff & ( col.mediumVariant >> 16 );
|
||||
// FIXME final float g = 0xff & ( col.mediumVariant >> 8 );
|
||||
// FIXME final float b = 0xff & ( col.mediumVariant );
|
||||
// FIXME // FIXME: This is most certainly not going to work!
|
||||
// FIXME GlStateManager.color4f( r / 255.0f, g / 255.0f, b / 255.0f, 1.0f );
|
||||
// FIXME }
|
||||
}
|
||||
|
||||
private void spawnAssembler( final World world, final double posX, final double posY, final double posZ, final Object o )
|
||||
{
|
||||
final PacketAssemblerAnimation paa = (PacketAssemblerAnimation) o;
|
||||
// FIXME final PacketAssemblerAnimation paa = (PacketAssemblerAnimation) o;
|
||||
|
||||
// FIXME final AssemblerFX fx = new AssemblerFX( world, posX, posY, posZ, 0.0D, 0.0D, 0.0D, paa.rate, paa.is );
|
||||
// FIXME Minecraft.getInstance().particles.addEffect( fx );
|
||||
@@ -305,15 +297,15 @@ public class ClientHelper extends ServerHelper
|
||||
|
||||
if( mainHand || offHand )
|
||||
{
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance().sendToServer( new PacketValueConfig( "Item", me.getScrollDelta() > 0 ? "WheelUp" : "WheelDown" ) );
|
||||
me.setCanceled( true );
|
||||
}
|
||||
catch( final IOException e )
|
||||
{
|
||||
AELog.debug( e );
|
||||
}
|
||||
// FIXME try
|
||||
// FIXME {
|
||||
// FIXME NetworkHandler.instance().sendToServer( new PacketValueConfig( "Item", me.getScrollDelta() > 0 ? "WheelUp" : "WheelDown" ) );
|
||||
// FIXME me.setCanceled( true );
|
||||
// FIXME }
|
||||
// FIXME catch( final IOException e )
|
||||
// FIXME {
|
||||
// FIXME AELog.debug( e );
|
||||
// FIXME }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -321,8 +313,8 @@ public class ClientHelper extends ServerHelper
|
||||
@SubscribeEvent
|
||||
public void onTextureStitch( final TextureStitchEvent.Pre event )
|
||||
{
|
||||
ParticleTextures.registerSprite( event );
|
||||
InscriberTESR.registerTexture( event );
|
||||
// FIXME ParticleTextures.registerSprite( event );
|
||||
// FIXME InscriberTESR.registerTexture( event );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -331,7 +331,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
|
||||
return false;
|
||||
}
|
||||
|
||||
final CompoundNBT encodedValue = itemStack.getTagCompound();
|
||||
final CompoundNBT encodedValue = itemStack.getTag();
|
||||
|
||||
if( encodedValue == null )
|
||||
{
|
||||
|
||||
@@ -95,7 +95,7 @@ public class FacadeDispatcherBakedModel extends DelegateBakedModel
|
||||
|
||||
ItemStack textureItem = itemFacade.getTextureItem( stack );
|
||||
|
||||
int hash = Objects.hash( textureItem.getItem().getRegistryName(), textureItem.getMetadata(), textureItem.getTagCompound() );
|
||||
int hash = Objects.hash( textureItem.getItem().getRegistryName(), textureItem.getMetadata(), textureItem.getTag() );
|
||||
FacadeBakedItemModel model = FacadeDispatcherBakedModel.this.cache.get( hash );
|
||||
if( model == null )
|
||||
{
|
||||
|
||||
@@ -19,18 +19,32 @@
|
||||
package appeng.client.render.effects;
|
||||
|
||||
|
||||
import appeng.core.AppEng;
|
||||
import net.minecraft.client.particle.IAnimatedSprite;
|
||||
import net.minecraft.client.particle.IParticleFactory;
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.particle.RedstoneParticle;
|
||||
import net.minecraft.particles.BasicParticleType;
|
||||
import net.minecraft.particles.RedstoneParticleData;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class ChargedOreFX extends RedstoneParticle
|
||||
{
|
||||
public static final BasicParticleType TYPE = new BasicParticleType(false);
|
||||
|
||||
public ChargedOreFX( final World w, final double x, final double y, final double z, final float r, final float g, final float b )
|
||||
{
|
||||
super( w, x, y, z, 0.21f, 0.61f, 1.0f );
|
||||
static {
|
||||
TYPE.setRegistryName(AppEng.MOD_ID, "charged_ore_fx");
|
||||
}
|
||||
|
||||
private static final RedstoneParticleData PARTICLE_DATA = new RedstoneParticleData(0.21f, 0.61f, 1.0f, 1.0f);
|
||||
|
||||
private ChargedOreFX(World worldIn, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed, IAnimatedSprite spriteSet) {
|
||||
super(worldIn, x, y, z, xSpeed, ySpeed, zSpeed, PARTICLE_DATA, spriteSet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBrightnessForRender( final float par1 )
|
||||
{
|
||||
@@ -43,4 +57,17 @@ public class ChargedOreFX extends RedstoneParticle
|
||||
}
|
||||
return j1 << 20 | j1 << 4;
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static class Factory implements IParticleFactory<BasicParticleType> {
|
||||
private final IAnimatedSprite spriteSet;
|
||||
|
||||
public Factory(IAnimatedSprite p_i50477_1_) {
|
||||
this.spriteSet = p_i50477_1_;
|
||||
}
|
||||
|
||||
public Particle makeParticle(BasicParticleType typeIn, World worldIn, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) {
|
||||
return new ChargedOreFX(worldIn, x, y, z, xSpeed, ySpeed, zSpeed, this.spriteSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,9 +21,7 @@ package appeng.client.render.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.vecmath.Vector3f;
|
||||
import javax.vecmath.Vector4f;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
@@ -32,9 +30,7 @@ import com.google.common.cache.LoadingCache;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormatElement;
|
||||
@@ -42,8 +38,6 @@ import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraftforge.client.model.pipeline.IVertexConsumer;
|
||||
import net.minecraftforge.client.model.pipeline.QuadGatheringTransformer;
|
||||
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.client.render.FacingToRotation;
|
||||
@@ -143,7 +137,7 @@ public class AutoRotatingModel implements IBakedModel
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads( BlockState state, Direction side, long rand )
|
||||
public List<BakedQuad> getQuads( BlockState state, Direction side, Random rand )
|
||||
{
|
||||
if( !( state instanceof IExtendedBlockState ) )
|
||||
{
|
||||
|
||||
@@ -23,24 +23,24 @@ import java.util.Map;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import net.minecraft.client.renderer.model.IUnbakedModel;
|
||||
import net.minecraft.resources.IResourceManager;
|
||||
import net.minecraft.resources.IResourceManagerReloadListener;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.ICustomModelLoader;
|
||||
import net.minecraftforge.client.model.IModel;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
import net.minecraftforge.client.model.IModelLoader;
|
||||
|
||||
|
||||
/**
|
||||
* Manages built-in models.
|
||||
*/
|
||||
public class BuiltInModelLoader implements ICustomModelLoader
|
||||
public class BuiltInModelLoader implements IModelLoader
|
||||
{
|
||||
|
||||
private final Map<String, IModel> builtInModels;
|
||||
private final Map<String, IUnbakedModel> builtInModels;
|
||||
|
||||
public BuiltInModelLoader( Map<String, IModel> builtInModels )
|
||||
public BuiltInModelLoader( Map<String, IUnbakedModel> builtInModels )
|
||||
{
|
||||
this.builtInModels = ImmutableMap.copyOf( builtInModels );
|
||||
}
|
||||
@@ -48,7 +48,7 @@ public class BuiltInModelLoader implements ICustomModelLoader
|
||||
@Override
|
||||
public boolean accepts( ResourceLocation modelLocation )
|
||||
{
|
||||
if( !modelLocation.getResourceDomain().equals( AppEng.MOD_ID ) )
|
||||
if( !modelLocation.getNamespace().equals( AppEng.MOD_ID ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -32,17 +32,13 @@ import com.google.common.base.Strings;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
|
||||
import appeng.decorative.solid.BlockQuartzGlass;
|
||||
import appeng.decorative.solid.GlassState;
|
||||
|
||||
@@ -184,7 +184,7 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
|
||||
}
|
||||
}
|
||||
|
||||
if( !this.data.hasNoTags() )
|
||||
if( !this.data.isEmpty() )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -374,7 +374,7 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
|
||||
final String name = '=' + Long.toString( inv.which, Character.MAX_RADIX );
|
||||
final CompoundNBT tag = data.getCompoundTag( name );
|
||||
|
||||
if( tag.hasNoTags() )
|
||||
if( tag.isEmpty() )
|
||||
{
|
||||
tag.putLong( "sortBy", inv.sortBy );
|
||||
tag.putString("un", inv.unlocalizedName);
|
||||
|
||||
@@ -21,6 +21,7 @@ package appeng.core;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import appeng.tile.AEBaseTile;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
@@ -319,13 +320,13 @@ public final class AELog
|
||||
* @param pos
|
||||
* @param aeBaseTile
|
||||
*/
|
||||
// FIXME public static void blockUpdate( @Nonnull final BlockPos pos, @Nonnull final AEBaseTile aeBaseTile )
|
||||
// FIXME {
|
||||
// FIXME if( AEConfig.instance().isFeatureEnabled( AEFeature.UPDATE_LOGGING ) )
|
||||
// FIXME {
|
||||
// FIXME info( BLOCK_UPDATE, aeBaseTile.getClass().getName(), pos );
|
||||
// FIXME }
|
||||
// FIXME }
|
||||
public static void blockUpdate( @Nonnull final BlockPos pos, @Nonnull final AEBaseTile aeBaseTile )
|
||||
{
|
||||
if( AEConfig.instance().isFeatureEnabled( AEFeature.UPDATE_LOGGING ) )
|
||||
{
|
||||
info( BLOCK_UPDATE, aeBaseTile.getClass().getName(), pos );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Use to check for an enabled crafting log.
|
||||
|
||||
@@ -22,67 +22,64 @@ package appeng.core;
|
||||
import appeng.api.IAppEngApi;
|
||||
import appeng.api.features.IRegistryContainer;
|
||||
import appeng.api.networking.IGridHelper;
|
||||
import appeng.api.parts.IPartHelper;
|
||||
import appeng.api.storage.IStorageHelper;
|
||||
import appeng.api.util.IClientHelper;
|
||||
import appeng.core.api.ApiClientHelper;
|
||||
import appeng.core.api.ApiGrid;
|
||||
import appeng.core.api.ApiPart;
|
||||
import appeng.core.api.ApiStorage;
|
||||
import appeng.core.features.registries.PartModels;
|
||||
import appeng.core.features.registries.RegistryContainer;
|
||||
|
||||
|
||||
public final class Api implements IAppEngApi
|
||||
{
|
||||
public static final Api INSTANCE = new Api();
|
||||
|
||||
private final ApiPart partHelper;
|
||||
// FIXME private final ApiPart partHelper;
|
||||
|
||||
// private MovableTileRegistry MovableRegistry = new MovableTileRegistry();
|
||||
private final IRegistryContainer registryContainer;
|
||||
private final IStorageHelper storageHelper;
|
||||
private final IGridHelper networkHelper;
|
||||
// FIXME private final IRegistryContainer registryContainer;
|
||||
// FIXME private final IStorageHelper storageHelper;
|
||||
// FIXME private final IGridHelper networkHelper;
|
||||
private final ApiDefinitions definitions;
|
||||
private final IClientHelper client;
|
||||
// FIXME private final IClientHelper client;
|
||||
|
||||
private Api()
|
||||
{
|
||||
this.storageHelper = new ApiStorage();
|
||||
this.networkHelper = new ApiGrid();
|
||||
this.registryContainer = new RegistryContainer();
|
||||
this.partHelper = new ApiPart();
|
||||
this.definitions = new ApiDefinitions( (PartModels) this.registryContainer.partModels() );
|
||||
this.client = new ApiClientHelper();
|
||||
// FIXME this.storageHelper = new ApiStorage();
|
||||
// FIXME this.networkHelper = new ApiGrid();
|
||||
// FIXME this.registryContainer = new RegistryContainer();
|
||||
// FIXME this.partHelper = new ApiPart();
|
||||
PartModels partModels = new PartModels();
|
||||
this.definitions = new ApiDefinitions( partModels /* FIXME (PartModels) this.registryContainer.partModels() */ );
|
||||
// FIXME this.client = new ApiClientHelper();
|
||||
}
|
||||
|
||||
public PartModels getPartModels()
|
||||
{
|
||||
return (PartModels) this.registryContainer.partModels();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRegistryContainer registries()
|
||||
{
|
||||
return this.registryContainer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IStorageHelper storage()
|
||||
{
|
||||
return this.storageHelper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridHelper grid()
|
||||
{
|
||||
return this.networkHelper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiPart partHelper()
|
||||
{
|
||||
return this.partHelper;
|
||||
}
|
||||
// FIXME public PartModels getPartModels()
|
||||
// FIXME {
|
||||
// FIXME return (PartModels) this.registryContainer.partModels();
|
||||
// FIXME }
|
||||
// FIXME
|
||||
// FIXME @Override
|
||||
// FIXME public IRegistryContainer registries()
|
||||
// FIXME {
|
||||
// FIXME return this.registryContainer;
|
||||
// FIXME }
|
||||
// FIXME
|
||||
// FIXME @Override
|
||||
// FIXME public IStorageHelper storage()
|
||||
// FIXME {
|
||||
// FIXME return this.storageHelper;
|
||||
// FIXME }
|
||||
// FIXME
|
||||
// FIXME @Override
|
||||
// FIXME public IGridHelper grid()
|
||||
// FIXME {
|
||||
// FIXME return this.networkHelper;
|
||||
// FIXME }
|
||||
// FIXME
|
||||
// FIXME @Override
|
||||
// FIXME public ApiPart partHelper()
|
||||
// FIXME {
|
||||
// FIXME return this.partHelper;
|
||||
// FIXME }
|
||||
|
||||
@Override
|
||||
public ApiDefinitions definitions()
|
||||
@@ -90,9 +87,35 @@ public final class Api implements IAppEngApi
|
||||
return this.definitions;
|
||||
}
|
||||
|
||||
// FIXME @Override
|
||||
// FIXME public IClientHelper client()
|
||||
// FIXME {
|
||||
// FIXME return this.client;
|
||||
// FIXME }
|
||||
|
||||
// FIXME
|
||||
@Override
|
||||
public IClientHelper client()
|
||||
{
|
||||
return this.client;
|
||||
public IRegistryContainer registries() {
|
||||
return null;
|
||||
}
|
||||
// FIXME
|
||||
@Override
|
||||
public IStorageHelper storage() {
|
||||
return null;
|
||||
}
|
||||
// FIXME
|
||||
@Override
|
||||
public IGridHelper grid() {
|
||||
return null;
|
||||
}
|
||||
// FIXME
|
||||
@Override
|
||||
public IPartHelper partHelper() {
|
||||
return null;
|
||||
}
|
||||
// FIXME
|
||||
@Override
|
||||
public IClientHelper client() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,11 +20,11 @@ package appeng.core;
|
||||
|
||||
|
||||
import appeng.api.definitions.IDefinitions;
|
||||
import appeng.api.definitions.IItems;
|
||||
import appeng.api.definitions.IMaterials;
|
||||
import appeng.api.definitions.IParts;
|
||||
import appeng.bootstrap.FeatureFactory;
|
||||
import appeng.core.api.definitions.ApiBlocks;
|
||||
import appeng.core.api.definitions.ApiItems;
|
||||
import appeng.core.api.definitions.ApiMaterials;
|
||||
import appeng.core.api.definitions.ApiParts;
|
||||
import appeng.core.features.registries.PartModels;
|
||||
|
||||
|
||||
@@ -35,18 +35,18 @@ public final class ApiDefinitions implements IDefinitions
|
||||
{
|
||||
// TODO : Check if this can be final again after the Register part.
|
||||
private ApiBlocks blocks;
|
||||
private ApiItems items;
|
||||
private final ApiMaterials materials;
|
||||
private final ApiParts parts;
|
||||
// private ApiItems items;
|
||||
//private final ApiMaterials materials;
|
||||
//private final ApiParts parts;
|
||||
|
||||
private final FeatureFactory registry = new FeatureFactory();
|
||||
|
||||
public ApiDefinitions( final PartModels partModels )
|
||||
{
|
||||
this.blocks = new ApiBlocks( this.registry, partModels );
|
||||
this.items = new ApiItems( this.registry );
|
||||
this.materials = new ApiMaterials( this.registry );
|
||||
this.parts = new ApiParts( this.registry, partModels );
|
||||
// this.items = new ApiItems( this.registry );
|
||||
//this.materials = new ApiMaterials( this.registry );
|
||||
//this.parts = new ApiParts( this.registry, partModels );
|
||||
}
|
||||
//
|
||||
// public void addBlocks( final PartModels partModels )
|
||||
@@ -61,7 +61,7 @@ public final class ApiDefinitions implements IDefinitions
|
||||
|
||||
public FeatureFactory getRegistry()
|
||||
{
|
||||
return this.registry;
|
||||
return registry;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -71,20 +71,20 @@ public final class ApiDefinitions implements IDefinitions
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiItems items()
|
||||
public IItems items()
|
||||
{
|
||||
return this.items;
|
||||
return null /* FIXME */;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiMaterials materials()
|
||||
public IMaterials materials()
|
||||
{
|
||||
return this.materials;
|
||||
return null /* FIXME */;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiParts parts()
|
||||
public IParts parts()
|
||||
{
|
||||
return this.parts;
|
||||
return null /* FIXME */;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,8 +21,18 @@ package appeng.core;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import appeng.client.ClientHelper;
|
||||
import appeng.server.ServerHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.particles.ParticleType;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.fml.CrashReportExtender;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
@@ -30,6 +40,7 @@ import net.minecraftforge.fml.config.ModConfig;
|
||||
|
||||
import appeng.core.crash.ModCrashEnhancement;
|
||||
import appeng.services.export.ExportConfig;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
|
||||
@Mod(AppEng.MOD_ID)
|
||||
public final class AppEng
|
||||
@@ -65,12 +76,22 @@ public final class AppEng
|
||||
|
||||
ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, AEConfig.CLIENT_SPEC);
|
||||
|
||||
// proxy = DistExecutor.runForDist(() -> ClientHelper::new, () -> ServerHelper::new);
|
||||
proxy = DistExecutor.runForDist(() -> ClientHelper::new, () -> ServerHelper::new);
|
||||
|
||||
CrashReportExtender.registerCrashCallable( new ModCrashEnhancement() );
|
||||
|
||||
//FIXMEthis.registration = new Registration();
|
||||
//FIXMEMinecraftForge.EVENT_BUS.register( this.registration );
|
||||
|
||||
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
Registration registration = new Registration();
|
||||
modEventBus.addGenericListener(Block.class, registration::registerBlocks);
|
||||
modEventBus.addGenericListener(Item.class, registration::registerItems);
|
||||
modEventBus.addGenericListener(EntityType.class, registration::registerEntities);
|
||||
modEventBus.addGenericListener(ParticleType.class, registration::registerParticleTypes);
|
||||
modEventBus.addListener(registration::registerParticleFactories);
|
||||
|
||||
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> modEventBus.addListener(registration::modelRegistryEvent));
|
||||
}
|
||||
|
||||
// @Nonnull
|
||||
|
||||
@@ -27,237 +27,188 @@ import java.util.Set;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import appeng.bootstrap.IModelRegistry;
|
||||
import appeng.bootstrap.components.IEntityRegistrationComponent;
|
||||
import appeng.bootstrap.components.IModelRegistrationComponent;
|
||||
import appeng.client.render.effects.ChargedOreFX;
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.advancements.CriteriaTriggers;
|
||||
import net.minecraft.advancements.ICriterionInstance;
|
||||
import net.minecraft.advancements.ICriterionTrigger;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.renderer.block.statemap.IStateMapper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ItemModelMesher;
|
||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.particles.BasicParticleType;
|
||||
import net.minecraft.particles.ParticleType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.AttachCapabilitiesEvent;
|
||||
import net.minecraftforge.client.event.ParticleFactoryRegisterEvent;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.eventbus.api.GenericEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.loading.FMLEnvironment;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.definitions.IBlocks;
|
||||
import appeng.api.definitions.IItems;
|
||||
import appeng.api.definitions.IParts;
|
||||
import appeng.api.features.IRecipeHandlerRegistry;
|
||||
import appeng.api.features.IRegistryContainer;
|
||||
import appeng.api.features.IWirelessTermHandler;
|
||||
import appeng.api.features.IWorldGen.WorldGenType;
|
||||
import appeng.api.movable.IMovableRegistry;
|
||||
import appeng.api.networking.IGridCacheRegistry;
|
||||
import appeng.api.networking.crafting.ICraftingGrid;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.networking.pathing.IPathingGrid;
|
||||
import appeng.api.networking.security.ISecurityGrid;
|
||||
import appeng.api.networking.spatial.ISpatialCache;
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.networking.ticking.ITickManager;
|
||||
import appeng.bootstrap.ICriterionTriggerRegistry;
|
||||
import appeng.bootstrap.IModelRegistry;
|
||||
import appeng.bootstrap.components.IBlockRegistrationComponent;
|
||||
import appeng.bootstrap.components.IEntityRegistrationComponent;
|
||||
import appeng.bootstrap.components.IInitComponent;
|
||||
import appeng.bootstrap.components.IItemRegistrationComponent;
|
||||
import appeng.bootstrap.components.IModelRegistrationComponent;
|
||||
import appeng.bootstrap.components.IPostInitComponent;
|
||||
import appeng.bootstrap.components.IPreInitComponent;
|
||||
import appeng.bootstrap.components.IRecipeRegistrationComponent;
|
||||
import appeng.capabilities.Capabilities;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.registries.P2PTunnelRegistry;
|
||||
import appeng.core.features.registries.cell.BasicCellHandler;
|
||||
import appeng.core.features.registries.cell.BasicItemCellGuiHandler;
|
||||
import appeng.core.features.registries.cell.CreativeCellHandler;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.localization.PlayerMessages;
|
||||
import appeng.core.stats.AdvancementTriggers;
|
||||
import appeng.core.stats.PartItemPredicate;
|
||||
import appeng.core.stats.Stats;
|
||||
import appeng.core.worlddata.SpatialDimensionManager;
|
||||
import appeng.fluids.registries.BasicFluidCellGuiHandler;
|
||||
import appeng.hooks.TickHandler;
|
||||
import appeng.items.parts.ItemFacade;
|
||||
import appeng.me.cache.CraftingGridCache;
|
||||
import appeng.me.cache.EnergyGridCache;
|
||||
import appeng.me.cache.GridStorageCache;
|
||||
import appeng.me.cache.P2PCache;
|
||||
import appeng.me.cache.PathGridCache;
|
||||
import appeng.me.cache.SecurityCache;
|
||||
import appeng.me.cache.SpatialPylonCache;
|
||||
import appeng.me.cache.TickManagerCache;
|
||||
import appeng.parts.PartPlacement;
|
||||
import appeng.recipes.AEItemResolver;
|
||||
import appeng.recipes.AERecipeLoader;
|
||||
import appeng.recipes.game.DisassembleRecipe;
|
||||
import appeng.recipes.game.FacadeRecipe;
|
||||
import appeng.recipes.ores.OreDictionaryHandler;
|
||||
import appeng.spatial.BiomeGenStorage;
|
||||
import appeng.spatial.StorageWorldProvider;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.worldgen.MeteoriteWorldGen;
|
||||
import appeng.worldgen.QuartzWorldGen;
|
||||
|
||||
|
||||
final class Registration
|
||||
{
|
||||
DimensionType storageDimensionType;
|
||||
int storageDimensionID;
|
||||
Biome storageBiome;
|
||||
AdvancementTriggers advancementTriggers;
|
||||
|
||||
void preInitialize( final FMLPreInitializationEvent event )
|
||||
{
|
||||
Capabilities.register();
|
||||
|
||||
final Api api = Api.INSTANCE;
|
||||
final IRecipeHandlerRegistry recipeRegistry = api.registries().recipes();
|
||||
this.registerCraftHandlers( recipeRegistry );
|
||||
|
||||
MinecraftForge.EVENT_BUS.register( OreDictionaryHandler.INSTANCE );
|
||||
|
||||
ApiDefinitions definitions = api.definitions();
|
||||
|
||||
// Register
|
||||
definitions.getRegistry().getBootstrapComponents( IPreInitComponent.class ).forEachRemaining( b -> b.preInitialize( event.getSide() ) );
|
||||
}
|
||||
|
||||
private void registerSpatialBiome( IForgeRegistry<Biome> registry )
|
||||
{
|
||||
if( !AEConfig.instance().isFeatureEnabled( AEFeature.SPATIAL_IO ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( this.storageBiome == null )
|
||||
{
|
||||
this.storageBiome = new BiomeGenStorage();
|
||||
}
|
||||
registry.register( this.storageBiome.setRegistryName( "appliedenergistics2:storage_biome" ) );
|
||||
}
|
||||
|
||||
private void registerSpatialDimension()
|
||||
{
|
||||
final AEConfig config = AEConfig.instance();
|
||||
if( !config.isFeatureEnabled( AEFeature.SPATIAL_IO ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if( config.getStorageProviderID() == -1 )
|
||||
{
|
||||
final Set<Integer> ids = new HashSet<>();
|
||||
for( DimensionType type : DimensionType.values() )
|
||||
{
|
||||
ids.add( type.getId() );
|
||||
}
|
||||
|
||||
int newId = -11;
|
||||
while( ids.contains( newId ) )
|
||||
{
|
||||
--newId;
|
||||
}
|
||||
config.setStorageProviderID( newId );
|
||||
config.save();
|
||||
}
|
||||
|
||||
this.storageDimensionType = DimensionType.register( "Storage Cell", "_cell", config.getStorageProviderID(), StorageWorldProvider.class, true );
|
||||
|
||||
if( config.getStorageDimensionID() == -1 )
|
||||
{
|
||||
config.setStorageDimensionID( DimensionManager.getNextFreeDimId() );
|
||||
config.save();
|
||||
}
|
||||
this.storageDimensionID = config.getStorageDimensionID();
|
||||
|
||||
DimensionManager.registerDimension( this.storageDimensionID, this.storageDimensionType );
|
||||
}
|
||||
|
||||
private void registerCraftHandlers( final IRecipeHandlerRegistry registry )
|
||||
{
|
||||
registry.addNewSubItemResolver( new AEItemResolver() );
|
||||
}
|
||||
|
||||
public void initialize( @Nonnull final FMLInitializationEvent event, @Nonnull final File recipeDirectory )
|
||||
{
|
||||
Preconditions.checkNotNull( event );
|
||||
Preconditions.checkNotNull( recipeDirectory );
|
||||
Preconditions.checkArgument( !recipeDirectory.isFile() );
|
||||
|
||||
final Api api = Api.INSTANCE;
|
||||
final IRegistryContainer registries = api.registries();
|
||||
|
||||
ApiDefinitions definitions = api.definitions();
|
||||
definitions.getRegistry().getBootstrapComponents( IInitComponent.class ).forEachRemaining( b -> b.initialize( event.getSide() ) );
|
||||
|
||||
MinecraftForge.EVENT_BUS.register( TickHandler.INSTANCE );
|
||||
|
||||
MinecraftForge.EVENT_BUS.register( new PartPlacement() );
|
||||
|
||||
final IGridCacheRegistry gcr = registries.gridCache();
|
||||
gcr.registerGridCache( ITickManager.class, TickManagerCache.class );
|
||||
gcr.registerGridCache( IEnergyGrid.class, EnergyGridCache.class );
|
||||
gcr.registerGridCache( IPathingGrid.class, PathGridCache.class );
|
||||
gcr.registerGridCache( IStorageGrid.class, GridStorageCache.class );
|
||||
gcr.registerGridCache( P2PCache.class, P2PCache.class );
|
||||
gcr.registerGridCache( ISpatialCache.class, SpatialPylonCache.class );
|
||||
gcr.registerGridCache( ISecurityGrid.class, SecurityCache.class );
|
||||
gcr.registerGridCache( ICraftingGrid.class, CraftingGridCache.class );
|
||||
|
||||
registries.cell().addCellHandler( new BasicCellHandler() );
|
||||
registries.cell().addCellHandler( new CreativeCellHandler() );
|
||||
registries.cell().addCellGuiHandler( new BasicItemCellGuiHandler() );
|
||||
registries.cell().addCellGuiHandler( new BasicFluidCellGuiHandler() );
|
||||
|
||||
api.definitions().materials().matterBall().maybeStack( 1 ).ifPresent( ammoStack ->
|
||||
{
|
||||
final double weight = 32;
|
||||
|
||||
registries.matterCannon().registerAmmo( ammoStack, weight );
|
||||
} );
|
||||
|
||||
PartItemPredicate.register();
|
||||
Stats.register();
|
||||
this.advancementTriggers = new AdvancementTriggers( new CriterionTrigggerRegistry() );
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void registerBiomes( RegistryEvent.Register<Biome> event )
|
||||
{
|
||||
final IForgeRegistry<Biome> registry = event.getRegistry();
|
||||
this.registerSpatialBiome( registry );
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
// DimensionType storageDimensionType;
|
||||
// int storageDimensionID;
|
||||
// Biome storageBiome;
|
||||
// AdvancementTriggers advancementTriggers;
|
||||
//
|
||||
// void preInitialize( final FMLPreInitializationEvent event )
|
||||
// {
|
||||
// Capabilities.register();
|
||||
//
|
||||
// final Api api = Api.INSTANCE;
|
||||
// final IRecipeHandlerRegistry recipeRegistry = api.registries().recipes();
|
||||
// this.registerCraftHandlers( recipeRegistry );
|
||||
//
|
||||
// MinecraftForge.EVENT_BUS.register( OreDictionaryHandler.INSTANCE );
|
||||
//
|
||||
// ApiDefinitions definitions = api.definitions();
|
||||
//
|
||||
// // Register
|
||||
// definitions.getRegistry().getBootstrapComponents( IPreInitComponent.class ).forEachRemaining( b -> b.preInitialize( event.getSide() ) );
|
||||
// }
|
||||
//
|
||||
// private void registerSpatialBiome( IForgeRegistry<Biome> registry )
|
||||
// {
|
||||
// if( !AEConfig.instance().isFeatureEnabled( AEFeature.SPATIAL_IO ) )
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if( this.storageBiome == null )
|
||||
// {
|
||||
// this.storageBiome = new BiomeGenStorage();
|
||||
// }
|
||||
// registry.register( this.storageBiome.setRegistryName( "appliedenergistics2:storage_biome" ) );
|
||||
// }
|
||||
//
|
||||
// private void registerSpatialDimension()
|
||||
// {
|
||||
// final AEConfig config = AEConfig.instance();
|
||||
// if( !config.isFeatureEnabled( AEFeature.SPATIAL_IO ) )
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if( config.getStorageProviderID() == -1 )
|
||||
// {
|
||||
// final Set<Integer> ids = new HashSet<>();
|
||||
// for( DimensionType type : DimensionType.values() )
|
||||
// {
|
||||
// ids.add( type.getId() );
|
||||
// }
|
||||
//
|
||||
// int newId = -11;
|
||||
// while( ids.contains( newId ) )
|
||||
// {
|
||||
// --newId;
|
||||
// }
|
||||
// config.setStorageProviderID( newId );
|
||||
// config.save();
|
||||
// }
|
||||
//
|
||||
// this.storageDimensionType = DimensionType.register( "Storage Cell", "_cell", config.getStorageProviderID(), StorageWorldProvider.class, true );
|
||||
//
|
||||
// if( config.getStorageDimensionID() == -1 )
|
||||
// {
|
||||
// config.setStorageDimensionID( DimensionManager.getNextFreeDimId() );
|
||||
// config.save();
|
||||
// }
|
||||
// this.storageDimensionID = config.getStorageDimensionID();
|
||||
//
|
||||
// DimensionManager.registerDimension( this.storageDimensionID, this.storageDimensionType );
|
||||
// }
|
||||
//
|
||||
// private void registerCraftHandlers( final IRecipeHandlerRegistry registry )
|
||||
// {
|
||||
// registry.addNewSubItemResolver( new AEItemResolver() );
|
||||
// }
|
||||
//
|
||||
// public void initialize( @Nonnull final FMLInitializationEvent event, @Nonnull final File recipeDirectory )
|
||||
// {
|
||||
// Preconditions.checkNotNull( event );
|
||||
// Preconditions.checkNotNull( recipeDirectory );
|
||||
// Preconditions.checkArgument( !recipeDirectory.isFile() );
|
||||
//
|
||||
// final Api api = Api.INSTANCE;
|
||||
// final IRegistryContainer registries = api.registries();
|
||||
//
|
||||
// ApiDefinitions definitions = api.definitions();
|
||||
// definitions.getRegistry().getBootstrapComponents( IInitComponent.class ).forEachRemaining( b -> b.initialize( event.getSide() ) );
|
||||
//
|
||||
// MinecraftForge.EVENT_BUS.register( TickHandler.INSTANCE );
|
||||
//
|
||||
// MinecraftForge.EVENT_BUS.register( new PartPlacement() );
|
||||
//
|
||||
// final IGridCacheRegistry gcr = registries.gridCache();
|
||||
// gcr.registerGridCache( ITickManager.class, TickManagerCache.class );
|
||||
// gcr.registerGridCache( IEnergyGrid.class, EnergyGridCache.class );
|
||||
// gcr.registerGridCache( IPathingGrid.class, PathGridCache.class );
|
||||
// gcr.registerGridCache( IStorageGrid.class, GridStorageCache.class );
|
||||
// gcr.registerGridCache( P2PCache.class, P2PCache.class );
|
||||
// gcr.registerGridCache( ISpatialCache.class, SpatialPylonCache.class );
|
||||
// gcr.registerGridCache( ISecurityGrid.class, SecurityCache.class );
|
||||
// gcr.registerGridCache( ICraftingGrid.class, CraftingGridCache.class );
|
||||
//
|
||||
// registries.cell().addCellHandler( new BasicCellHandler() );
|
||||
// registries.cell().addCellHandler( new CreativeCellHandler() );
|
||||
// registries.cell().addCellGuiHandler( new BasicItemCellGuiHandler() );
|
||||
// registries.cell().addCellGuiHandler( new BasicFluidCellGuiHandler() );
|
||||
//
|
||||
// api.definitions().materials().matterBall().maybeStack( 1 ).ifPresent( ammoStack ->
|
||||
// {
|
||||
// final double weight = 32;
|
||||
//
|
||||
// registries.matterCannon().registerAmmo( ammoStack, weight );
|
||||
// } );
|
||||
//
|
||||
// PartItemPredicate.register();
|
||||
// Stats.register();
|
||||
// this.advancementTriggers = new AdvancementTriggers( new CriterionTrigggerRegistry() );
|
||||
// }
|
||||
//
|
||||
// @SubscribeEvent
|
||||
// public void registerBiomes( RegistryEvent.Register<Biome> event )
|
||||
// {
|
||||
// final IForgeRegistry<Biome> registry = event.getRegistry();
|
||||
// this.registerSpatialBiome( registry );
|
||||
// }
|
||||
//
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void modelRegistryEvent( ModelRegistryEvent event )
|
||||
{
|
||||
final ApiDefinitions definitions = Api.INSTANCE.definitions();
|
||||
final IModelRegistry registry = new ModelLoaderWrapper();
|
||||
final IModelRegistry registry = new IModelRegistry() {
|
||||
@Override
|
||||
public void registerItemVariants(Item item, ResourceLocation... names) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomModelResourceLocation(Item item, int metadata, ModelResourceLocation model) {
|
||||
// TODO: this does not actually work
|
||||
ItemModelMesher mesher = Minecraft.getInstance().getItemRenderer().getItemModelMesher();
|
||||
mesher.register(item, model);
|
||||
}
|
||||
};
|
||||
final Dist dist = FMLEnvironment.dist;
|
||||
definitions.getRegistry().getBootstrapComponents( IModelRegistrationComponent.class ).forEachRemaining( b -> b.modelRegistration( dist, registry ) );
|
||||
definitions.getRegistry().getBootstrapComponents( IModelRegistrationComponent.class ).forEachRemaining(b -> b.modelRegistration( dist, registry ) );
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void registerBlocks( RegistryEvent.Register<Block> event )
|
||||
{
|
||||
final IForgeRegistry<Block> registry = event.getRegistry();
|
||||
@@ -266,7 +217,6 @@ final class Registration
|
||||
definitions.getRegistry().getBootstrapComponents( IBlockRegistrationComponent.class ).forEachRemaining( b -> b.blockRegistration( dist, registry ) );
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void registerItems( RegistryEvent.Register<Item> event )
|
||||
{
|
||||
final IForgeRegistry<Item> registry = event.getRegistry();
|
||||
@@ -275,289 +225,300 @@ final class Registration
|
||||
definitions.getRegistry().getBootstrapComponents( IItemRegistrationComponent.class ).forEachRemaining( b -> b.itemRegistration( dist, registry ) );
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void registerRecipes( RegistryEvent.Register<IRecipe> event )
|
||||
// @SubscribeEvent
|
||||
// public void registerRecipes( RegistryEvent.Register<IRecipe> event )
|
||||
// {
|
||||
// final IForgeRegistry<IRecipe> registry = event.getRegistry();
|
||||
//
|
||||
// final Api api = Api.INSTANCE;
|
||||
// final ApiDefinitions definitions = api.definitions();
|
||||
// final Dist dist = FMLCommonHandler.instance().getEffectiveSide();
|
||||
//
|
||||
// if( AEConfig.instance().isFeatureEnabled( AEFeature.ENABLE_DISASSEMBLY_CRAFTING ) )
|
||||
// {
|
||||
// DisassembleRecipe r = new DisassembleRecipe();
|
||||
// registry.register( r.setRegistryName( AppEng.MOD_ID.toLowerCase(), "disassemble" ) );
|
||||
// }
|
||||
//
|
||||
// if( AEConfig.instance().isFeatureEnabled( AEFeature.ENABLE_FACADE_CRAFTING ) )
|
||||
// {
|
||||
// definitions.items().facade().maybeItem().ifPresent( facadeItem ->
|
||||
// {
|
||||
// FacadeRecipe f = new FacadeRecipe( (ItemFacade) facadeItem );
|
||||
// registry.register( f.setRegistryName( AppEng.MOD_ID.toLowerCase(), "facade" ) );
|
||||
// } );
|
||||
// }
|
||||
//
|
||||
// definitions.getRegistry().getBootstrapComponents( IRecipeRegistrationComponent.class ).forEachRemaining( b -> b.recipeRegistration( side, registry ) );
|
||||
//
|
||||
// final AERecipeLoader ldr = new AERecipeLoader();
|
||||
// ldr.loadProcessingRecipes();
|
||||
// }
|
||||
|
||||
|
||||
public void registerEntities( RegistryEvent.Register<EntityType<?>> event )
|
||||
{
|
||||
final IForgeRegistry<IRecipe> registry = event.getRegistry();
|
||||
|
||||
final Api api = Api.INSTANCE;
|
||||
final ApiDefinitions definitions = api.definitions();
|
||||
final Dist dist = FMLCommonHandler.instance().getEffectiveSide();
|
||||
|
||||
if( AEConfig.instance().isFeatureEnabled( AEFeature.ENABLE_DISASSEMBLY_CRAFTING ) )
|
||||
{
|
||||
DisassembleRecipe r = new DisassembleRecipe();
|
||||
registry.register( r.setRegistryName( AppEng.MOD_ID.toLowerCase(), "disassemble" ) );
|
||||
}
|
||||
|
||||
if( AEConfig.instance().isFeatureEnabled( AEFeature.ENABLE_FACADE_CRAFTING ) )
|
||||
{
|
||||
definitions.items().facade().maybeItem().ifPresent( facadeItem ->
|
||||
{
|
||||
FacadeRecipe f = new FacadeRecipe( (ItemFacade) facadeItem );
|
||||
registry.register( f.setRegistryName( AppEng.MOD_ID.toLowerCase(), "facade" ) );
|
||||
} );
|
||||
}
|
||||
|
||||
definitions.getRegistry().getBootstrapComponents( IRecipeRegistrationComponent.class ).forEachRemaining( b -> b.recipeRegistration( side, registry ) );
|
||||
|
||||
final AERecipeLoader ldr = new AERecipeLoader();
|
||||
ldr.loadProcessingRecipes();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void registerEntities( RegistryEvent.Register<EntityEntry> event )
|
||||
{
|
||||
final IForgeRegistry<EntityEntry> registry = event.getRegistry();
|
||||
final IForgeRegistry<EntityType<?>> registry = event.getRegistry();
|
||||
final ApiDefinitions definitions = Api.INSTANCE.definitions();
|
||||
definitions.getRegistry().getBootstrapComponents( IEntityRegistrationComponent.class ).forEachRemaining( b -> b.entityRegistration( registry ) );
|
||||
definitions.getRegistry().getBootstrapComponents( IEntityRegistrationComponent.class ).forEachRemaining(b -> b.entityRegistration( registry ) );
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void attachSpatialDimensionManager( AttachCapabilitiesEvent<World> event )
|
||||
public void registerParticleTypes( RegistryEvent.Register<ParticleType<?>> event )
|
||||
{
|
||||
if( AEConfig.instance()
|
||||
.isFeatureEnabled( AEFeature.SPATIAL_IO ) && event.getObject() == DimensionManager.getWorld( AEConfig.instance().getStorageDimensionID() ) )
|
||||
{
|
||||
event.addCapability( new ResourceLocation( "appliedenergistics2:spatial_dimension_manager" ), new SpatialDimensionManager( event.getObject() ) );
|
||||
}
|
||||
final IForgeRegistry<ParticleType<?>> registry = event.getRegistry();
|
||||
registry.register(ChargedOreFX.TYPE);
|
||||
}
|
||||
|
||||
void postInit( final FMLPostInitializationEvent event )
|
||||
{
|
||||
final IRegistryContainer registries = Api.INSTANCE.registries();
|
||||
ApiDefinitions definitions = Api.INSTANCE.definitions();
|
||||
final IParts parts = definitions.parts();
|
||||
final IBlocks blocks = definitions.blocks();
|
||||
final IItems items = definitions.items();
|
||||
|
||||
this.registerSpatialDimension();
|
||||
|
||||
// default settings..
|
||||
( (P2PTunnelRegistry) registries.p2pTunnel() ).configure();
|
||||
|
||||
// add to localization..
|
||||
PlayerMessages.values();
|
||||
GuiText.values();
|
||||
|
||||
definitions.getRegistry().getBootstrapComponents( IPostInitComponent.class ).forEachRemaining( b -> b.postInitialize( event.getSide() ) );
|
||||
|
||||
// Interface
|
||||
Upgrades.CRAFTING.registerItem( parts.iface(), 1 );
|
||||
Upgrades.CRAFTING.registerItem( blocks.iface(), 1 );
|
||||
|
||||
// IO Port!
|
||||
Upgrades.SPEED.registerItem( blocks.iOPort(), 3 );
|
||||
Upgrades.REDSTONE.registerItem( blocks.iOPort(), 1 );
|
||||
|
||||
// Level Emitter!
|
||||
Upgrades.FUZZY.registerItem( parts.levelEmitter(), 1 );
|
||||
Upgrades.CRAFTING.registerItem( parts.levelEmitter(), 1 );
|
||||
|
||||
// Import Bus
|
||||
Upgrades.FUZZY.registerItem( parts.importBus(), 1 );
|
||||
Upgrades.REDSTONE.registerItem( parts.importBus(), 1 );
|
||||
Upgrades.CAPACITY.registerItem( parts.importBus(), 2 );
|
||||
Upgrades.SPEED.registerItem( parts.importBus(), 4 );
|
||||
|
||||
// Fluid Import Bus
|
||||
Upgrades.CAPACITY.registerItem( parts.fluidImportBus(), 2 );
|
||||
Upgrades.REDSTONE.registerItem( parts.fluidImportBus(), 1 );
|
||||
Upgrades.SPEED.registerItem( parts.fluidImportBus(), 4 );
|
||||
|
||||
// Export Bus
|
||||
Upgrades.FUZZY.registerItem( parts.exportBus(), 1 );
|
||||
Upgrades.REDSTONE.registerItem( parts.exportBus(), 1 );
|
||||
Upgrades.CAPACITY.registerItem( parts.exportBus(), 2 );
|
||||
Upgrades.SPEED.registerItem( parts.exportBus(), 4 );
|
||||
Upgrades.CRAFTING.registerItem( parts.exportBus(), 1 );
|
||||
|
||||
// Fluid Export Bus
|
||||
Upgrades.CAPACITY.registerItem( parts.fluidExportBus(), 2 );
|
||||
Upgrades.REDSTONE.registerItem( parts.fluidExportBus(), 1 );
|
||||
Upgrades.SPEED.registerItem( parts.fluidExportBus(), 4 );
|
||||
|
||||
// Storage Cells
|
||||
Upgrades.FUZZY.registerItem( items.cell1k(), 1 );
|
||||
Upgrades.INVERTER.registerItem( items.cell1k(), 1 );
|
||||
|
||||
Upgrades.FUZZY.registerItem( items.cell4k(), 1 );
|
||||
Upgrades.INVERTER.registerItem( items.cell4k(), 1 );
|
||||
|
||||
Upgrades.FUZZY.registerItem( items.cell16k(), 1 );
|
||||
Upgrades.INVERTER.registerItem( items.cell16k(), 1 );
|
||||
|
||||
Upgrades.FUZZY.registerItem( items.cell64k(), 1 );
|
||||
Upgrades.INVERTER.registerItem( items.cell64k(), 1 );
|
||||
|
||||
Upgrades.FUZZY.registerItem( items.portableCell(), 1 );
|
||||
Upgrades.INVERTER.registerItem( items.portableCell(), 1 );
|
||||
|
||||
Upgrades.FUZZY.registerItem( items.viewCell(), 1 );
|
||||
Upgrades.INVERTER.registerItem( items.viewCell(), 1 );
|
||||
|
||||
// Storage Bus
|
||||
Upgrades.FUZZY.registerItem( parts.storageBus(), 1 );
|
||||
Upgrades.INVERTER.registerItem( parts.storageBus(), 1 );
|
||||
Upgrades.CAPACITY.registerItem( parts.storageBus(), 5 );
|
||||
|
||||
// Storage Bus Fluids
|
||||
Upgrades.INVERTER.registerItem( parts.fluidStorageBus(), 1 );
|
||||
Upgrades.CAPACITY.registerItem( parts.fluidStorageBus(), 5 );
|
||||
|
||||
// Formation Plane
|
||||
Upgrades.FUZZY.registerItem( parts.formationPlane(), 1 );
|
||||
Upgrades.INVERTER.registerItem( parts.formationPlane(), 1 );
|
||||
Upgrades.CAPACITY.registerItem( parts.formationPlane(), 5 );
|
||||
|
||||
// Matter Cannon
|
||||
Upgrades.FUZZY.registerItem( items.massCannon(), 1 );
|
||||
Upgrades.INVERTER.registerItem( items.massCannon(), 1 );
|
||||
Upgrades.SPEED.registerItem( items.massCannon(), 4 );
|
||||
|
||||
// Molecular Assembler
|
||||
Upgrades.SPEED.registerItem( blocks.molecularAssembler(), 5 );
|
||||
|
||||
// Inscriber
|
||||
Upgrades.SPEED.registerItem( blocks.inscriber(), 3 );
|
||||
|
||||
// Wireless Terminal Handler
|
||||
items.wirelessTerminal().maybeItem().ifPresent( terminal -> registries.wireless().registerWirelessHandler( (IWirelessTermHandler) terminal ) );
|
||||
|
||||
// Charge Rates
|
||||
items.chargedStaff().maybeItem().ifPresent( chargedStaff -> registries.charger().addChargeRate( chargedStaff, 320d ) );
|
||||
items.portableCell().maybeItem().ifPresent( chargedStaff -> registries.charger().addChargeRate( chargedStaff, 800d ) );
|
||||
items.colorApplicator().maybeItem().ifPresent( colorApplicator -> registries.charger().addChargeRate( colorApplicator, 800d ) );
|
||||
items.wirelessTerminal().maybeItem().ifPresent( terminal -> registries.charger().addChargeRate( terminal, 8000d ) );
|
||||
items.entropyManipulator().maybeItem().ifPresent( entropyManipulator -> registries.charger().addChargeRate( entropyManipulator, 8000d ) );
|
||||
items.massCannon().maybeItem().ifPresent( massCannon -> registries.charger().addChargeRate( massCannon, 8000d ) );
|
||||
blocks.energyCell().maybeItem().ifPresent( cell -> registries.charger().addChargeRate( cell, 8000d ) );
|
||||
blocks.energyCellDense().maybeItem().ifPresent( cell -> registries.charger().addChargeRate( cell, 16000d ) );
|
||||
|
||||
// add villager trading to black smiths for a few basic materials
|
||||
if( AEConfig.instance().isFeatureEnabled( AEFeature.VILLAGER_TRADING ) )
|
||||
{
|
||||
// TODO: VILLAGER TRADING
|
||||
// VillagerRegistry.instance().getRegisteredVillagers().registerVillageTradeHandler( 3, new AETrading() );
|
||||
}
|
||||
|
||||
if( AEConfig.instance().isFeatureEnabled( AEFeature.CERTUS_QUARTZ_WORLD_GEN ) )
|
||||
{
|
||||
GameRegistry.registerWorldGenerator( new QuartzWorldGen(), 0 );
|
||||
}
|
||||
|
||||
if( AEConfig.instance().isFeatureEnabled( AEFeature.METEORITE_WORLD_GEN ) )
|
||||
{
|
||||
GameRegistry.registerWorldGenerator( new MeteoriteWorldGen(), 0 );
|
||||
}
|
||||
|
||||
final IMovableRegistry mr = registries.movable();
|
||||
|
||||
/*
|
||||
* You can't move bed rock.
|
||||
*/
|
||||
mr.blacklistBlock( net.minecraft.block.Blocks.BEDROCK );
|
||||
|
||||
/*
|
||||
* White List Vanilla...
|
||||
*/
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.BannerTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.BeaconTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.BrewingStandTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.ChestTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.CommandBlockTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.ComparatorTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.DaylightDetectorTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.DispenserTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.DropperTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.EnchantingTableTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.EnderChestTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.EndPortalTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.FurnaceTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.HopperTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.MobSpawnerTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.PistonTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.ShulkerBoxTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.SignTileEntity.class );
|
||||
mr.whiteListTileEntity( net.minecraft.tileentity.SkullTileEntity.class );
|
||||
|
||||
/*
|
||||
* Whitelist AE2
|
||||
*/
|
||||
mr.whiteListTileEntity( AEBaseTile.class );
|
||||
|
||||
/*
|
||||
* world gen
|
||||
*/
|
||||
for( final WorldGenType type : WorldGenType.values() )
|
||||
{
|
||||
registries.worldgen().disableWorldGenForProviderID( type, StorageWorldProvider.class );
|
||||
|
||||
// nether
|
||||
registries.worldgen().disableWorldGenForDimension( type, -1 );
|
||||
|
||||
// end
|
||||
registries.worldgen().disableWorldGenForDimension( type, 1 );
|
||||
}
|
||||
|
||||
// whitelist from config
|
||||
for( final int dimension : AEConfig.instance().getMeteoriteDimensionWhitelist() )
|
||||
{
|
||||
registries.worldgen().enableWorldGenForDimension( WorldGenType.METEORITES, dimension );
|
||||
}
|
||||
public void registerParticleFactories(ParticleFactoryRegisterEvent evt) {
|
||||
Minecraft.getInstance().particles.registerFactory(ChargedOreFX.TYPE, ChargedOreFX.Factory::new);
|
||||
}
|
||||
|
||||
private static class ModelLoaderWrapper implements IModelRegistry
|
||||
{
|
||||
|
||||
@Override
|
||||
public void registerItemVariants( Item item, ResourceLocation... names )
|
||||
{
|
||||
ModelLoader.registerItemVariants( item, names );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomModelResourceLocation( Item item, int metadata, ModelResourceLocation model )
|
||||
{
|
||||
ModelLoader.setCustomModelResourceLocation( item, metadata, model );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomMeshDefinition( Item item, ItemMeshDefinition meshDefinition )
|
||||
{
|
||||
ModelLoader.setCustomMeshDefinition( item, meshDefinition );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomStateMapper( Block block, IStateMapper mapper )
|
||||
{
|
||||
ModelLoader.setCustomStateMapper( block, mapper );
|
||||
}
|
||||
}
|
||||
|
||||
private static class CriterionTrigggerRegistry implements ICriterionTriggerRegistry
|
||||
{
|
||||
private Method method;
|
||||
|
||||
CriterionTrigggerRegistry()
|
||||
{
|
||||
this.method = ReflectionHelper.findMethod( CriteriaTriggers.class, "register", "func_192118_a", ICriterionTrigger.class );
|
||||
this.method.setAccessible( true );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register( ICriterionTrigger<? extends ICriterionInstance> trigger )
|
||||
{
|
||||
try
|
||||
{
|
||||
this.method.invoke( null, trigger );
|
||||
}
|
||||
catch( IllegalAccessException | IllegalArgumentException | InvocationTargetException e )
|
||||
{
|
||||
AELog.debug( e );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//
|
||||
// @SubscribeEvent
|
||||
// public void attachSpatialDimensionManager( AttachCapabilitiesEvent<World> event )
|
||||
// {
|
||||
// if( AEConfig.instance()
|
||||
// .isFeatureEnabled( AEFeature.SPATIAL_IO ) && event.getObject() == DimensionManager.getWorld( AEConfig.instance().getStorageDimensionID() ) )
|
||||
// {
|
||||
// event.addCapability( new ResourceLocation( "appliedenergistics2:spatial_dimension_manager" ), new SpatialDimensionManager( event.getObject() ) );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// void postInit( final FMLPostInitializationEvent event )
|
||||
// {
|
||||
// final IRegistryContainer registries = Api.INSTANCE.registries();
|
||||
// ApiDefinitions definitions = Api.INSTANCE.definitions();
|
||||
// final IParts parts = definitions.parts();
|
||||
// final IBlocks blocks = definitions.blocks();
|
||||
// final IItems items = definitions.items();
|
||||
//
|
||||
// this.registerSpatialDimension();
|
||||
//
|
||||
// // default settings..
|
||||
// ( (P2PTunnelRegistry) registries.p2pTunnel() ).configure();
|
||||
//
|
||||
// // add to localization..
|
||||
// PlayerMessages.values();
|
||||
// GuiText.values();
|
||||
//
|
||||
// definitions.getRegistry().getBootstrapComponents( IPostInitComponent.class ).forEachRemaining( b -> b.postInitialize( event.getSide() ) );
|
||||
//
|
||||
// // Interface
|
||||
// Upgrades.CRAFTING.registerItem( parts.iface(), 1 );
|
||||
// Upgrades.CRAFTING.registerItem( blocks.iface(), 1 );
|
||||
//
|
||||
// // IO Port!
|
||||
// Upgrades.SPEED.registerItem( blocks.iOPort(), 3 );
|
||||
// Upgrades.REDSTONE.registerItem( blocks.iOPort(), 1 );
|
||||
//
|
||||
// // Level Emitter!
|
||||
// Upgrades.FUZZY.registerItem( parts.levelEmitter(), 1 );
|
||||
// Upgrades.CRAFTING.registerItem( parts.levelEmitter(), 1 );
|
||||
//
|
||||
// // Import Bus
|
||||
// Upgrades.FUZZY.registerItem( parts.importBus(), 1 );
|
||||
// Upgrades.REDSTONE.registerItem( parts.importBus(), 1 );
|
||||
// Upgrades.CAPACITY.registerItem( parts.importBus(), 2 );
|
||||
// Upgrades.SPEED.registerItem( parts.importBus(), 4 );
|
||||
//
|
||||
// // Fluid Import Bus
|
||||
// Upgrades.CAPACITY.registerItem( parts.fluidImportBus(), 2 );
|
||||
// Upgrades.REDSTONE.registerItem( parts.fluidImportBus(), 1 );
|
||||
// Upgrades.SPEED.registerItem( parts.fluidImportBus(), 4 );
|
||||
//
|
||||
// // Export Bus
|
||||
// Upgrades.FUZZY.registerItem( parts.exportBus(), 1 );
|
||||
// Upgrades.REDSTONE.registerItem( parts.exportBus(), 1 );
|
||||
// Upgrades.CAPACITY.registerItem( parts.exportBus(), 2 );
|
||||
// Upgrades.SPEED.registerItem( parts.exportBus(), 4 );
|
||||
// Upgrades.CRAFTING.registerItem( parts.exportBus(), 1 );
|
||||
//
|
||||
// // Fluid Export Bus
|
||||
// Upgrades.CAPACITY.registerItem( parts.fluidExportBus(), 2 );
|
||||
// Upgrades.REDSTONE.registerItem( parts.fluidExportBus(), 1 );
|
||||
// Upgrades.SPEED.registerItem( parts.fluidExportBus(), 4 );
|
||||
//
|
||||
// // Storage Cells
|
||||
// Upgrades.FUZZY.registerItem( items.cell1k(), 1 );
|
||||
// Upgrades.INVERTER.registerItem( items.cell1k(), 1 );
|
||||
//
|
||||
// Upgrades.FUZZY.registerItem( items.cell4k(), 1 );
|
||||
// Upgrades.INVERTER.registerItem( items.cell4k(), 1 );
|
||||
//
|
||||
// Upgrades.FUZZY.registerItem( items.cell16k(), 1 );
|
||||
// Upgrades.INVERTER.registerItem( items.cell16k(), 1 );
|
||||
//
|
||||
// Upgrades.FUZZY.registerItem( items.cell64k(), 1 );
|
||||
// Upgrades.INVERTER.registerItem( items.cell64k(), 1 );
|
||||
//
|
||||
// Upgrades.FUZZY.registerItem( items.portableCell(), 1 );
|
||||
// Upgrades.INVERTER.registerItem( items.portableCell(), 1 );
|
||||
//
|
||||
// Upgrades.FUZZY.registerItem( items.viewCell(), 1 );
|
||||
// Upgrades.INVERTER.registerItem( items.viewCell(), 1 );
|
||||
//
|
||||
// // Storage Bus
|
||||
// Upgrades.FUZZY.registerItem( parts.storageBus(), 1 );
|
||||
// Upgrades.INVERTER.registerItem( parts.storageBus(), 1 );
|
||||
// Upgrades.CAPACITY.registerItem( parts.storageBus(), 5 );
|
||||
//
|
||||
// // Storage Bus Fluids
|
||||
// Upgrades.INVERTER.registerItem( parts.fluidStorageBus(), 1 );
|
||||
// Upgrades.CAPACITY.registerItem( parts.fluidStorageBus(), 5 );
|
||||
//
|
||||
// // Formation Plane
|
||||
// Upgrades.FUZZY.registerItem( parts.formationPlane(), 1 );
|
||||
// Upgrades.INVERTER.registerItem( parts.formationPlane(), 1 );
|
||||
// Upgrades.CAPACITY.registerItem( parts.formationPlane(), 5 );
|
||||
//
|
||||
// // Matter Cannon
|
||||
// Upgrades.FUZZY.registerItem( items.massCannon(), 1 );
|
||||
// Upgrades.INVERTER.registerItem( items.massCannon(), 1 );
|
||||
// Upgrades.SPEED.registerItem( items.massCannon(), 4 );
|
||||
//
|
||||
// // Molecular Assembler
|
||||
// Upgrades.SPEED.registerItem( blocks.molecularAssembler(), 5 );
|
||||
//
|
||||
// // Inscriber
|
||||
// Upgrades.SPEED.registerItem( blocks.inscriber(), 3 );
|
||||
//
|
||||
// // Wireless Terminal Handler
|
||||
// items.wirelessTerminal().maybeItem().ifPresent( terminal -> registries.wireless().registerWirelessHandler( (IWirelessTermHandler) terminal ) );
|
||||
//
|
||||
// // Charge Rates
|
||||
// items.chargedStaff().maybeItem().ifPresent( chargedStaff -> registries.charger().addChargeRate( chargedStaff, 320d ) );
|
||||
// items.portableCell().maybeItem().ifPresent( chargedStaff -> registries.charger().addChargeRate( chargedStaff, 800d ) );
|
||||
// items.colorApplicator().maybeItem().ifPresent( colorApplicator -> registries.charger().addChargeRate( colorApplicator, 800d ) );
|
||||
// items.wirelessTerminal().maybeItem().ifPresent( terminal -> registries.charger().addChargeRate( terminal, 8000d ) );
|
||||
// items.entropyManipulator().maybeItem().ifPresent( entropyManipulator -> registries.charger().addChargeRate( entropyManipulator, 8000d ) );
|
||||
// items.massCannon().maybeItem().ifPresent( massCannon -> registries.charger().addChargeRate( massCannon, 8000d ) );
|
||||
// blocks.energyCell().maybeItem().ifPresent( cell -> registries.charger().addChargeRate( cell, 8000d ) );
|
||||
// blocks.energyCellDense().maybeItem().ifPresent( cell -> registries.charger().addChargeRate( cell, 16000d ) );
|
||||
//
|
||||
// // add villager trading to black smiths for a few basic materials
|
||||
// if( AEConfig.instance().isFeatureEnabled( AEFeature.VILLAGER_TRADING ) )
|
||||
// {
|
||||
// // TODO: VILLAGER TRADING
|
||||
// // VillagerRegistry.instance().getRegisteredVillagers().registerVillageTradeHandler( 3, new AETrading() );
|
||||
// }
|
||||
//
|
||||
// if( AEConfig.instance().isFeatureEnabled( AEFeature.CERTUS_QUARTZ_WORLD_GEN ) )
|
||||
// {
|
||||
// GameRegistry.registerWorldGenerator( new QuartzWorldGen(), 0 );
|
||||
// }
|
||||
//
|
||||
// if( AEConfig.instance().isFeatureEnabled( AEFeature.METEORITE_WORLD_GEN ) )
|
||||
// {
|
||||
// GameRegistry.registerWorldGenerator( new MeteoriteWorldGen(), 0 );
|
||||
// }
|
||||
//
|
||||
// final IMovableRegistry mr = registries.movable();
|
||||
//
|
||||
// /*
|
||||
// * You can't move bed rock.
|
||||
// */
|
||||
// mr.blacklistBlock( net.minecraft.block.Blocks.BEDROCK );
|
||||
//
|
||||
// /*
|
||||
// * White List Vanilla...
|
||||
// */
|
||||
// mr.whiteListTileEntity( net.minecraft.tileentity.BannerTileEntity.class );
|
||||
// mr.whiteListTileEntity( net.minecraft.tileentity.BeaconTileEntity.class );
|
||||
// mr.whiteListTileEntity( net.minecraft.tileentity.BrewingStandTileEntity.class );
|
||||
// mr.whiteListTileEntity( net.minecraft.tileentity.ChestTileEntity.class );
|
||||
// mr.whiteListTileEntity( net.minecraft.tileentity.CommandBlockTileEntity.class );
|
||||
// mr.whiteListTileEntity( net.minecraft.tileentity.ComparatorTileEntity.class );
|
||||
// mr.whiteListTileEntity( net.minecraft.tileentity.DaylightDetectorTileEntity.class );
|
||||
// mr.whiteListTileEntity( net.minecraft.tileentity.DispenserTileEntity.class );
|
||||
// mr.whiteListTileEntity( net.minecraft.tileentity.DropperTileEntity.class );
|
||||
// mr.whiteListTileEntity( net.minecraft.tileentity.EnchantingTableTileEntity.class );
|
||||
// mr.whiteListTileEntity( net.minecraft.tileentity.EnderChestTileEntity.class );
|
||||
// mr.whiteListTileEntity( net.minecraft.tileentity.EndPortalTileEntity.class );
|
||||
// mr.whiteListTileEntity( net.minecraft.tileentity.FurnaceTileEntity.class );
|
||||
// mr.whiteListTileEntity( net.minecraft.tileentity.HopperTileEntity.class );
|
||||
// mr.whiteListTileEntity( net.minecraft.tileentity.MobSpawnerTileEntity.class );
|
||||
// mr.whiteListTileEntity( net.minecraft.tileentity.PistonTileEntity.class );
|
||||
// mr.whiteListTileEntity( net.minecraft.tileentity.ShulkerBoxTileEntity.class );
|
||||
// mr.whiteListTileEntity( net.minecraft.tileentity.SignTileEntity.class );
|
||||
// mr.whiteListTileEntity( net.minecraft.tileentity.SkullTileEntity.class );
|
||||
//
|
||||
// /*
|
||||
// * Whitelist AE2
|
||||
// */
|
||||
// mr.whiteListTileEntity( AEBaseTile.class );
|
||||
//
|
||||
// /*
|
||||
// * world gen
|
||||
// */
|
||||
// for( final WorldGenType type : WorldGenType.values() )
|
||||
// {
|
||||
// registries.worldgen().disableWorldGenForProviderID( type, StorageWorldProvider.class );
|
||||
//
|
||||
// // nether
|
||||
// registries.worldgen().disableWorldGenForDimension( type, -1 );
|
||||
//
|
||||
// // end
|
||||
// registries.worldgen().disableWorldGenForDimension( type, 1 );
|
||||
// }
|
||||
//
|
||||
// // whitelist from config
|
||||
// for( final int dimension : AEConfig.instance().getMeteoriteDimensionWhitelist() )
|
||||
// {
|
||||
// registries.worldgen().enableWorldGenForDimension( WorldGenType.METEORITES, dimension );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private static class ModelLoaderWrapper implements IModelRegistry
|
||||
// {
|
||||
//
|
||||
// @Override
|
||||
// public void registerItemVariants( Item item, ResourceLocation... names )
|
||||
// {
|
||||
// ModelLoader.registerItemVariants( item, names );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void setCustomModelResourceLocation( Item item, int metadata, ModelResourceLocation model )
|
||||
// {
|
||||
// ModelLoader.setCustomModelResourceLocation( item, metadata, model );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void setCustomMeshDefinition( Item item, ItemMeshDefinition meshDefinition )
|
||||
// {
|
||||
// ModelLoader.setCustomMeshDefinition( item, meshDefinition );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void setCustomStateMapper( Block block, IStateMapper mapper )
|
||||
// {
|
||||
// ModelLoader.setCustomStateMapper( block, mapper );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private static class CriterionTrigggerRegistry implements ICriterionTriggerRegistry
|
||||
// {
|
||||
// private Method method;
|
||||
//
|
||||
// CriterionTrigggerRegistry()
|
||||
// {
|
||||
// this.method = ReflectionHelper.findMethod( CriteriaTriggers.class, "register", "func_192118_a", ICriterionTrigger.class );
|
||||
// this.method.setAccessible( true );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void register( ICriterionTrigger<? extends ICriterionInstance> trigger )
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// this.method.invoke( null, trigger );
|
||||
// }
|
||||
// catch( IllegalAccessException | IllegalArgumentException | InvocationTargetException e )
|
||||
// {
|
||||
// AELog.debug( e );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -10,12 +10,13 @@ import appeng.api.storage.ICellInventoryHandler;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.util.IClientHelper;
|
||||
import appeng.core.localization.GuiText;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
|
||||
|
||||
public class ApiClientHelper implements IClientHelper
|
||||
{
|
||||
@Override
|
||||
public <T extends IAEStack<T>> void addCellInformation( ICellInventoryHandler<T> handler, List<String> lines )
|
||||
public <T extends IAEStack<T>> void addCellInformation( ICellInventoryHandler<T> handler, List<ITextComponent> lines )
|
||||
{
|
||||
if( handler == null )
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -30,28 +30,31 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
|
||||
import appeng.api.definitions.IBlockDefinition;
|
||||
import net.minecraftforge.fml.RegistryObject;
|
||||
|
||||
|
||||
public class BlockDefinition extends ItemDefinition implements IBlockDefinition
|
||||
{
|
||||
private final Optional<Block> block;
|
||||
private final RegistryObject<Block> block;
|
||||
|
||||
public BlockDefinition( String registryName, Block block, BlockItem item )
|
||||
{
|
||||
super( registryName, item );
|
||||
this.block = Optional.ofNullable( block );
|
||||
this.block = null; // FIXME // Optional.ofNullable( block );
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Optional<Block> maybeBlock()
|
||||
public final RegistryObject<Block> maybeBlock()
|
||||
{
|
||||
return this.block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<BlockItem> maybeBlockItem()
|
||||
public RegistryObject<BlockItem> maybeBlockItem()
|
||||
{
|
||||
return this.block.map( BlockItem::new );
|
||||
// FIXME
|
||||
return null;
|
||||
// return this.block.map( BlockItem::new );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,9 +24,10 @@ import javax.annotation.Nullable;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
@@ -41,7 +42,7 @@ public class BlockCubeGenerator extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
final TileCubeGenerator tcg = this.getTileEntity( w, pos );
|
||||
if( tcg != null )
|
||||
|
||||
@@ -24,9 +24,10 @@ import javax.annotation.Nullable;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
@@ -41,7 +42,7 @@ public class BlockPhantomNode extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
final TilePhantomNode tpn = this.getTileEntity( w, pos );
|
||||
tpn.triggerCrashMode();
|
||||
|
||||
@@ -65,7 +65,7 @@ public class TileCubeGenerator extends AEBaseTile implements ITickable
|
||||
|
||||
private void spawn()
|
||||
{
|
||||
this.world.setBlockToAir( this.pos );
|
||||
this.world.removeBlock(this.pos, false);
|
||||
|
||||
final Item i = this.is.getItem();
|
||||
final Direction side = Direction.UP;
|
||||
|
||||
@@ -66,7 +66,7 @@ public class ToolEraser extends AEBaseItem
|
||||
if( state == c_state )
|
||||
{
|
||||
blocks++;
|
||||
world.setBlockToAir( wc );
|
||||
world.removeBlock(wc, false);
|
||||
|
||||
next.add( wc.add( 1, 0, 0 ) );
|
||||
next.add( wc.add( -1, 0, 0 ) );
|
||||
|
||||
@@ -76,7 +76,7 @@ public class ToolReplicatorCard extends AEBaseItem
|
||||
}
|
||||
else
|
||||
{
|
||||
final CompoundNBT ish = player.getHeldItem( hand ).getTagCompound();
|
||||
final CompoundNBT ish = player.getHeldItem( hand ).getTag();
|
||||
if( ish != null )
|
||||
{
|
||||
final int src_x = ish.getInteger( "x" );
|
||||
|
||||
@@ -19,65 +19,63 @@
|
||||
package appeng.decorative.solid;
|
||||
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import appeng.client.render.effects.ChargedOreFX;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.exceptions.MissingDefinitionException;
|
||||
import appeng.client.render.effects.ChargedOreFX;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AppEng;
|
||||
import java.util.Random;
|
||||
|
||||
|
||||
public class BlockChargedQuartzOre extends BlockQuartzOre
|
||||
{
|
||||
@Override
|
||||
public Item getItemDropped( final BlockState state, final Random rand, final int fortune )
|
||||
{
|
||||
return AEApi.instance()
|
||||
.definitions()
|
||||
.materials()
|
||||
.certusQuartzCrystalCharged()
|
||||
.maybeItem()
|
||||
.orElseThrow( () -> new MissingDefinitionException( "Tried to access charged certus quartz crystal, even though they are disabled" ) );
|
||||
public BlockChargedQuartzOre(Properties props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped( final BlockState state )
|
||||
{
|
||||
return AEApi.instance()
|
||||
.definitions()
|
||||
.materials()
|
||||
.certusQuartzCrystalCharged()
|
||||
.maybeStack( 1 )
|
||||
.orElseThrow( () -> new MissingDefinitionException( "Tried to access charged certus quartz crystal, even though they are disabled" ) )
|
||||
.getItemDamage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock( BlockState state, RayTraceResult target, World world, BlockPos pos, PlayerEntity player )
|
||||
{
|
||||
return AEApi.instance()
|
||||
.definitions()
|
||||
.blocks()
|
||||
.quartzOreCharged()
|
||||
.maybeStack( 1 )
|
||||
.orElseThrow( () -> new MissingDefinitionException( "Tried to access charged certus quartz ore, even though they are disabled" ) );
|
||||
}
|
||||
// FIXME: Loot tables
|
||||
// @Override
|
||||
// public Item getItemDropped( final BlockState state, final Random rand, final int fortune )
|
||||
// {
|
||||
// return AEApi.instance()
|
||||
// .definitions()
|
||||
// .materials()
|
||||
// .certusQuartzCrystalCharged()
|
||||
// .maybeItem()
|
||||
// .orElseThrow( () -> new MissingDefinitionException( "Tried to access charged certus quartz crystal, even though they are disabled" ) );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public int damageDropped( final BlockState state )
|
||||
// {
|
||||
// return AEApi.instance()
|
||||
// .definitions()
|
||||
// .materials()
|
||||
// .certusQuartzCrystalCharged()
|
||||
// .maybeStack( 1 )
|
||||
// .orElseThrow( () -> new MissingDefinitionException( "Tried to access charged certus quartz crystal, even though they are disabled" ) )
|
||||
// .getItemDamage();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public ItemStack getPickBlock( BlockState state, RayTraceResult target, World world, BlockPos pos, PlayerEntity player )
|
||||
// {
|
||||
// return AEApi.instance()
|
||||
// .definitions()
|
||||
// .blocks()
|
||||
// .quartzOreCharged()
|
||||
// .maybeStack( 1 )
|
||||
// .orElseThrow( () -> new MissingDefinitionException( "Tried to access charged certus quartz ore, even though they are disabled" ) );
|
||||
// }
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void randomDisplayTick( final BlockState state, final World w, final BlockPos pos, final Random r )
|
||||
public void animateTick( final BlockState state, final World w, final BlockPos pos, final Random r )
|
||||
{
|
||||
if( !AEConfig.instance().isEnableEffects() )
|
||||
{
|
||||
@@ -115,8 +113,7 @@ public class BlockChargedQuartzOre extends BlockQuartzOre
|
||||
|
||||
if( AppEng.proxy.shouldAddParticles( r ) )
|
||||
{
|
||||
final ChargedOreFX fx = new ChargedOreFX( w, pos.getX() + xOff, pos.getY() + yOff, pos.getZ() + zOff, 0.0f, 0.0f, 0.0f );
|
||||
Minecraft.getInstance().effectRenderer.addEffect( fx );
|
||||
Minecraft.getInstance().particles.addParticle(ChargedOreFX.TYPE, pos.getX() + xOff, pos.getY() + yOff, pos.getZ() + zOff, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class BlockQuartzLamp extends BlockQuartzGlass
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void randomDisplayTick( final BlockState state, final World w, final BlockPos pos, final Random r )
|
||||
public void animateTick( final BlockState state, final World w, final BlockPos pos, final Random r )
|
||||
{
|
||||
if( !AEConfig.instance().isEnableEffects() )
|
||||
{
|
||||
|
||||
@@ -19,95 +19,79 @@
|
||||
package appeng.decorative.solid;
|
||||
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.exceptions.MissingDefinitionException;
|
||||
import appeng.block.AEBaseBlock;
|
||||
|
||||
|
||||
public class BlockQuartzOre extends AEBaseBlock
|
||||
{
|
||||
public BlockQuartzOre()
|
||||
{
|
||||
super( Material.ROCK );
|
||||
this.setHardness( 3.0F );
|
||||
this.setResistance( 5.0F );
|
||||
public BlockQuartzOre(Properties props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
// FIXME @Override
|
||||
// public BlockRenderLayer getBlockLayer()
|
||||
// {
|
||||
// return BlockRenderLayer.CUTOUT;
|
||||
// }
|
||||
|
||||
// FIXME: Loot Tables
|
||||
// @Override
|
||||
// public int quantityDropped( BlockState state, int fortune, Random rand )
|
||||
// {
|
||||
// if( fortune > 0 && Item.getItemFromBlock( this ) != this.getItemDropped( null, rand, fortune ) )
|
||||
// {
|
||||
// int j = rand.nextInt( fortune + 2 ) - 1;
|
||||
//
|
||||
// if( j < 0 )
|
||||
// {
|
||||
// j = 0;
|
||||
// }
|
||||
//
|
||||
// return this.quantityDropped( rand ) * ( j + 1 );
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return this.quantityDropped( rand );
|
||||
// }
|
||||
// }
|
||||
|
||||
// @Override
|
||||
// public int quantityDropped( final Random rand )
|
||||
// {
|
||||
// return 1 + rand.nextInt( 2 );
|
||||
// }
|
||||
//
|
||||
|
||||
@Override
|
||||
public BlockRenderLayer getBlockLayer()
|
||||
{
|
||||
return BlockRenderLayer.CUTOUT;
|
||||
public int getExpDrop(BlockState state, net.minecraft.world.IWorldReader reader, BlockPos pos, int fortune, int silktouch) {
|
||||
return silktouch == 0 ? MathHelper.nextInt(RANDOM, 2, 5) : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped( BlockState state, int fortune, Random rand )
|
||||
{
|
||||
if( fortune > 0 && Item.getItemFromBlock( this ) != this.getItemDropped( null, rand, fortune ) )
|
||||
{
|
||||
int j = rand.nextInt( fortune + 2 ) - 1;
|
||||
// FIXME: loot tables
|
||||
// @Override
|
||||
// public Item getItemDropped( final BlockState state, final Random rand, final int fortune )
|
||||
// {
|
||||
// return AEApi.instance()
|
||||
// .definitions()
|
||||
// .materials()
|
||||
// .certusQuartzCrystal()
|
||||
// .maybeItem()
|
||||
// .orElseThrow( () -> new MissingDefinitionException( "Tried to access certus quartz crystal, even though they are disabled" ) );
|
||||
// }
|
||||
|
||||
if( j < 0 )
|
||||
{
|
||||
j = 0;
|
||||
}
|
||||
|
||||
return this.quantityDropped( rand ) * ( j + 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.quantityDropped( rand );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped( final Random rand )
|
||||
{
|
||||
return 1 + rand.nextInt( 2 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getExpDrop( BlockState state, IBlockReader world, BlockPos pos, int fortune )
|
||||
{
|
||||
Random rand = world instanceof World ? ( (World) world ).rand : new Random();
|
||||
|
||||
if( this.getItemDropped( state, rand, fortune ) != Item.getItemFromBlock( this ) )
|
||||
{
|
||||
return MathHelper.getInt( rand, 2, 5 );
|
||||
}
|
||||
return super.getExpDrop( state, world, pos, fortune );
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped( final BlockState state, final Random rand, final int fortune )
|
||||
{
|
||||
return AEApi.instance()
|
||||
.definitions()
|
||||
.materials()
|
||||
.certusQuartzCrystal()
|
||||
.maybeItem()
|
||||
.orElseThrow( () -> new MissingDefinitionException( "Tried to access certus quartz crystal, even though they are disabled" ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped( final BlockState state )
|
||||
{
|
||||
return AEApi.instance()
|
||||
.definitions()
|
||||
.materials()
|
||||
.certusQuartzCrystal()
|
||||
.maybeStack( 1 )
|
||||
.orElseThrow( () -> new MissingDefinitionException( "Tried to access certus quartz crystal, even though they are disabled" ) )
|
||||
.getItemDamage();
|
||||
}
|
||||
// FIXME: loot tables
|
||||
// @Override
|
||||
// public int damageDropped( final BlockState state )
|
||||
// {
|
||||
// return AEApi.instance()
|
||||
// .definitions()
|
||||
// .materials()
|
||||
// .certusQuartzCrystal()
|
||||
// .maybeStack( 1 )
|
||||
// .orElseThrow( () -> new MissingDefinitionException( "Tried to access certus quartz crystal, even though they are disabled" ) )
|
||||
// .getItemDamage();
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -87,9 +87,8 @@ public class BlockSkyStone extends AEBaseBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock( final World w, final BlockPos pos, final BlockState state )
|
||||
{
|
||||
super.breakBlock( w, pos, state );
|
||||
public void onReplaced(BlockState state, World w, BlockPos pos, BlockState newState, boolean isMoving) {
|
||||
super.onReplaced(state, w, pos, newState, isMoving);
|
||||
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
|
||||
@@ -25,9 +25,10 @@ import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
@@ -45,7 +46,7 @@ public class BlockFluidInterface extends AEBaseTileBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated( final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final Direction side, final float hitX, final float hitY, final float hitZ )
|
||||
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity p, final Hand hand, final @Nullable ItemStack heldItem, final BlockRayTraceResult hit)
|
||||
{
|
||||
if( p.isShiftKeyDown() )
|
||||
{
|
||||
@@ -57,7 +58,7 @@ public class BlockFluidInterface extends AEBaseTileBlock
|
||||
{
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing( side ), GuiBridge.GUI_FLUID_INTERFACE );
|
||||
Platform.openGUI( p, tg, AEPartLocation.fromFacing(hit), GuiBridge.GUI_FLUID_INTERFACE );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class FluidDummyItem extends AEBaseItem
|
||||
{
|
||||
if( is.hasTag() )
|
||||
{
|
||||
CompoundNBT tag = is.getTagCompound();
|
||||
CompoundNBT tag = is.getTag();
|
||||
return FluidStack.loadFluidStackFromNBT( tag );
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -307,7 +307,7 @@ public class PartFluidLevelEmitter extends PartUpgradeable implements IStackWatc
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick( final World world, final BlockPos pos, final Random r )
|
||||
public void animateTick( final World world, final BlockPos pos, final Random r )
|
||||
{
|
||||
if( this.isLevelEmitterOn() )
|
||||
{
|
||||
|
||||
@@ -46,6 +46,7 @@ import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -85,9 +86,9 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
@Override
|
||||
public void addCheckedInformation( final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips )
|
||||
public void addInformation(final ItemStack stack, final World world, final List<ITextComponent> lines, final ITooltipFlag advancedTooltips )
|
||||
{
|
||||
super.addCheckedInformation( stack, world, lines, advancedTooltips );
|
||||
super.addInformation( stack, world, lines, advancedTooltips );
|
||||
|
||||
final MaterialType mt = this.getTypeByStack( stack );
|
||||
if( mt == null )
|
||||
|
||||
@@ -32,6 +32,7 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -75,7 +76,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
crystalSeedStack.setItemDamage( certus2 );
|
||||
crystalSeedStack = newStyle( crystalSeedStack );
|
||||
String itemName = crystalSeedStack.getItem().getRegistryName().getResourcePath();
|
||||
return new ResolverResult( itemName, crystalSeedStack.getDamage(), crystalSeedStack.getTagCompound() );
|
||||
return new ResolverResult( itemName, crystalSeedStack.getDamage(), crystalSeedStack.getTag() );
|
||||
} )
|
||||
.orElse( null );
|
||||
|
||||
@@ -91,7 +92,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
{
|
||||
if( is.hasTag() )
|
||||
{
|
||||
return is.getTagCompound().getInteger( "progress" );
|
||||
return is.getTag().getInteger( "progress" );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -159,13 +160,13 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void addCheckedInformation( final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips )
|
||||
public void addInformation(final ItemStack stack, final World world, final List<ITextComponent> lines, final ITooltipFlag advancedTooltips )
|
||||
{
|
||||
lines.add( ButtonToolTips.DoesntDespawn.getLocal() );
|
||||
final int progress = getProgress( stack ) % SINGLE_OFFSET;
|
||||
lines.add( Math.floor( (float) progress / (float) ( SINGLE_OFFSET / 100 ) ) + "%" );
|
||||
|
||||
super.addCheckedInformation( stack, world, lines, advancedTooltips );
|
||||
super.addInformation( stack, world, lines, advancedTooltips );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -32,6 +32,7 @@ import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
@@ -103,7 +104,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void addCheckedInformation( final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips )
|
||||
public void addInformation(final ItemStack stack, final World world, final List<ITextComponent> lines, final ITooltipFlag advancedTooltips )
|
||||
{
|
||||
final ICraftingPatternDetails details = this.getPatternForItem( stack, world );
|
||||
|
||||
|
||||
@@ -214,7 +214,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
public ItemStack getTextureItem( ItemStack is )
|
||||
{
|
||||
|
||||
CompoundNBT nbt = is.getTagCompound();
|
||||
CompoundNBT nbt = is.getTag();
|
||||
|
||||
if( nbt == null )
|
||||
{
|
||||
|
||||
@@ -31,6 +31,7 @@ import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -76,7 +77,7 @@ public abstract class AbstractStorageCell<T extends IAEStack<T>> extends AEBaseI
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
@Override
|
||||
public void addCheckedInformation( final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips )
|
||||
public void addInformation(final ItemStack stack, final World world, final List<ITextComponent> lines, final ITooltipFlag advancedTooltips )
|
||||
{
|
||||
AEApi.instance()
|
||||
.client()
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -78,7 +79,7 @@ public class ItemCreativeStorageCell extends AEBaseItem implements ICellWorkbenc
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
@Override
|
||||
public void addCheckedInformation( final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips )
|
||||
public void addInformation(final ItemStack stack, final World world, final List<ITextComponent> lines, final ITooltipFlag advancedTooltips )
|
||||
{
|
||||
final IMEInventoryHandler<?> inventory = AEApi.instance()
|
||||
.registries()
|
||||
|
||||
@@ -25,6 +25,7 @@ import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
@@ -58,7 +59,7 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
@Override
|
||||
public void addCheckedInformation( final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips )
|
||||
public void addInformation(final ItemStack stack, final World world, final List<ITextComponent> lines, final ITooltipFlag advancedTooltips )
|
||||
{
|
||||
final int id = this.getStoredDimensionID( stack );
|
||||
if( id >= 0 )
|
||||
@@ -108,7 +109,7 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
||||
{
|
||||
if( is.hasTag() )
|
||||
{
|
||||
final CompoundNBT c = is.getTagCompound();
|
||||
final CompoundNBT c = is.getTag();
|
||||
return new WorldCoord( c.getInteger( NBT_SIZE_X_KEY ), c.getInteger( NBT_SIZE_Y_KEY ), c.getInteger( NBT_SIZE_Z_KEY ) );
|
||||
}
|
||||
return new WorldCoord( 0, 0, 0 );
|
||||
@@ -119,7 +120,7 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
||||
{
|
||||
if( is.hasTag() )
|
||||
{
|
||||
final CompoundNBT c = is.getTagCompound();
|
||||
final CompoundNBT c = is.getTag();
|
||||
return c.getInteger( NBT_CELL_ID_KEY );
|
||||
}
|
||||
return -1;
|
||||
|
||||
@@ -21,6 +21,7 @@ package appeng.items.tools;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -30,6 +31,9 @@ import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponent;
|
||||
import net.minecraft.util.text.TextComponentUtils;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
@@ -61,17 +65,17 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void addCheckedInformation( final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips )
|
||||
public void addInformation(final ItemStack stack, final World world, final List<ITextComponent> lines, final ITooltipFlag advancedTooltips )
|
||||
{
|
||||
lines.add( this.getLocalizedName( this.getSettingsName( stack ) + ".name", this.getSettingsName( stack ) ) );
|
||||
|
||||
final CompoundNBT data = this.getData( stack );
|
||||
if( data.hasKey( "tooltip" ) )
|
||||
if( data.contains( "tooltip" ) )
|
||||
{
|
||||
lines.add( I18n.translateToLocal( this.getLocalizedName( data.getString( "tooltip" ) + ".name", data.getString( "tooltip" ) ) ) );
|
||||
}
|
||||
|
||||
if( data.hasKey( "freq" ) )
|
||||
if( data.contains( "freq" ) )
|
||||
{
|
||||
final short freq = data.getShort( "freq" );
|
||||
final String freqTooltip = TextFormatting.BOLD + Platform.p2p().toHexString( freq );
|
||||
|
||||
@@ -26,6 +26,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import org.apache.commons.lang3.text.WordUtils;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -248,7 +249,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
|
||||
public ItemStack getColor( final ItemStack is )
|
||||
{
|
||||
final CompoundNBT c = is.getTagCompound();
|
||||
final CompoundNBT c = is.getTag();
|
||||
if( c != null && c.contains("color") )
|
||||
{
|
||||
final CompoundNBT color = c.getCompoundTag( "color" );
|
||||
@@ -423,9 +424,9 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void addCheckedInformation( final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips )
|
||||
public void addInformation(final ItemStack stack, final World world, final List<ITextComponent> lines, final ITooltipFlag advancedTooltips )
|
||||
{
|
||||
super.addCheckedInformation( stack, world, lines, advancedTooltips );
|
||||
super.addInformation( stack, world, lines, advancedTooltips );
|
||||
|
||||
final ICellInventoryHandler<IAEItemStack> cdi = AEApi.instance()
|
||||
.registries()
|
||||
|
||||
@@ -140,7 +140,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
}
|
||||
else
|
||||
{
|
||||
w.setBlockToAir( pos );
|
||||
w.removeBlock(pos, false);
|
||||
}
|
||||
|
||||
if( r.getDrops() != null )
|
||||
@@ -176,7 +176,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
}
|
||||
else
|
||||
{
|
||||
w.setBlockToAir( pos );
|
||||
w.removeBlock(pos, false);
|
||||
}
|
||||
|
||||
if( r.getDrops() != null )
|
||||
@@ -268,14 +268,14 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
{
|
||||
if( blockID instanceof BlockTNT )
|
||||
{
|
||||
w.setBlockToAir( pos );
|
||||
w.removeBlock(pos, false);
|
||||
( (BlockTNT) blockID ).explode( w, pos, state, p );
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
|
||||
if( blockID instanceof BlockTinyTNT )
|
||||
{
|
||||
w.setBlockToAir( pos );
|
||||
w.removeBlock(pos, false);
|
||||
( (BlockTinyTNT) blockID ).startFuse( w, pos, p );
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -88,9 +89,9 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
@Override
|
||||
public void addCheckedInformation( final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips )
|
||||
public void addInformation(final ItemStack stack, final World world, final List<ITextComponent> lines, final ITooltipFlag advancedTooltips )
|
||||
{
|
||||
super.addCheckedInformation( stack, world, lines, advancedTooltips );
|
||||
super.addInformation( stack, world, lines, advancedTooltips );
|
||||
|
||||
final ICellInventoryHandler<IAEItemStack> cdi = AEApi.instance()
|
||||
.registries()
|
||||
|
||||
@@ -29,6 +29,7 @@ import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -78,9 +79,9 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell<
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void addCheckedInformation( final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips )
|
||||
public void addInformation(final ItemStack stack, final World world, final List<ITextComponent> lines, final ITooltipFlag advancedTooltips )
|
||||
{
|
||||
super.addCheckedInformation( stack, world, lines, advancedTooltips );
|
||||
super.addInformation( stack, world, lines, advancedTooltips );
|
||||
|
||||
final ICellInventoryHandler<IAEItemStack> cdi = AEApi.instance()
|
||||
.registries()
|
||||
|
||||
@@ -71,9 +71,9 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void addCheckedInformation( final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips )
|
||||
public void addInformation( final ItemStack stack, final World world, final List<ITextComponent> lines, final ITooltipFlag advancedTooltips )
|
||||
{
|
||||
super.addCheckedInformation( stack, world, lines, advancedTooltips );
|
||||
super.addInformation( stack, world, lines, advancedTooltips );
|
||||
|
||||
if( stack.hasTag() )
|
||||
{
|
||||
|
||||
@@ -27,6 +27,7 @@ import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
@@ -59,9 +60,9 @@ public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPow
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
@Override
|
||||
public void addCheckedInformation( final ItemStack stack, final World world, final List<String> lines, final ITooltipFlag advancedTooltips )
|
||||
public void addInformation(final ItemStack stack, final World world, final List<ITextComponent> lines, final ITooltipFlag advancedTooltips )
|
||||
{
|
||||
final CompoundNBT tag = stack.getTagCompound();
|
||||
final CompoundNBT tag = stack.getTag();
|
||||
double internalCurrentPower = 0;
|
||||
final double internalMaxPower = this.getAEMaxPower( stack );
|
||||
|
||||
|
||||
@@ -309,7 +309,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
|
||||
|
||||
@Override
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
public void randomDisplayTick( final World world, final BlockPos pos, final Random r )
|
||||
public void animateTick( final World world, final BlockPos pos, final Random r )
|
||||
{
|
||||
|
||||
}
|
||||
@@ -415,7 +415,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
|
||||
( (AppEngInternalAEInventory) inv ).writeToNBT( output, "config" );
|
||||
}
|
||||
|
||||
return output.hasNoTags() ? null : output;
|
||||
return output.isEmpty() ? null : output;
|
||||
}
|
||||
|
||||
public boolean useStandardMemoryCard()
|
||||
|
||||
@@ -901,14 +901,14 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick( final World world, final BlockPos pos, final Random r )
|
||||
public void animateTick( final World world, final BlockPos pos, final Random r )
|
||||
{
|
||||
for( final AEPartLocation side : AEPartLocation.values() )
|
||||
{
|
||||
final IPart p = this.getPart( side );
|
||||
if( p != null )
|
||||
{
|
||||
p.randomDisplayTick( world, pos, r );
|
||||
p.animateTick( world, pos, r );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ public interface ICableBusContainer
|
||||
boolean isLadder( LivingEntity entity );
|
||||
|
||||
@OnlyIn( Dist.CLIENT )
|
||||
void randomDisplayTick( World world, BlockPos pos, Random r );
|
||||
void animateTick( World world, BlockPos pos, Random r );
|
||||
|
||||
int getLightValue();
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ public class NullCableBusContainer implements ICableBusContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick( final World world, final BlockPos pos, final Random r )
|
||||
public void animateTick( final World world, final BlockPos pos, final Random r )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -441,7 +441,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick( final World world, final BlockPos pos, final Random r )
|
||||
public void animateTick( final World world, final BlockPos pos, final Random r )
|
||||
{
|
||||
if( this.isLevelEmitterOn() )
|
||||
{
|
||||
|
||||
@@ -223,7 +223,7 @@ public class PartCableAnchor implements IPart
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick( final World world, final BlockPos pos, final Random r )
|
||||
public void animateTick( final World world, final BlockPos pos, final Random r )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -39,9 +39,6 @@ import appeng.block.AEBaseBlock;
|
||||
import appeng.client.ActionKey;
|
||||
import appeng.client.EffectType;
|
||||
import appeng.core.CommonHelper;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.items.tools.ToolNetworkTool;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraftforge.fml.server.ServerLifecycleHooks;
|
||||
|
||||
@@ -85,31 +82,31 @@ public class ServerHelper extends CommonHelper
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendToAllNearExcept(final PlayerEntity p, final double x, final double y, final double z, final double dist, final World w, final AppEngPacket packet )
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for( final PlayerEntity o : this.getPlayers() )
|
||||
{
|
||||
final ServerPlayerEntity entityplayermp = (ServerPlayerEntity) o;
|
||||
|
||||
if( entityplayermp != p && entityplayermp.world == w )
|
||||
{
|
||||
final double dX = x - entityplayermp.getPosX();
|
||||
final double dY = y - entityplayermp.getPosY();
|
||||
final double dZ = z - entityplayermp.getPosZ();
|
||||
|
||||
if( dX * dX + dY * dY + dZ * dZ < dist * dist )
|
||||
{
|
||||
NetworkHandler.instance().sendTo( packet, entityplayermp );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// FIXME @Override
|
||||
// FIXME public void sendToAllNearExcept(final PlayerEntity p, final double x, final double y, final double z, final double dist, final World w, final AppEngPacket packet )
|
||||
// FIXME {
|
||||
// FIXME if( Platform.isClient() )
|
||||
// FIXME {
|
||||
// FIXME return;
|
||||
// FIXME }
|
||||
// FIXME
|
||||
// FIXME for( final PlayerEntity o : this.getPlayers() )
|
||||
// FIXME {
|
||||
// FIXME final ServerPlayerEntity entityplayermp = (ServerPlayerEntity) o;
|
||||
// FIXME
|
||||
// FIXME if( entityplayermp != p && entityplayermp.world == w )
|
||||
// FIXME {
|
||||
// FIXME final double dX = x - entityplayermp.getPosX();
|
||||
// FIXME final double dY = y - entityplayermp.getPosY();
|
||||
// FIXME final double dZ = z - entityplayermp.getPosZ();
|
||||
// FIXME
|
||||
// FIXME if( dX * dX + dY * dY + dZ * dZ < dist * dist )
|
||||
// FIXME {
|
||||
// FIXME NetworkHandler.instance().sendTo( packet, entityplayermp );
|
||||
// FIXME }
|
||||
// FIXME }
|
||||
// FIXME }
|
||||
// FIXME }
|
||||
|
||||
@Override
|
||||
public void spawnEffect( final EffectType type, final World world, final double posX, final double posY, final double posZ, final Object o )
|
||||
@@ -166,14 +163,14 @@ public class ServerHelper extends CommonHelper
|
||||
{
|
||||
final ItemStack is = player.inventory.getStackInSlot( x );
|
||||
|
||||
if( !is.isEmpty() && is.getItem() instanceof ToolNetworkTool )
|
||||
{
|
||||
final CompoundNBT c = is.getTag();
|
||||
if( c != null && c.getBoolean( "hideFacades" ) )
|
||||
{
|
||||
return CableRenderMode.CABLE_VIEW;
|
||||
}
|
||||
}
|
||||
// FIXME if( !is.isEmpty() && is.getItem() instanceof ToolNetworkTool )
|
||||
// FIXME {
|
||||
// FIXME final CompoundNBT c = is.getTag();
|
||||
// FIXME if( c != null && c.getBoolean( "hideFacades" ) )
|
||||
// FIXME {
|
||||
// FIXME return CableRenderMode.CABLE_VIEW;
|
||||
// FIXME }
|
||||
// FIXME }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,17 +22,15 @@ package appeng.tile;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import net.minecraftforge.items.wrapper.EmptyHandler;
|
||||
@@ -45,17 +43,21 @@ import appeng.util.inv.InvOperation;
|
||||
public abstract class AEBaseInvTile extends AEBaseTile implements IAEAppEngInventory
|
||||
{
|
||||
|
||||
public AEBaseInvTile(TileEntityType<?> tileEntityTypeIn) {
|
||||
super(tileEntityTypeIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT( final CompoundNBT data )
|
||||
public void read(final CompoundNBT data )
|
||||
{
|
||||
super.readFromNBT( data );
|
||||
super.read( data );
|
||||
final IItemHandler inv = this.getInternalInventory();
|
||||
if( inv != EmptyHandler.INSTANCE )
|
||||
{
|
||||
final CompoundNBT opt = data.getCompoundTag( "inv" );
|
||||
final CompoundNBT opt = data.getCompound( "inv" );
|
||||
for( int x = 0; x < inv.getSlots(); x++ )
|
||||
{
|
||||
final CompoundNBT item = opt.getCompoundTag( "item" + x );
|
||||
final CompoundNBT item = opt.getCompound( "item" + x );
|
||||
ItemHandlerUtil.setStackInSlot( inv, x, ItemStack.read(item) );
|
||||
}
|
||||
}
|
||||
@@ -64,9 +66,9 @@ public abstract class AEBaseInvTile extends AEBaseTile implements IAEAppEngInven
|
||||
public abstract @Nonnull IItemHandler getInternalInventory();
|
||||
|
||||
@Override
|
||||
public CompoundNBT writeToNBT( final CompoundNBT data )
|
||||
public CompoundNBT write(final CompoundNBT data )
|
||||
{
|
||||
super.writeToNBT( data );
|
||||
super.write( data );
|
||||
final IItemHandler inv = this.getInternalInventory();
|
||||
if( inv != EmptyHandler.INSTANCE )
|
||||
{
|
||||
@@ -79,9 +81,9 @@ public abstract class AEBaseInvTile extends AEBaseTile implements IAEAppEngInven
|
||||
{
|
||||
is.write(item);
|
||||
}
|
||||
opt.setTag( "item" + x, item );
|
||||
opt.put( "item" + x, item );
|
||||
}
|
||||
data.setTag( "inv", opt );
|
||||
data.put( "inv", opt );
|
||||
}
|
||||
return data;
|
||||
}
|
||||
@@ -104,51 +106,23 @@ public abstract class AEBaseInvTile extends AEBaseTile implements IAEAppEngInven
|
||||
@Override
|
||||
public abstract void onChangeInventory( IItemHandler inv, int slot, InvOperation mc, ItemStack removed, ItemStack added );
|
||||
|
||||
@Override
|
||||
public ITextComponent getDisplayName()
|
||||
{
|
||||
if( this.hasCustomInventoryName() )
|
||||
{
|
||||
return new TextComponentString( this.getCustomInventoryName() );
|
||||
}
|
||||
return new TextComponentTranslation( this.getBlockType().getTranslationKey() );
|
||||
}
|
||||
|
||||
protected @Nonnull IItemHandler getItemHandlerForSide( @Nonnull Direction side )
|
||||
{
|
||||
return this.getInternalInventory();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public boolean hasCapability( Capability<?> capability, Direction facing )
|
||||
{
|
||||
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> capability, Direction facing) {
|
||||
if( capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY )
|
||||
{
|
||||
if( facing == null )
|
||||
{
|
||||
return this.getInternalInventory() != EmptyHandler.INSTANCE;
|
||||
return (LazyOptional<T>) LazyOptional.of(this::getInternalInventory);
|
||||
}
|
||||
else
|
||||
{
|
||||
return this.getItemHandlerForSide( facing ) != EmptyHandler.INSTANCE;
|
||||
}
|
||||
}
|
||||
return super.hasCapability( capability, facing );
|
||||
}
|
||||
|
||||
@SuppressWarnings( "unchecked" )
|
||||
@Override
|
||||
public <T> T getCapability( Capability<T> capability, @Nullable Direction facing )
|
||||
{
|
||||
if( capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY )
|
||||
{
|
||||
if( facing == null )
|
||||
{
|
||||
return (T) this.getInternalInventory();
|
||||
}
|
||||
else
|
||||
{
|
||||
return (T) this.getItemHandlerForSide( facing );
|
||||
return (LazyOptional<T>) LazyOptional.of(() -> getItemHandlerForSide( facing ));
|
||||
}
|
||||
}
|
||||
return super.getCapability( capability, facing );
|
||||
|
||||
@@ -28,6 +28,7 @@ import java.util.Map;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import appeng.core.AELog;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
@@ -36,8 +37,9 @@ import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.network.play.server.SUpdateTileEntityPacket;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
@@ -48,12 +50,8 @@ import appeng.api.util.ICommonTile;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.api.util.IConfigurableObject;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.features.IStackSrc;
|
||||
import appeng.helpers.ICustomNameObject;
|
||||
import appeng.helpers.IPriorityHost;
|
||||
import appeng.hooks.TickHandler;
|
||||
import appeng.tile.inventory.AppEngInternalAEInventory;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.SettingsFrom;
|
||||
|
||||
@@ -71,10 +69,8 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
||||
private BlockState state;
|
||||
private boolean markDirtyQueued = false;
|
||||
|
||||
@Override
|
||||
public boolean shouldRefresh( final World world, final BlockPos pos, final BlockState oldState, final BlockState newSate )
|
||||
{
|
||||
return newSate.getBlock() != oldState.getBlock(); // state doesn't change tile entities in AE2.
|
||||
public AEBaseTile(TileEntityType<?> tileEntityTypeIn) {
|
||||
super(tileEntityTypeIn);
|
||||
}
|
||||
|
||||
public static void registerTileItem( final Class<? extends TileEntity> c, final IStackSrc wat )
|
||||
@@ -157,13 +153,13 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
||||
}
|
||||
|
||||
@Override
|
||||
public SPacketUpdateTileEntity getUpdatePacket()
|
||||
public SUpdateTileEntityPacket getUpdatePacket()
|
||||
{
|
||||
return new SPacketUpdateTileEntity( this.pos, 64, this.getUpdateTag() );
|
||||
return new SUpdateTileEntityPacket( this.pos, 64, this.getUpdateTag() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket( final NetworkManager net, final SPacketUpdateTileEntity pkt )
|
||||
public void onDataPacket( final NetworkManager net, final SUpdateTileEntityPacket pkt )
|
||||
{
|
||||
// / pkt.actionType
|
||||
if( pkt.getTileEntityType() == 64 )
|
||||
@@ -359,7 +355,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
||||
*/
|
||||
public void uploadSettings( final SettingsFrom from, final CompoundNBT compound )
|
||||
{
|
||||
if( compound != null && this instanceof IConfigurableObject )
|
||||
if( this instanceof IConfigurableObject )
|
||||
{
|
||||
final IConfigManager cm = ( (IConfigurableObject) this ).getConfigManager();
|
||||
if( cm != null )
|
||||
@@ -367,36 +363,34 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
||||
cm.readFromNBT( compound );
|
||||
}
|
||||
}
|
||||
|
||||
if( this instanceof IPriorityHost )
|
||||
{
|
||||
final IPriorityHost pHost = (IPriorityHost) this;
|
||||
pHost.setPriority( compound.getInt( "priority" ) );
|
||||
}
|
||||
|
||||
if( this instanceof ISegmentedInventory )
|
||||
{
|
||||
final IItemHandler inv = ( (ISegmentedInventory) this ).getInventoryByName( "config" );
|
||||
if( inv instanceof AppEngInternalAEInventory )
|
||||
{
|
||||
final AppEngInternalAEInventory target = (AppEngInternalAEInventory) inv;
|
||||
final AppEngInternalAEInventory tmp = new AppEngInternalAEInventory( null, target.getSlots() );
|
||||
tmp.read( compound, "config" );
|
||||
for( int x = 0; x < tmp.getSlots(); x++ )
|
||||
{
|
||||
target.setStackInSlot( x, tmp.getStackInSlot( x ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
// FIXME
|
||||
// if( this instanceof IPriorityHost )
|
||||
// {
|
||||
// final IPriorityHost pHost = (IPriorityHost) this;
|
||||
// pHost.setPriority( compound.getInt( "priority" ) );
|
||||
// }
|
||||
//
|
||||
// if( this instanceof ISegmentedInventory )
|
||||
// {
|
||||
// final IItemHandler inv = ( (ISegmentedInventory) this ).getInventoryByName( "config" );
|
||||
// if( inv instanceof AppEngInternalAEInventory )
|
||||
// {
|
||||
// final AppEngInternalAEInventory target = (AppEngInternalAEInventory) inv;
|
||||
// final AppEngInternalAEInventory tmp = new AppEngInternalAEInventory( null, target.getSlots() );
|
||||
// tmp.readFromNBT( compound, "config" );
|
||||
// for( int x = 0; x < tmp.getSlots(); x++ )
|
||||
// {
|
||||
// target.setStackInSlot( x, tmp.getStackInSlot( x ) );
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the contents of the tile entity, into the world, defaults to dropping everything in the inventory.
|
||||
*
|
||||
* @param w world
|
||||
* @param x x pos of tile entity
|
||||
* @param y y pos of tile entity
|
||||
* @param z z pos of tile entity
|
||||
* @param pos block position
|
||||
* @param drops drops of tile entity
|
||||
*/
|
||||
@Override
|
||||
@@ -424,8 +418,8 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
||||
if( this.hasCustomInventoryName() )
|
||||
{
|
||||
final CompoundNBT dsp = new CompoundNBT();
|
||||
dsp.setString( "Name", this.getCustomInventoryName() );
|
||||
output.setTag( "display", dsp );
|
||||
dsp.putString( "Name", this.getCustomInventoryName() );
|
||||
output.put( "display", dsp );
|
||||
}
|
||||
|
||||
if( this instanceof IConfigurableObject )
|
||||
@@ -437,22 +431,23 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
||||
}
|
||||
}
|
||||
|
||||
if( this instanceof IPriorityHost )
|
||||
{
|
||||
final IPriorityHost pHost = (IPriorityHost) this;
|
||||
output.setInteger( "priority", pHost.getPriority() );
|
||||
}
|
||||
// FIXME
|
||||
// if( this instanceof IPriorityHost )
|
||||
// {
|
||||
// final IPriorityHost pHost = (IPriorityHost) this;
|
||||
// output.putInt( "priority", pHost.getPriority() );
|
||||
// }
|
||||
//
|
||||
// if( this instanceof ISegmentedInventory )
|
||||
// {
|
||||
// final IItemHandler inv = ( (ISegmentedInventory) this ).getInventoryByName( "config" );
|
||||
// if( inv instanceof AppEngInternalAEInventory )
|
||||
// {
|
||||
// ( (AppEngInternalAEInventory) inv ).writeToNBT( output, "config" );
|
||||
// }
|
||||
// }
|
||||
|
||||
if( this instanceof ISegmentedInventory )
|
||||
{
|
||||
final IItemHandler inv = ( (ISegmentedInventory) this ).getInventoryByName( "config" );
|
||||
if( inv instanceof AppEngInternalAEInventory )
|
||||
{
|
||||
( (AppEngInternalAEInventory) inv ).writeToNBT( output, "config" );
|
||||
}
|
||||
}
|
||||
|
||||
return output.hasNoTags() ? null : output;
|
||||
return output.isEmpty() ? null : output;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -485,7 +480,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
|
||||
this.world.markChunkDirty( this.pos, this );
|
||||
if( !this.markDirtyQueued )
|
||||
{
|
||||
TickHandler.INSTANCE.addCallable( null, this::markDirtyAtEndOfTick );
|
||||
// FIXME TickHandler.INSTANCE.addCallable( null, this::markDirtyAtEndOfTick );
|
||||
this.markDirtyQueued = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,9 +213,9 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundNBT writeToNBT( final CompoundNBT data )
|
||||
public CompoundNBT write(final CompoundNBT data )
|
||||
{
|
||||
super.writeToNBT( data );
|
||||
super.write( data );
|
||||
if( this.forcePlan && this.myPlan != null )
|
||||
{
|
||||
final ItemStack pattern = this.myPlan.getPattern();
|
||||
@@ -234,9 +234,9 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT( final CompoundNBT data )
|
||||
public void read(final CompoundNBT data )
|
||||
{
|
||||
super.readFromNBT( data );
|
||||
super.read( data );
|
||||
if( data.contains("myPlan") )
|
||||
{
|
||||
final ItemStack myPat = new ItemStack( data.getCompoundTag( "myPlan" ) );
|
||||
|
||||
@@ -35,16 +35,16 @@ public abstract class AENetworkInvTile extends AEBaseInvTile implements IActionH
|
||||
private final AENetworkProxy gridProxy = new AENetworkProxy( this, "proxy", this.getItemFromTile( this ), true );
|
||||
|
||||
@Override
|
||||
public void readFromNBT( final CompoundNBT data )
|
||||
public void read(final CompoundNBT data )
|
||||
{
|
||||
super.readFromNBT( data );
|
||||
super.read( data );
|
||||
this.getProxy().readFromNBT( data );
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundNBT writeToNBT( final CompoundNBT data )
|
||||
public CompoundNBT write(final CompoundNBT data )
|
||||
{
|
||||
super.writeToNBT( data );
|
||||
super.write( data );
|
||||
this.getProxy().writeToNBT( data );
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -37,16 +37,16 @@ public abstract class AENetworkPowerTile extends AEBasePoweredTile implements IA
|
||||
private final AENetworkProxy gridProxy = new AENetworkProxy( this, "proxy", this.getItemFromTile( this ), true );
|
||||
|
||||
@Override
|
||||
public void readFromNBT( final CompoundNBT data )
|
||||
public void read(final CompoundNBT data )
|
||||
{
|
||||
super.readFromNBT( data );
|
||||
super.read( data );
|
||||
this.getProxy().readFromNBT( data );
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundNBT writeToNBT( final CompoundNBT data )
|
||||
public CompoundNBT write(final CompoundNBT data )
|
||||
{
|
||||
super.writeToNBT( data );
|
||||
super.write( data );
|
||||
this.getProxy().writeToNBT( data );
|
||||
return data;
|
||||
}
|
||||
|
||||
@@ -85,18 +85,18 @@ public class TileCondenser extends AEBaseInvTile implements IConfigManagerHost,
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundNBT writeToNBT( final CompoundNBT data )
|
||||
public CompoundNBT write(final CompoundNBT data )
|
||||
{
|
||||
super.writeToNBT( data );
|
||||
super.write( data );
|
||||
this.cm.writeToNBT( data );
|
||||
data.putDouble("storedPower", this.getStoredPower());
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT( final CompoundNBT data )
|
||||
public void read(final CompoundNBT data )
|
||||
{
|
||||
super.readFromNBT( data );
|
||||
super.read( data );
|
||||
this.cm.readFromNBT( data );
|
||||
this.setStoredPower( data.getDouble( "storedPower" ) );
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user