More stuff ingame and showing up.
This commit is contained in:
@@ -74,10 +74,46 @@ sourceSets {
|
|||||||
include 'appeng/client/ActionKey.java'
|
include 'appeng/client/ActionKey.java'
|
||||||
include 'appeng/client/EffectType.java'
|
include 'appeng/client/EffectType.java'
|
||||||
include 'appeng/core/AELog.java'
|
include 'appeng/core/AELog.java'
|
||||||
|
include 'appeng/core/Registration.java'
|
||||||
|
include 'appeng/core/features/ItemDefinition.java'
|
||||||
|
include 'appeng/util/inv/InvOperation.java'
|
||||||
|
include 'appeng/core/features/registries/PartModels.java'
|
||||||
|
include 'appeng/core/features/registries/PartModels.java'
|
||||||
|
include 'appeng/core/api/definitions/ApiBlocks.java'
|
||||||
|
include 'appeng/core/api/definitions/ApiBlocks.java'
|
||||||
|
include 'appeng/util/helpers/ItemComparisonHelper.java'
|
||||||
|
include 'appeng/core/ApiDefinitions.java'
|
||||||
|
include 'appeng/core/Api.java'
|
||||||
|
include 'appeng/decorative/solid/BlockQuartzOre.java'
|
||||||
|
include 'appeng/bootstrap/**'
|
||||||
|
include 'appeng/block/AEBaseBlock.java'
|
||||||
|
include 'appeng/block/AEBaseBlockItem.java'
|
||||||
|
include 'appeng/block/AEBaseTileBlock.java'
|
||||||
|
include 'appeng/tile/AEBaseTile.java'
|
||||||
|
include 'appeng/tile/AEBaseInvTile.java'
|
||||||
|
include 'appeng/util/Platform.java'
|
||||||
|
include 'appeng/util/SettingsFrom.java'
|
||||||
|
include 'appeng/core/features/IStackSrc.java'
|
||||||
|
include 'appeng/helpers/ICustomNameObject.java'
|
||||||
|
include 'appeng/core/CreativeTab.java'
|
||||||
|
include 'appeng/core/features/ActivityState.java'
|
||||||
|
include 'appeng/core/features/BlockStackSrc.java'
|
||||||
|
include 'appeng/core/features/ItemStackSrc.java'
|
||||||
|
include 'appeng/core/features/BlockDefinition.java'
|
||||||
|
include 'appeng/core/features/TileDefinition.java'
|
||||||
|
include 'appeng/core/features/ColoredItemDefinition.java'
|
||||||
|
include 'appeng/util/helpers/ItemHandlerUtil.java'
|
||||||
|
include 'appeng/util/inv/IAEAppEngInventory.java'
|
||||||
|
include 'appeng/decorative/solid/BlockChargedQuartzOre.java'
|
||||||
|
include 'appeng/client/render/effects/ChargedOreFX.java'
|
||||||
// include 'appeng/client/ClientHelper.java'
|
// include 'appeng/client/ClientHelper.java'
|
||||||
// include 'appeng/server/ServerHelper.java'
|
// include 'appeng/server/ServerHelper.java'
|
||||||
include 'appeng/block/AEBaseBlock.java'
|
include 'appeng/block/AEBaseBlock.java'
|
||||||
include 'appeng/helpers/ICustomCollision.java'
|
include 'appeng/helpers/ICustomCollision.java'
|
||||||
|
include 'appeng/client/ClientHelper.java'
|
||||||
|
include 'appeng/server/ServerHelper.java'
|
||||||
|
include 'appeng/core/CommonHelper.java'
|
||||||
|
include 'appeng/helpers/IMouseWheelItem.java'
|
||||||
}
|
}
|
||||||
compileClasspath += sourceSets.api.output
|
compileClasspath += sourceSets.api.output
|
||||||
runtimeClasspath += sourceSets.api.output
|
runtimeClasspath += sourceSets.api.output
|
||||||
|
|||||||
+2
-2
@@ -10,8 +10,8 @@ artifact_basename=appliedenergistics2
|
|||||||
#########################################################
|
#########################################################
|
||||||
minecraft_release=1.15
|
minecraft_release=1.15
|
||||||
minecraft_version=1.15.2
|
minecraft_version=1.15.2
|
||||||
mcp_mappings=20200411-1.15.1
|
mcp_mappings=20200514-1.15.1
|
||||||
forge_version=31.1.43
|
forge_version=31.2.0
|
||||||
|
|
||||||
#########################################################
|
#########################################################
|
||||||
# Provided APIs #
|
# Provided APIs #
|
||||||
|
|||||||
@@ -0,0 +1,109 @@
|
|||||||
|
package appeng.api.definitions;
|
||||||
|
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import static appeng.api.definitions.IdHelper.id;
|
||||||
|
|
||||||
|
public final class BlockIds {
|
||||||
|
|
||||||
|
private BlockIds() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* world gen
|
||||||
|
*/
|
||||||
|
public static final ResourceLocation QUARTZ_ORE = id("quartz_ore");
|
||||||
|
public static final ResourceLocation QUARTZ_ORE_CHARGED = id("charged_quartz_ore");
|
||||||
|
public static final ResourceLocation MATRIX_FRAME = id("matrix_frame");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* decorative
|
||||||
|
*/
|
||||||
|
public static final ResourceLocation QUARTZ_BLOCK = id("quartz_block");
|
||||||
|
public static final ResourceLocation QUARTZ_PILLAR = id("quartz_pillar");
|
||||||
|
public static final ResourceLocation CHISELED_QUARTZ_BLOCK = id("chiseled_quartz_block");
|
||||||
|
public static final ResourceLocation QUARTZ_GLASS = id("quartz_glass");
|
||||||
|
public static final ResourceLocation QUARTZ_VIBRANT_GLASS = id("quartz_vibrant_glass");
|
||||||
|
public static final ResourceLocation QUARTZ_FIXTURE = id("quartz_fixture");
|
||||||
|
public static final ResourceLocation FLUIX_BLOCK = id("fluix_block");
|
||||||
|
public static final ResourceLocation SKY_STONE_BLOCK = id("sky_stone_block");
|
||||||
|
public static final ResourceLocation SMOOTH_SKY_STONE_BLOCK = id("smooth_sky_stone_block");
|
||||||
|
public static final ResourceLocation SKY_STONE_BRICK = id("sky_stone_brick");
|
||||||
|
public static final ResourceLocation SKY_STONE_SMALL_BRICK = id("sky_stone_small_brick");
|
||||||
|
public static final ResourceLocation SKY_STONE_CHEST = id("sky_stone_chest");
|
||||||
|
public static final ResourceLocation SMOOTH_SKY_STONE_CHEST = id("smooth_sky_stone_chest");
|
||||||
|
public static final ResourceLocation SKY_COMPASS = id("sky_compass");
|
||||||
|
public static final ResourceLocation SKY_STONE_STAIRS = id("sky_stone_stairs");
|
||||||
|
public static final ResourceLocation SMOOTH_SKY_STONE_STAIRS = id("smooth_sky_stone_stairs");
|
||||||
|
public static final ResourceLocation SKY_STONE_BRICK_STAIRS = id("sky_stone_brick_stairs");
|
||||||
|
public static final ResourceLocation SKY_STONE_SMALL_BRICK_STAIRS = id("sky_stone_small_brick_stairs");
|
||||||
|
public static final ResourceLocation FLUIX_STAIRS = id("fluix_stairs");
|
||||||
|
public static final ResourceLocation QUARTZ_STAIRS = id("quartz_stairs");
|
||||||
|
public static final ResourceLocation CHISELED_QUARTZ_STAIRS = id("chiseled_quartz_stairs");
|
||||||
|
public static final ResourceLocation QUARTZ_PILLAR_STAIRS = id("quartz_pillar_stairs");
|
||||||
|
public static final ResourceLocation SKY_STONE_SLAB = id("sky_stone_slab");
|
||||||
|
public static final ResourceLocation SMOOTH_SKY_STONE_SLAB = id("smooth_sky_stone_slab");
|
||||||
|
public static final ResourceLocation SKY_STONE_BRICK_SLAB = id("sky_stone_brick_slab");
|
||||||
|
public static final ResourceLocation SKY_STONE_SMALL_BRICK_SLAB = id("sky_stone_small_brick_slab");
|
||||||
|
public static final ResourceLocation FLUIX_SLAB = id("fluix_slab");
|
||||||
|
public static final ResourceLocation QUARTZ_SLAB = id("quartz_slab");
|
||||||
|
public static final ResourceLocation CHISELED_QUARTZ_SLAB = id("chiseled_quartz_slab");
|
||||||
|
public static final ResourceLocation QUARTZ_PILLAR_SLAB = id("quartz_pillar_slab");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* misc
|
||||||
|
*/
|
||||||
|
public static final ResourceLocation GRINDSTONE = id("grindstone");
|
||||||
|
public static final ResourceLocation CRANK = id("crank");
|
||||||
|
public static final ResourceLocation INSCRIBER = id("inscriber");
|
||||||
|
public static final ResourceLocation WIRELESS_ACCESS_POINT = id("wireless_access_point");
|
||||||
|
public static final ResourceLocation CHARGER = id("charger");
|
||||||
|
public static final ResourceLocation TINY_TNT = id("tiny_tnt");
|
||||||
|
public static final ResourceLocation SECURITY_STATION = id("security_station");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* quantum Network Bridge
|
||||||
|
*/
|
||||||
|
public static final ResourceLocation QUANTUM_RING = id("quantum_ring");
|
||||||
|
public static final ResourceLocation QUANTUM_LINK = id("quantum_link");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* spatial iO
|
||||||
|
*/
|
||||||
|
public static final ResourceLocation SPATIAL_PYLON = id("spatial_pylon");
|
||||||
|
public static final ResourceLocation SPATIAL_IO_PORT = id("spatial_io_port");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Bus / cables
|
||||||
|
*/
|
||||||
|
public static final ResourceLocation MULTI_PART = id("cable_bus");
|
||||||
|
|
||||||
|
/*
|
||||||
|
* machines
|
||||||
|
*/
|
||||||
|
public static final ResourceLocation CONTROLLER = id("controller");
|
||||||
|
public static final ResourceLocation DRIVE = id("drive");
|
||||||
|
public static final ResourceLocation CHEST = id("chest");
|
||||||
|
public static final ResourceLocation IFACE = id("interface");
|
||||||
|
public static final ResourceLocation FLUID_IFACE = id("fluid_interface");
|
||||||
|
public static final ResourceLocation CELL_WORKBENCH = id("cell_workbench");
|
||||||
|
public static final ResourceLocation IO_PORT = id("io_port");
|
||||||
|
public static final ResourceLocation CONDENSER = id("condenser");
|
||||||
|
public static final ResourceLocation ENERGY_ACCEPTOR = id("energy_acceptor");
|
||||||
|
public static final ResourceLocation VIBRATION_CHAMBER = id("vibration_chamber");
|
||||||
|
public static final ResourceLocation QUARTZ_GROWTH_ACCELERATOR = id("quartz_growth_accelerator");
|
||||||
|
public static final ResourceLocation ENERGY_CELL = id("energy_cell");
|
||||||
|
public static final ResourceLocation ENERGY_CELL_DENSE = id("dense_energy_cell");
|
||||||
|
public static final ResourceLocation ENERGY_CELL_CREATIVE = id("creative_energy_cell");
|
||||||
|
|
||||||
|
// rv1
|
||||||
|
public static final ResourceLocation CRAFTING_UNIT = id("crafting_unit");
|
||||||
|
public static final ResourceLocation CRAFTING_ACCELERATOR = id("crafting_accelerator");
|
||||||
|
public static final ResourceLocation CRAFTING_STORAGE1K = id("crafting_storage_1k");
|
||||||
|
public static final ResourceLocation CRAFTING_STORAGE4K = id("crafting_storage_4k");
|
||||||
|
public static final ResourceLocation CRAFTING_STORAGE16K = id("crafting_storage_16k");
|
||||||
|
public static final ResourceLocation CRAFTING_STORAGE64K = id("crafting_storage_64k");
|
||||||
|
public static final ResourceLocation CRAFTING_MONITOR = id("crafting_monitor");
|
||||||
|
public static final ResourceLocation MOLECULAR_ASSEMBLER = id("molecular_assembler");
|
||||||
|
public static final ResourceLocation LIGHT_DETECTOR = id("light_detector");
|
||||||
|
public static final ResourceLocation PAINT = id("paint");
|
||||||
|
}
|
||||||
@@ -19,12 +19,11 @@
|
|||||||
package appeng.api.definitions;
|
package appeng.api.definitions;
|
||||||
|
|
||||||
|
|
||||||
import java.util.Optional;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.item.BlockItem;
|
import net.minecraft.item.BlockItem;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.IBlockReader;
|
import net.minecraft.world.IBlockReader;
|
||||||
|
import net.minecraftforge.fml.RegistryObject;
|
||||||
|
|
||||||
|
|
||||||
public interface IBlockDefinition extends IItemDefinition
|
public interface IBlockDefinition extends IItemDefinition
|
||||||
@@ -32,12 +31,12 @@ public interface IBlockDefinition extends IItemDefinition
|
|||||||
/**
|
/**
|
||||||
* @return the {@link Block} implementation if applicable
|
* @return the {@link Block} implementation if applicable
|
||||||
*/
|
*/
|
||||||
Optional<Block> maybeBlock();
|
RegistryObject<Block> maybeBlock();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the {@link ItemBlock} implementation if applicable
|
* @return the {@link BlockItem} implementation if applicable
|
||||||
*/
|
*/
|
||||||
Optional<BlockItem> maybeBlockItem();
|
RegistryObject<BlockItem> maybeBlockItem();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compare Block with world.
|
* Compare Block with world.
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package appeng.api.definitions;
|
||||||
|
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
// Private helper class to create AE2 resource locations
|
||||||
|
final class IdHelper {
|
||||||
|
|
||||||
|
private IdHelper() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a ResourceLocation namespaced to AE2.
|
||||||
|
*/
|
||||||
|
static ResourceLocation id(String id) {
|
||||||
|
return new ResourceLocation("appliedenergistics2", id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -271,13 +271,13 @@ public interface IPart extends IBoxProvider, ICustomCableConnection
|
|||||||
public float getCableConnectionLength( AECableType cable );
|
public float getCableConnectionLength( AECableType cable );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* same as Block.randomDisplayTick, for but parts.
|
* same as Block.animateTick, for but parts.
|
||||||
*
|
*
|
||||||
* @param world world of block
|
* @param world world of block
|
||||||
* @param pos location of block
|
* @param pos location of block
|
||||||
* @param r random
|
* @param r random
|
||||||
*/
|
*/
|
||||||
void randomDisplayTick( World world, BlockPos pos, Random r );
|
void animateTick( World world, BlockPos pos, Random r );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when placed in the world by a player, this happens before addWorld.
|
* Called when placed in the world by a player, this happens before addWorld.
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import appeng.api.storage.ICellInventoryHandler;
|
import appeng.api.storage.ICellInventoryHandler;
|
||||||
import appeng.api.storage.data.IAEStack;
|
import appeng.api.storage.data.IAEStack;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
|
||||||
|
|
||||||
public interface IClientHelper
|
public interface IClientHelper
|
||||||
@@ -16,6 +17,6 @@ public interface IClientHelper
|
|||||||
* @param handler Cell handler.
|
* @param handler Cell handler.
|
||||||
* @param lines List of lines to add to.
|
* @param lines List of lines to add to.
|
||||||
*/
|
*/
|
||||||
<T extends IAEStack<T>> void addCellInformation( ICellInventoryHandler<T> handler, List<String> lines );
|
<T extends IAEStack<T>> void addCellInformation( ICellInventoryHandler<T> handler, List<ITextComponent> lines );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,11 +41,9 @@ public interface IOrientableBlock
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param world world of block
|
* @param world world of block
|
||||||
* @param x x pos of block
|
* @param pos The position of the block.
|
||||||
* @param y y pos of block
|
|
||||||
* @param z z pos of block
|
|
||||||
*
|
*
|
||||||
* @return a IOrientable if applicable
|
* @return a IOrientable if applicable
|
||||||
*/
|
*/
|
||||||
IOrientable getOrientable( IBlockReader world, BlockPos z );
|
IOrientable getOrientable( IBlockReader world, BlockPos pos );
|
||||||
}
|
}
|
||||||
@@ -19,9 +19,6 @@
|
|||||||
package appeng.block;
|
package appeng.block;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
@@ -30,16 +27,13 @@ import net.minecraft.state.IProperty;
|
|||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.state.StateContainer;
|
import net.minecraft.state.StateContainer;
|
||||||
|
import net.minecraft.util.ActionResultType;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.Rotation;
|
import net.minecraft.util.Rotation;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.*;
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
|
||||||
import net.minecraft.util.math.Vec3d;
|
|
||||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||||
import net.minecraft.util.math.shapes.VoxelShape;
|
import net.minecraft.util.math.shapes.VoxelShape;
|
||||||
import net.minecraft.util.math.shapes.VoxelShapePart;
|
|
||||||
import net.minecraft.util.math.shapes.VoxelShapes;
|
import net.minecraft.util.math.shapes.VoxelShapes;
|
||||||
import net.minecraft.world.IBlockReader;
|
import net.minecraft.world.IBlockReader;
|
||||||
import net.minecraft.world.IWorld;
|
import net.minecraft.world.IWorld;
|
||||||
@@ -56,7 +50,6 @@ public abstract class AEBaseBlock extends Block
|
|||||||
|
|
||||||
private boolean isOpaque = true;
|
private boolean isOpaque = true;
|
||||||
private boolean isFullSize = true;
|
private boolean isFullSize = true;
|
||||||
private boolean hasSubtypes = false;
|
|
||||||
private boolean isInventory = false;
|
private boolean isInventory = false;
|
||||||
|
|
||||||
protected VoxelShape boundingBox = VoxelShapes.fullCube();
|
protected VoxelShape boundingBox = VoxelShapes.fullCube();
|
||||||
@@ -316,9 +309,9 @@ public abstract class AEBaseBlock extends Block
|
|||||||
return new Direction[0];
|
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 )
|
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 )
|
if( this instanceof IOrientableBlock )
|
||||||
{
|
{
|
||||||
@@ -448,16 +441,6 @@ public abstract class AEBaseBlock extends Block
|
|||||||
return isOpaque;
|
return isOpaque;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean hasSubtypes()
|
|
||||||
{
|
|
||||||
return this.hasSubtypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void setHasSubtypes( final boolean hasSubtypes )
|
|
||||||
{
|
|
||||||
this.hasSubtypes = hasSubtypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean isFullSize()
|
protected boolean isFullSize()
|
||||||
{
|
{
|
||||||
return this.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.client.util.ITooltipFlag;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
@@ -43,14 +44,13 @@ import appeng.util.Platform;
|
|||||||
public class AEBaseBlockItemChargeable extends AEBaseBlockItem implements IAEItemPowerStorage
|
public class AEBaseBlockItemChargeable extends AEBaseBlockItem implements IAEItemPowerStorage
|
||||||
{
|
{
|
||||||
|
|
||||||
public AEBaseBlockItemChargeable( final Block id )
|
public AEBaseBlockItemChargeable(Block id, Properties props) {
|
||||||
{
|
super(id, props);
|
||||||
super( id );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@OnlyIn( Dist.CLIENT )
|
@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;
|
double internalCurrentPower = 0;
|
||||||
final double internalMaxPower = this.getMaxEnergyCapacity();
|
final double internalMaxPower = this.getMaxEnergyCapacity();
|
||||||
|
|||||||
@@ -29,14 +29,13 @@ import com.google.common.collect.Lists;
|
|||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.BlockStateContainer;
|
|
||||||
import net.minecraft.block.ITileEntityProvider;
|
import net.minecraft.block.ITileEntityProvider;
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.DyeColor;
|
import net.minecraft.item.DyeColor;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
import net.minecraft.state.StateContainer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.ActionResultType;
|
import net.minecraft.util.ActionResultType;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
@@ -46,9 +45,6 @@ import net.minecraft.util.math.BlockRayTraceResult;
|
|||||||
import net.minecraft.world.IBlockReader;
|
import net.minecraft.world.IBlockReader;
|
||||||
import net.minecraft.world.IWorld;
|
import net.minecraft.world.IWorld;
|
||||||
import net.minecraft.world.World;
|
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 net.minecraftforge.items.ItemHandlerHelper;
|
||||||
|
|
||||||
import appeng.api.implementations.items.IMemoryCard;
|
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.implementations.tiles.IColorableTile;
|
||||||
import appeng.api.util.AEColor;
|
import appeng.api.util.AEColor;
|
||||||
import appeng.api.util.IOrientable;
|
import appeng.api.util.IOrientable;
|
||||||
import appeng.block.networking.BlockCableBus;
|
|
||||||
import appeng.helpers.ICustomCollision;
|
import appeng.helpers.ICustomCollision;
|
||||||
import appeng.tile.AEBaseInvTile;
|
import appeng.tile.AEBaseInvTile;
|
||||||
import appeng.tile.AEBaseTile;
|
import appeng.tile.AEBaseTile;
|
||||||
import appeng.tile.networking.TileCableBus;
|
|
||||||
import appeng.tile.storage.TileSkyChest;
|
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import appeng.util.SettingsFrom;
|
import appeng.util.SettingsFrom;
|
||||||
|
|
||||||
@@ -72,46 +65,45 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
|
|||||||
@Nonnull
|
@Nonnull
|
||||||
private Class<? extends AEBaseTile> tileEntityType;
|
private Class<? extends AEBaseTile> tileEntityType;
|
||||||
|
|
||||||
public AEBaseTileBlock( final Material mat )
|
public AEBaseTileBlock( final Block.Properties props )
|
||||||
{
|
{
|
||||||
super( mat );
|
super( props );
|
||||||
}
|
}
|
||||||
|
// FIXME
|
||||||
public static final UnlistedDirection FORWARD = new UnlistedDirection( "forward" );
|
// public static final UnlistedDirection FORWARD = new UnlistedDirection( "forward" );
|
||||||
public static final UnlistedDirection UP = new UnlistedDirection( "up" );
|
// public static final UnlistedDirection UP = new UnlistedDirection( "up" );
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getExtendedState( BlockState state, IBlockReader world, BlockPos pos )
|
public BlockState getExtendedState( BlockState state, IBlockReader world, BlockPos pos )
|
||||||
{
|
{
|
||||||
// A subclass may decide it doesn't want extended block state for whatever reason
|
// FIXME
|
||||||
if( !( state instanceof IExtendedBlockState ) )
|
// // A subclass may decide it doesn't want extended block state for whatever reason
|
||||||
{
|
// if( !( state instanceof IExtendedBlockState ) )
|
||||||
return state;
|
// {
|
||||||
}
|
// return state;
|
||||||
|
// }
|
||||||
AEBaseTile tile = this.getTileEntity( world, pos );
|
//
|
||||||
if( tile == null )
|
// AEBaseTile tile = this.getTileEntity( world, pos );
|
||||||
{
|
// if( tile == null )
|
||||||
return state; // No info available
|
// {
|
||||||
}
|
// return state; // No info available
|
||||||
|
// }
|
||||||
IExtendedBlockState extState = (IExtendedBlockState) state;
|
//
|
||||||
return extState.withProperty( FORWARD, tile.getForward() ).withProperty( UP, tile.getUp() );
|
// IExtendedBlockState extState = (IExtendedBlockState) state;
|
||||||
|
// return extState.withProperty( FORWARD, tile.getForward() ).withProperty( UP, tile.getUp() );
|
||||||
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected BlockStateContainer createBlockState()
|
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
|
||||||
{
|
super.fillStateContainer(builder);
|
||||||
return new ExtendedBlockState( this, this.getAEStates(), new IUnlistedProperty[] {
|
|
||||||
FORWARD,
|
|
||||||
UP
|
|
||||||
} );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
// TODO: Rendering stuff
|
||||||
public int getMetaFromState( BlockState state )
|
|
||||||
{
|
// return new ExtendedBlockState( this, this.getAEStates(), new IUnlistedProperty[] {
|
||||||
return 0;
|
// FORWARD,
|
||||||
|
// UP
|
||||||
|
// } );
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO : Was this change needed?
|
// TODO : Was this change needed?
|
||||||
@@ -183,8 +175,8 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 );
|
final AEBaseTile te = this.getTileEntity( w, pos );
|
||||||
if( te != null )
|
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 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
|
@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() )
|
if( obj != null && obj.canBeRotated() )
|
||||||
{
|
{
|
||||||
return Direction.values();
|
return Direction.values();
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.getValidRotations( w, pos );
|
return super.getValidRotations( state, world, pos );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -271,7 +263,8 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
|
|||||||
final TileEntity te = this.getTileEntity( w, pos );
|
final TileEntity te = this.getTileEntity( w, pos );
|
||||||
if( te instanceof AEBaseTile )
|
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 );
|
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 BlockState blockState = world.getBlockState( pos );
|
||||||
final Block block = blockState.getBlock();
|
final Block block = blockState.getBlock();
|
||||||
|
|
||||||
if( block == null )
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
final AEBaseTile tile = this.getTileEntity( world, pos );
|
final AEBaseTile tile = this.getTileEntity( world, pos );
|
||||||
|
|
||||||
if( tile == null )
|
if( tile == null )
|
||||||
{
|
{
|
||||||
return false;
|
return ActionResultType.FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( tile instanceof TileCableBus || tile instanceof TileSkyChest )
|
// FIXME if( tile instanceof TileCableBus || tile instanceof TileSkyChest )
|
||||||
{
|
// {
|
||||||
return false;
|
// return ActionResultType.FAIL;
|
||||||
}
|
// }
|
||||||
|
|
||||||
final ItemStack[] itemDropCandidates = Platform.getBlockDrops( world, pos );
|
final ItemStack[] itemDropCandidates = Platform.getBlockDrops( world, pos );
|
||||||
final ItemStack op = new ItemStack( this );
|
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 );
|
final List<ItemStack> itemsToDrop = Lists.newArrayList( itemDropCandidates );
|
||||||
Platform.spawnDrops( world, pos, itemsToDrop );
|
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 IMemoryCard memoryCard = (IMemoryCard) heldItem.getItem();
|
||||||
final AEBaseTile tileEntity = this.getTileEntity( world, pos );
|
final AEBaseTile tileEntity = this.getTileEntity( world, pos );
|
||||||
|
|
||||||
if( tileEntity == null )
|
if( tileEntity == null )
|
||||||
{
|
{
|
||||||
return false;
|
return ActionResultType.FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String name = this.getTranslationKey();
|
final String name = this.getTranslationKey();
|
||||||
|
|
||||||
if( player.isShiftKeyDown() )
|
if( player.isCrouching() )
|
||||||
{
|
{
|
||||||
final CompoundNBT data = tileEntity.downloadSettings( SettingsFrom.MEMORY_CARD );
|
final CompoundNBT data = tileEntity.downloadSettings( SettingsFrom.MEMORY_CARD );
|
||||||
if( data != null )
|
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
|
@Override
|
||||||
public IOrientable getOrientable( final IBlockReader w, final BlockPos pos )
|
public IOrientable getOrientable(final IBlockReader w, final BlockPos pos )
|
||||||
{
|
{
|
||||||
return this.getTileEntity( w, pos );
|
return this.getTileEntity( w, pos );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 );
|
final AEBaseTile te = this.getTileEntity( w, pos );
|
||||||
if( te instanceof ICustomCollision )
|
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
|
@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 );
|
final TileCraftingTile cp = this.getTileEntity( w, pos );
|
||||||
if( cp != null )
|
if( cp != null )
|
||||||
@@ -138,7 +138,7 @@ public class BlockCraftingUnit extends AEBaseTileBlock
|
|||||||
cp.breakCluster();
|
cp.breakCluster();
|
||||||
}
|
}
|
||||||
|
|
||||||
super.breakBlock( w, pos, state );
|
super.onReplaced( state, w, pos, newState, isMoving );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -29,10 +29,12 @@ import net.minecraft.entity.LivingEntity;
|
|||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.ActionResultType;
|
||||||
import net.minecraft.util.EnumBlockRenderType;
|
import net.minecraft.util.EnumBlockRenderType;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.BlockRayTraceResult;
|
||||||
import net.minecraft.world.IBlockReader;
|
import net.minecraft.world.IBlockReader;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.FakePlayer;
|
import net.minecraftforge.common.util.FakePlayer;
|
||||||
@@ -57,7 +59,7 @@ public class BlockCrank extends AEBaseTileBlock
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 )
|
if( player instanceof FakePlayer || player == null )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,9 +24,10 @@ import javax.annotation.Nullable;
|
|||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.ActionResultType;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.BlockRayTraceResult;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import appeng.api.util.AEPartLocation;
|
import appeng.api.util.AEPartLocation;
|
||||||
@@ -47,12 +48,12 @@ public class BlockGrinder extends AEBaseTileBlock
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 );
|
final TileGrinder tg = this.getTileEntity( w, pos );
|
||||||
if( tg != null && !p.isShiftKeyDown() )
|
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 true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -24,9 +24,10 @@ import javax.annotation.Nullable;
|
|||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.ActionResultType;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.BlockRayTraceResult;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import appeng.api.util.AEPartLocation;
|
import appeng.api.util.AEPartLocation;
|
||||||
@@ -45,7 +46,7 @@ public class BlockCellWorkbench extends AEBaseTileBlock
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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() )
|
if( p.isShiftKeyDown() )
|
||||||
{
|
{
|
||||||
@@ -57,7 +58,7 @@ public class BlockCellWorkbench extends AEBaseTileBlock
|
|||||||
{
|
{
|
||||||
if( Platform.isServer() )
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ import java.util.Random;
|
|||||||
|
|
||||||
import javax.annotation.Nullable;
|
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.ImmutablePair;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
@@ -71,7 +73,7 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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() )
|
if( player.isShiftKeyDown() )
|
||||||
{
|
{
|
||||||
@@ -92,7 +94,7 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@OnlyIn( Dist.CLIENT )
|
@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() )
|
if( !AEConfig.instance().isEnableEffects() )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,9 +24,10 @@ import javax.annotation.Nullable;
|
|||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.ActionResultType;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.BlockRayTraceResult;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import appeng.api.util.AEPartLocation;
|
import appeng.api.util.AEPartLocation;
|
||||||
@@ -45,7 +46,7 @@ public class BlockCondenser extends AEBaseTileBlock
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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() )
|
if( player.isShiftKeyDown() )
|
||||||
{
|
{
|
||||||
@@ -57,7 +58,7 @@ public class BlockCondenser extends AEBaseTileBlock
|
|||||||
final TileCondenser tc = this.getTileEntity( w, pos );
|
final TileCondenser tc = this.getTileEntity( w, pos );
|
||||||
if( tc != null && !player.isShiftKeyDown() )
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,10 +25,11 @@ import net.minecraft.block.material.Material;
|
|||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.ActionResultType;
|
||||||
import net.minecraft.util.EnumBlockRenderType;
|
import net.minecraft.util.EnumBlockRenderType;
|
||||||
import net.minecraft.util.Direction;
|
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.BlockRayTraceResult;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import appeng.api.util.AEPartLocation;
|
import appeng.api.util.AEPartLocation;
|
||||||
@@ -50,7 +51,7 @@ public class BlockInscriber extends AEBaseTileBlock
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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() )
|
if( p.isShiftKeyDown() )
|
||||||
{
|
{
|
||||||
@@ -62,7 +63,7 @@ public class BlockInscriber extends AEBaseTileBlock
|
|||||||
{
|
{
|
||||||
if( Platform.isServer() )
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,9 +27,11 @@ import net.minecraft.block.properties.PropertyBool;
|
|||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.ActionResultType;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.BlockRayTraceResult;
|
||||||
import net.minecraft.world.IBlockReader;
|
import net.minecraft.world.IBlockReader;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
@@ -73,7 +75,7 @@ public class BlockInterface extends AEBaseTileBlock
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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() )
|
if( p.isShiftKeyDown() )
|
||||||
{
|
{
|
||||||
@@ -85,7 +87,7 @@ public class BlockInterface extends AEBaseTileBlock
|
|||||||
{
|
{
|
||||||
if( Platform.isServer() )
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
// cancel out lightning
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@OnlyIn( Dist.CLIENT )
|
@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() )
|
if( !AEConfig.instance().isEnableEffects() )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOr
|
|||||||
|
|
||||||
@OnlyIn( Dist.CLIENT )
|
@OnlyIn( Dist.CLIENT )
|
||||||
@Override
|
@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() )
|
if( !AEConfig.instance().isEnableEffects() )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,10 +27,11 @@ import net.minecraft.block.properties.PropertyBool;
|
|||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.ActionResultType;
|
||||||
import net.minecraft.util.BlockRenderLayer;
|
import net.minecraft.util.BlockRenderLayer;
|
||||||
import net.minecraft.util.Direction;
|
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.BlockRayTraceResult;
|
||||||
import net.minecraft.world.IBlockReader;
|
import net.minecraft.world.IBlockReader;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
@@ -80,7 +81,7 @@ public class BlockSecurityStation extends AEBaseTileBlock
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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() )
|
if( p.isShiftKeyDown() )
|
||||||
{
|
{
|
||||||
@@ -95,7 +96,7 @@ public class BlockSecurityStation extends AEBaseTileBlock
|
|||||||
return true;
|
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 true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -31,21 +31,23 @@ import net.minecraft.block.BlockState;
|
|||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
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.item.Items;
|
||||||
import net.minecraft.init.SoundEvents;
|
import net.minecraft.init.SoundEvents;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.ActionResultType;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.SoundCategory;
|
import net.minecraft.util.SoundCategory;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.BlockRayTraceResult;
|
||||||
import net.minecraft.world.Explosion;
|
import net.minecraft.world.Explosion;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import appeng.block.AEBaseBlock;
|
import appeng.block.AEBaseBlock;
|
||||||
import appeng.entity.EntityTinyTNTPrimed;
|
import appeng.entity.EntityTinyTNTPrimed;
|
||||||
import appeng.helpers.ICustomCollision;
|
import appeng.helpers.ICustomCollision;
|
||||||
|
import net.minecraft.world.server.ServerWorld;
|
||||||
|
|
||||||
|
|
||||||
public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
|
public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
|
||||||
@@ -72,18 +74,18 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 )
|
if( heldItem != null && heldItem.getItem() == Items.FLINT_AND_STEEL )
|
||||||
{
|
{
|
||||||
this.startFuse( w, pos, player );
|
this.startFuse( w, pos, player );
|
||||||
w.setBlockToAir( pos );
|
w.removeBlock(pos, false);
|
||||||
heldItem.damageItem( 1, player );
|
heldItem.damageItem( 1, player );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
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 )
|
if( world.isBlockIndirectlyGettingPowered( pos ) > 0 )
|
||||||
{
|
{
|
||||||
this.startFuse( world, pos, null );
|
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 )
|
if( w.isBlockIndirectlyGettingPowered( pos ) > 0 )
|
||||||
{
|
{
|
||||||
this.startFuse( w, pos, null );
|
this.startFuse( w, pos, null );
|
||||||
w.setBlockToAir( pos );
|
w.removeBlock(pos, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEntityWalk( final World w, final BlockPos pos, final Entity entity )
|
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() )
|
if( entityarrow.isBurning() )
|
||||||
{
|
{
|
||||||
this.startFuse( w, pos, entityarrow.shootingEntity instanceof LivingEntity ? (LivingEntity) entityarrow.shootingEntity : null );
|
LivingEntity igniter = null;
|
||||||
w.setBlockToAir( pos );
|
// 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.block.BlockState;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.ActionResultType;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.EnumParticleTypes;
|
import net.minecraft.util.EnumParticleTypes;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.BlockRayTraceResult;
|
||||||
import net.minecraft.world.IBlockReader;
|
import net.minecraft.world.IBlockReader;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
@@ -75,7 +77,7 @@ public final class BlockVibrationChamber extends AEBaseTileBlock
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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() )
|
if( player.isShiftKeyDown() )
|
||||||
{
|
{
|
||||||
@@ -87,7 +89,7 @@ public final class BlockVibrationChamber extends AEBaseTileBlock
|
|||||||
final TileVibrationChamber tc = this.getTileEntity( w, pos );
|
final TileVibrationChamber tc = this.getTileEntity( w, pos );
|
||||||
if( tc != null && !player.isShiftKeyDown() )
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -96,7 +98,7 @@ public final class BlockVibrationChamber extends AEBaseTileBlock
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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() )
|
if( !AEConfig.instance().isEnableEffects() )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -43,11 +43,13 @@ import net.minecraft.item.Item;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.state.IProperty;
|
import net.minecraft.state.IProperty;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.ActionResultType;
|
||||||
import net.minecraft.util.BlockRenderLayer;
|
import net.minecraft.util.BlockRenderLayer;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.NonNullList;
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.BlockRayTraceResult;
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
import net.minecraft.util.math.RayTraceResult.Type;
|
import net.minecraft.util.math.RayTraceResult.Type;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
@@ -130,9 +132,9 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
@Override
|
||||||
@@ -401,7 +403,7 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 ) );
|
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() )
|
if( Platform.isServer() )
|
||||||
{
|
{
|
||||||
w.setBlockToAir( pos );
|
w.removeBlock(pos, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -111,15 +111,14 @@ public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICusto
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 );
|
final TileQuantumBridge bridge = this.getTileEntity( w, pos );
|
||||||
if( bridge != null )
|
if( bridge != null )
|
||||||
{
|
{
|
||||||
bridge.breakCluster();
|
bridge.breakCluster();
|
||||||
}
|
}
|
||||||
|
|
||||||
super.breakBlock( w, pos, state );
|
super.onReplaced( state, w, pos, newState, isMoving );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -29,10 +29,11 @@ import net.minecraft.block.BlockState;
|
|||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.ActionResultType;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.BlockRayTraceResult;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import appeng.api.util.AEPartLocation;
|
import appeng.api.util.AEPartLocation;
|
||||||
@@ -53,7 +54,7 @@ public class BlockQuantumLinkChamber extends BlockQuantumBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 );
|
final TileQuantumBridge bridge = this.getTileEntity( w, pos );
|
||||||
if( bridge != null )
|
if( bridge != null )
|
||||||
@@ -69,7 +70,7 @@ public class BlockQuantumLinkChamber extends BlockQuantumBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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() )
|
if( p.isShiftKeyDown() )
|
||||||
{
|
{
|
||||||
@@ -81,7 +82,7 @@ public class BlockQuantumLinkChamber extends BlockQuantumBase
|
|||||||
{
|
{
|
||||||
if( Platform.isServer() )
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,9 +26,10 @@ import net.minecraft.block.material.Material;
|
|||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.ActionResultType;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.BlockRayTraceResult;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import appeng.api.util.AEPartLocation;
|
import appeng.api.util.AEPartLocation;
|
||||||
@@ -57,7 +58,7 @@ public class BlockSpatialIOPort extends AEBaseTileBlock
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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() )
|
if( p.isShiftKeyDown() )
|
||||||
{
|
{
|
||||||
@@ -69,7 +70,7 @@ public class BlockSpatialIOPort extends AEBaseTileBlock
|
|||||||
{
|
{
|
||||||
if( Platform.isServer() )
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,10 +27,11 @@ import net.minecraft.block.properties.PropertyEnum;
|
|||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.ActionResultType;
|
||||||
import net.minecraft.util.BlockRenderLayer;
|
import net.minecraft.util.BlockRenderLayer;
|
||||||
import net.minecraft.util.Direction;
|
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.BlockRayTraceResult;
|
||||||
import net.minecraft.world.IBlockReader;
|
import net.minecraft.world.IBlockReader;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
@@ -90,7 +91,7 @@ public class BlockChest extends AEBaseTileBlock
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 );
|
final TileChest tg = this.getTileEntity( w, pos );
|
||||||
if( tg != null && !p.isShiftKeyDown() )
|
if( tg != null && !p.isShiftKeyDown() )
|
||||||
@@ -100,9 +101,9 @@ public class BlockChest extends AEBaseTileBlock
|
|||||||
return true;
|
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
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,10 +26,11 @@ import net.minecraft.block.BlockStateContainer;
|
|||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.ActionResultType;
|
||||||
import net.minecraft.util.BlockRenderLayer;
|
import net.minecraft.util.BlockRenderLayer;
|
||||||
import net.minecraft.util.Direction;
|
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.BlockRayTraceResult;
|
||||||
import net.minecraft.world.IBlockReader;
|
import net.minecraft.world.IBlockReader;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.property.ExtendedBlockState;
|
import net.minecraftforge.common.property.ExtendedBlockState;
|
||||||
@@ -79,7 +80,7 @@ public class BlockDrive extends AEBaseTileBlock
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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() )
|
if( p.isShiftKeyDown() )
|
||||||
{
|
{
|
||||||
@@ -91,7 +92,7 @@ public class BlockDrive extends AEBaseTileBlock
|
|||||||
{
|
{
|
||||||
if( Platform.isServer() )
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,9 +26,10 @@ import net.minecraft.block.material.Material;
|
|||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.ActionResultType;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.BlockRayTraceResult;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import appeng.api.util.AEPartLocation;
|
import appeng.api.util.AEPartLocation;
|
||||||
@@ -57,7 +58,7 @@ public class BlockIOPort extends AEBaseTileBlock
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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() )
|
if( p.isShiftKeyDown() )
|
||||||
{
|
{
|
||||||
@@ -69,7 +70,7 @@ public class BlockIOPort extends AEBaseTileBlock
|
|||||||
{
|
{
|
||||||
if( Platform.isServer() )
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,11 +29,13 @@ import net.minecraft.block.BlockState;
|
|||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.ActionResultType;
|
||||||
import net.minecraft.util.EnumBlockRenderType;
|
import net.minecraft.util.EnumBlockRenderType;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.BlockRayTraceResult;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import appeng.api.util.AEPartLocation;
|
import appeng.api.util.AEPartLocation;
|
||||||
@@ -75,11 +77,11 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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() )
|
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;
|
return true;
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import java.util.function.Supplier;
|
|||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||||
import net.minecraft.item.BlockItem;
|
import net.minecraft.item.BlockItem;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
@@ -93,8 +94,8 @@ class BlockDefinitionBuilder implements IBlockBuilder
|
|||||||
|
|
||||||
if( Platform.isClient() )
|
if( Platform.isClient() )
|
||||||
{
|
{
|
||||||
this.blockRendering = new BlockRendering();
|
this.blockRendering = new BlockRendering();
|
||||||
this.itemRendering = new ItemRendering();
|
this.itemRendering = new ItemRendering();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,7 +121,7 @@ class BlockDefinitionBuilder implements IBlockBuilder
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockDefinitionBuilder rendering( BlockRenderingCustomizer callback )
|
public BlockDefinitionBuilder rendering( BlockRenderingCustomizer callback )
|
||||||
{
|
{
|
||||||
if( Platform.isClient() )
|
if( Platform.isClient() )
|
||||||
@@ -179,11 +180,6 @@ class BlockDefinitionBuilder implements IBlockBuilder
|
|||||||
@Override
|
@Override
|
||||||
public <T extends IBlockDefinition> T build()
|
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
|
// Create block and matching item, and set factory name of both
|
||||||
Block block = this.blockSupplier.get();
|
Block block = this.blockSupplier.get();
|
||||||
block.setRegistryName( AppEng.MOD_ID, this.registryName );
|
block.setRegistryName( AppEng.MOD_ID, this.registryName );
|
||||||
@@ -268,7 +264,7 @@ class BlockDefinitionBuilder implements IBlockBuilder
|
|||||||
}
|
}
|
||||||
else if( block instanceof AEBaseBlock )
|
else if( block instanceof AEBaseBlock )
|
||||||
{
|
{
|
||||||
return new AEBaseBlockItem( block );
|
return new AEBaseBlockItem( block, new Item.Properties() /* FIXME THIS IS THE IMPORTANT BIT */ );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,25 +19,20 @@
|
|||||||
package appeng.bootstrap;
|
package appeng.bootstrap;
|
||||||
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import appeng.block.AEBaseTileBlock;
|
||||||
import java.util.Map;
|
import appeng.bootstrap.components.BlockColorComponent;
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
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.color.IBlockColor;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
import net.minecraft.client.renderer.model.IBakedModel;
|
||||||
import net.minecraftforge.client.model.IModel;
|
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.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
import appeng.block.AEBaseTileBlock;
|
import java.util.HashMap;
|
||||||
import appeng.bootstrap.components.BlockColorComponent;
|
import java.util.Map;
|
||||||
import appeng.bootstrap.components.StateMapperComponent;
|
import java.util.function.BiFunction;
|
||||||
import appeng.bootstrap.components.TesrComponent;
|
|
||||||
import appeng.client.render.model.AutoRotatingModel;
|
|
||||||
|
|
||||||
|
|
||||||
class BlockRendering implements IBlockRendering
|
class BlockRendering implements IBlockRendering
|
||||||
@@ -50,13 +45,13 @@ class BlockRendering implements IBlockRendering
|
|||||||
private IBlockColor blockColor;
|
private IBlockColor blockColor;
|
||||||
|
|
||||||
@OnlyIn( Dist.CLIENT )
|
@OnlyIn( Dist.CLIENT )
|
||||||
private TileEntitySpecialRenderer<?> tesr;
|
private TileEntityRenderer<?> tesr;
|
||||||
|
|
||||||
|
// FIXME @OnlyIn( Dist.CLIENT )
|
||||||
|
// FIXME private IStateMapper stateMapper;
|
||||||
|
|
||||||
@OnlyIn( Dist.CLIENT )
|
@OnlyIn( Dist.CLIENT )
|
||||||
private IStateMapper stateMapper;
|
private Map<String, IUnbakedModel> builtInModels = new HashMap<>();
|
||||||
|
|
||||||
@OnlyIn( Dist.CLIENT )
|
|
||||||
private Map<String, IModel> builtInModels = new HashMap<>();
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@OnlyIn( Dist.CLIENT )
|
@OnlyIn( Dist.CLIENT )
|
||||||
@@ -76,47 +71,47 @@ class BlockRendering implements IBlockRendering
|
|||||||
|
|
||||||
@OnlyIn( Dist.CLIENT )
|
@OnlyIn( Dist.CLIENT )
|
||||||
@Override
|
@Override
|
||||||
public IBlockRendering tesr( TileEntitySpecialRenderer<?> tesr )
|
public IBlockRendering tesr( TileEntityRenderer<?> tesr )
|
||||||
{
|
{
|
||||||
this.tesr = tesr;
|
this.tesr = tesr;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockRendering builtInModel( String name, IModel model )
|
public IBlockRendering builtInModel( String name, IUnbakedModel model )
|
||||||
{
|
{
|
||||||
this.builtInModels.put( name, model );
|
this.builtInModels.put( name, model );
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnlyIn( Dist.CLIENT )
|
// FIXME @OnlyIn( Dist.CLIENT )
|
||||||
@Override
|
// FIXME @Override
|
||||||
public IBlockRendering stateMapper( IStateMapper mapper )
|
// FIXME public IBlockRendering stateMapper( IStateMapper mapper )
|
||||||
{
|
// FIXME {
|
||||||
this.stateMapper = mapper;
|
// FIXME this.stateMapper = mapper;
|
||||||
return this;
|
// FIXME return this;
|
||||||
}
|
// FIXME }
|
||||||
|
|
||||||
void apply( FeatureFactory factory, Block block, Class<?> tileEntityClass )
|
void apply( FeatureFactory factory, Block block, Class<?> tileEntityClass )
|
||||||
{
|
{
|
||||||
if( this.tesr != null )
|
// FIXME if( this.tesr != null )
|
||||||
{
|
// FIXME {
|
||||||
if( tileEntityClass == null )
|
// FIXME if( tileEntityClass == null )
|
||||||
{
|
// FIXME {
|
||||||
throw new IllegalStateException( "Tried to register a TESR for " + block + " even though no tile entity has been specified." );
|
// FIXME throw new IllegalStateException( "Tried to register a TESR for " + block + " even though no tile entity has been specified." );
|
||||||
}
|
// FIXME }
|
||||||
factory.addBootstrapComponent( new TesrComponent( tileEntityClass, this.tesr ) );
|
// FIXME factory.addBootstrapComponent( new TesrComponent( tileEntityClass, this.tesr ) );
|
||||||
}
|
// FIXME }
|
||||||
|
|
||||||
if( this.modelCustomizer != null )
|
if( this.modelCustomizer != null )
|
||||||
{
|
{
|
||||||
factory.addModelOverride( block.getRegistryName().getResourcePath(), this.modelCustomizer );
|
factory.addModelOverride( block.getRegistryName().getPath(), this.modelCustomizer );
|
||||||
}
|
}
|
||||||
else if( block instanceof AEBaseTileBlock )
|
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
|
// This is a default rotating model if the base-block uses an AE tile entity which exposes UP/FRONT as
|
||||||
// extended props
|
// 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
|
// TODO : 1.12
|
||||||
@@ -127,9 +122,9 @@ class BlockRendering implements IBlockRendering
|
|||||||
factory.addBootstrapComponent( new BlockColorComponent( block, this.blockColor ) );
|
factory.addBootstrapComponent( new BlockColorComponent( block, this.blockColor ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( this.stateMapper != null )
|
// FIXME if( this.stateMapper != null )
|
||||||
{
|
// FIXME {
|
||||||
factory.addBootstrapComponent( new StateMapperComponent( block, this.stateMapper ) );
|
// 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.definitions.IItemDefinition;
|
||||||
import appeng.api.util.AEColor;
|
import appeng.api.util.AEColor;
|
||||||
import appeng.api.util.AEColoredItemDefinition;
|
import appeng.api.util.AEColoredItemDefinition;
|
||||||
import appeng.bootstrap.components.BuiltInModelComponent;
|
|
||||||
import appeng.bootstrap.components.ModelOverrideComponent;
|
|
||||||
import appeng.bootstrap.components.TileEntityComponent;
|
import appeng.bootstrap.components.TileEntityComponent;
|
||||||
import appeng.core.features.AEFeature;
|
import appeng.core.features.AEFeature;
|
||||||
import appeng.core.features.ActivityState;
|
import appeng.core.features.ActivityState;
|
||||||
@@ -57,11 +55,11 @@ public class FeatureFactory
|
|||||||
|
|
||||||
private final Map<Class<? extends IBootstrapComponent>, List<IBootstrapComponent>> bootstrapComponents;
|
private final Map<Class<? extends IBootstrapComponent>, List<IBootstrapComponent>> bootstrapComponents;
|
||||||
|
|
||||||
@OnlyIn( Dist.CLIENT )
|
//FIXME @OnlyIn( Dist.CLIENT )
|
||||||
private ModelOverrideComponent modelOverrideComponent;
|
//FIXME private ModelOverrideComponent modelOverrideComponent;
|
||||||
|
|
||||||
@OnlyIn( Dist.CLIENT )
|
//FIXME @OnlyIn( Dist.CLIENT )
|
||||||
private BuiltInModelComponent builtInModelComponent;
|
//FIXME private BuiltInModelComponent builtInModelComponent;
|
||||||
|
|
||||||
public final TileEntityComponent tileEntityComponent;
|
public final TileEntityComponent tileEntityComponent;
|
||||||
|
|
||||||
@@ -75,11 +73,10 @@ public class FeatureFactory
|
|||||||
|
|
||||||
if( Platform.isClient() )
|
if( Platform.isClient() )
|
||||||
{
|
{
|
||||||
this.modelOverrideComponent = new ModelOverrideComponent();
|
// FIXME this.modelOverrideComponent = new ModelOverrideComponent();
|
||||||
this.addBootstrapComponent( this.modelOverrideComponent );
|
// FIXME this.addBootstrapComponent( this.modelOverrideComponent );
|
||||||
|
// FIXME this.builtInModelComponent = new BuiltInModelComponent();
|
||||||
this.builtInModelComponent = new BuiltInModelComponent();
|
// FIXME this.addBootstrapComponent( this.builtInModelComponent );
|
||||||
this.addBootstrapComponent( this.builtInModelComponent );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,8 +87,8 @@ public class FeatureFactory
|
|||||||
this.tileEntityComponent = parent.tileEntityComponent;
|
this.tileEntityComponent = parent.tileEntityComponent;
|
||||||
if( Platform.isClient() )
|
if( Platform.isClient() )
|
||||||
{
|
{
|
||||||
this.modelOverrideComponent = parent.modelOverrideComponent;
|
// FIXME this.modelOverrideComponent = parent.modelOverrideComponent;
|
||||||
this.builtInModelComponent = parent.builtInModelComponent;
|
// FIXME this.builtInModelComponent = parent.builtInModelComponent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,13 +139,13 @@ public class FeatureFactory
|
|||||||
@OnlyIn( Dist.CLIENT )
|
@OnlyIn( Dist.CLIENT )
|
||||||
void addBuiltInModel( String path, IUnbakedModel model )
|
void addBuiltInModel( String path, IUnbakedModel model )
|
||||||
{
|
{
|
||||||
this.builtInModelComponent.addModel( path, model );
|
// FIXME this.builtInModelComponent.addModel( path, model );
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnlyIn( Dist.CLIENT )
|
@OnlyIn( Dist.CLIENT )
|
||||||
void addModelOverride( String resourcePath, BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> customizer )
|
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 )
|
public <T extends IBootstrapComponent> Iterator<T> getBootstrapComponents( Class<T> eventType )
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ public interface IBlockRendering
|
|||||||
@OnlyIn( Dist.CLIENT )
|
@OnlyIn( Dist.CLIENT )
|
||||||
IBlockRendering blockColor( IBlockColor blockColor );
|
IBlockRendering blockColor( IBlockColor blockColor );
|
||||||
|
|
||||||
@OnlyIn( Dist.CLIENT )
|
//FIXME @OnlyIn( Dist.CLIENT )
|
||||||
IBlockRendering stateMapper( IStateMapper mapper );
|
// IBlockRendering stateMapper( IStateMapper mapper );
|
||||||
|
|
||||||
@OnlyIn( Dist.CLIENT )
|
@OnlyIn( Dist.CLIENT )
|
||||||
IBlockRendering tesr( TileEntityRenderer<?> ter );
|
IBlockRendering tesr( TileEntityRenderer<?> ter );
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ public interface IItemBuilder
|
|||||||
|
|
||||||
IItemBuilder itemGroup( ItemGroup tab );
|
IItemBuilder itemGroup( ItemGroup tab );
|
||||||
|
|
||||||
IItemBuilder rendering( ItemRenderingCustomizer callback );
|
//FIXME IItemBuilder rendering( ItemRenderingCustomizer callback );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers a custom dispenser behavior for this item.
|
* Registers a custom dispenser behavior for this item.
|
||||||
|
|||||||
@@ -22,13 +22,12 @@ package appeng.bootstrap;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
|
||||||
import net.minecraft.client.renderer.color.IItemColor;
|
import net.minecraft.client.renderer.color.IItemColor;
|
||||||
|
import net.minecraft.client.renderer.model.IUnbakedModel;
|
||||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
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).
|
* item model to be used for rendering by inspecting the item stack (i.e. for NBT data).
|
||||||
* Please
|
* Please
|
||||||
*/
|
*/
|
||||||
@OnlyIn( Dist.CLIENT )
|
//FIXME @OnlyIn( Dist.CLIENT )
|
||||||
IItemRendering meshDefinition( ItemMeshDefinition meshDefinition );
|
//FIXME IItemRendering meshDefinition( ItemMeshDefinition meshDefinition );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers an item model for meta=0, see {@link #model(int, ModelResourceLocation)}.
|
* 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.
|
* Registers a built-in model under the given resource path.
|
||||||
*/
|
*/
|
||||||
@OnlyIn( Dist.CLIENT )
|
@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 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;
|
private Supplier<IDispenseItemBehavior> dispenserBehaviorSupplier;
|
||||||
|
|
||||||
@OnlyIn( Dist.CLIENT )
|
// FIXME
|
||||||
private ItemRendering itemRendering;
|
// @OnlyIn( Dist.CLIENT )
|
||||||
|
// private ItemRendering itemRendering;
|
||||||
|
//
|
||||||
private ItemGroup itemGroup = CreativeTab.instance;
|
private ItemGroup itemGroup = CreativeTab.instance;
|
||||||
|
|
||||||
ItemDefinitionBuilder( FeatureFactory factory, String registryName, Supplier<Item> itemSupplier )
|
ItemDefinitionBuilder( FeatureFactory factory, String registryName, Supplier<Item> itemSupplier )
|
||||||
@@ -70,7 +71,7 @@ class ItemDefinitionBuilder implements IItemBuilder
|
|||||||
this.itemSupplier = itemSupplier;
|
this.itemSupplier = itemSupplier;
|
||||||
if( Platform.isClient() )
|
if( Platform.isClient() )
|
||||||
{
|
{
|
||||||
this.itemRendering = new ItemRendering();
|
// FIXME this.itemRendering = new ItemRendering();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,16 +104,16 @@ class ItemDefinitionBuilder implements IItemBuilder
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// FIXME @Override
|
||||||
public IItemBuilder rendering( ItemRenderingCustomizer callback )
|
// FIXME public IItemBuilder rendering( ItemRenderingCustomizer callback )
|
||||||
{
|
// FIXME {
|
||||||
if( Platform.isClient() )
|
// FIXME if( Platform.isClient() )
|
||||||
{
|
// FIXME {
|
||||||
this.customizeForClient( callback );
|
// FIXME this.customizeForClient( callback );
|
||||||
}
|
// FIXME }
|
||||||
|
// FIXME
|
||||||
return this;
|
// FIXME return this;
|
||||||
}
|
// FIXME }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IItemBuilder dispenserBehavior( Supplier<IDispenseItemBehavior> behavior )
|
public IItemBuilder dispenserBehavior( Supplier<IDispenseItemBehavior> behavior )
|
||||||
@@ -121,11 +122,11 @@ class ItemDefinitionBuilder implements IItemBuilder
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnlyIn( Dist.CLIENT )
|
// FIXME @OnlyIn( Dist.CLIENT )
|
||||||
private void customizeForClient( ItemRenderingCustomizer callback )
|
// FIXME private void customizeForClient( ItemRenderingCustomizer callback )
|
||||||
{
|
// FIXME {
|
||||||
callback.customize( this.itemRendering );
|
// FIXME callback.customize( this.itemRendering );
|
||||||
}
|
// FIXME }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemDefinition build()
|
public ItemDefinition build()
|
||||||
@@ -157,7 +158,7 @@ class ItemDefinitionBuilder implements IItemBuilder
|
|||||||
|
|
||||||
if( Platform.isClient() )
|
if( Platform.isClient() )
|
||||||
{
|
{
|
||||||
this.itemRendering.apply( this.factory, item );
|
// FIXME this.itemRendering.apply( this.factory, item );
|
||||||
}
|
}
|
||||||
|
|
||||||
return definition;
|
return definition;
|
||||||
|
|||||||
@@ -30,16 +30,15 @@ import com.google.common.collect.ImmutableMap;
|
|||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
|
|
||||||
import net.minecraft.client.renderer.color.IItemColor;
|
import net.minecraft.client.renderer.color.IItemColor;
|
||||||
|
import net.minecraft.client.renderer.model.IUnbakedModel;
|
||||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||||
import net.minecraft.item.BlockItem;
|
import net.minecraft.item.BlockItem;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.client.model.IModel;
|
|
||||||
|
|
||||||
import appeng.bootstrap.components.ItemColorComponent;
|
import appeng.bootstrap.components.ItemColorComponent;
|
||||||
import appeng.bootstrap.components.ItemMeshDefinitionComponent;
|
import appeng.bootstrap.components.ItemMeshDefinitionComponent;
|
||||||
@@ -53,8 +52,9 @@ class ItemRendering implements IItemRendering
|
|||||||
@OnlyIn( Dist.CLIENT )
|
@OnlyIn( Dist.CLIENT )
|
||||||
private IItemColor itemColor;
|
private IItemColor itemColor;
|
||||||
|
|
||||||
@OnlyIn( Dist.CLIENT )
|
// FIXME
|
||||||
private ItemMeshDefinition itemMeshDefinition;
|
// @OnlyIn( Dist.CLIENT )
|
||||||
|
// private ItemMeshDefinition itemMeshDefinition;
|
||||||
|
|
||||||
@OnlyIn( Dist.CLIENT )
|
@OnlyIn( Dist.CLIENT )
|
||||||
private Map<Integer, ModelResourceLocation> itemModels = new HashMap<>();
|
private Map<Integer, ModelResourceLocation> itemModels = new HashMap<>();
|
||||||
@@ -63,15 +63,16 @@ class ItemRendering implements IItemRendering
|
|||||||
private Set<ResourceLocation> variants = new HashSet<>();
|
private Set<ResourceLocation> variants = new HashSet<>();
|
||||||
|
|
||||||
@OnlyIn( Dist.CLIENT )
|
@OnlyIn( Dist.CLIENT )
|
||||||
private Map<String, IModel> builtInModels = new HashMap<>();
|
private Map<String, IUnbakedModel> builtInModels = new HashMap<>();
|
||||||
|
|
||||||
@Override
|
// FIXME
|
||||||
@OnlyIn( Dist.CLIENT )
|
// @Override
|
||||||
public IItemRendering meshDefinition( ItemMeshDefinition meshDefinition )
|
// @OnlyIn( Dist.CLIENT )
|
||||||
{
|
// public IItemRendering meshDefinition( ItemMeshDefinition meshDefinition )
|
||||||
this.itemMeshDefinition = meshDefinition;
|
// {
|
||||||
return this;
|
// this.itemMeshDefinition = meshDefinition;
|
||||||
}
|
// return this;
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@OnlyIn( Dist.CLIENT )
|
@OnlyIn( Dist.CLIENT )
|
||||||
@@ -97,7 +98,7 @@ class ItemRendering implements IItemRendering
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IItemRendering builtInModel( String name, IModel model )
|
public IItemRendering builtInModel( String name, IUnbakedModel model )
|
||||||
{
|
{
|
||||||
this.builtInModels.put( name, model );
|
this.builtInModels.put( name, model );
|
||||||
return this;
|
return this;
|
||||||
@@ -105,10 +106,10 @@ class ItemRendering implements IItemRendering
|
|||||||
|
|
||||||
void apply( FeatureFactory factory, Item item )
|
void apply( FeatureFactory factory, Item item )
|
||||||
{
|
{
|
||||||
if( this.itemMeshDefinition != null )
|
//FIXME if( this.itemMeshDefinition != null )
|
||||||
{
|
//FIXME {
|
||||||
factory.addBootstrapComponent( new ItemMeshDefinitionComponent( item, this.itemMeshDefinition ) );
|
//FIXME factory.addBootstrapComponent( new ItemMeshDefinitionComponent( item, this.itemMeshDefinition ) );
|
||||||
}
|
//FIXME }
|
||||||
|
|
||||||
if( !this.itemModels.isEmpty() )
|
if( !this.itemModels.isEmpty() )
|
||||||
{
|
{
|
||||||
@@ -118,24 +119,28 @@ class ItemRendering implements IItemRendering
|
|||||||
Set<ResourceLocation> resources = new HashSet<>( this.variants );
|
Set<ResourceLocation> resources = new HashSet<>( this.variants );
|
||||||
|
|
||||||
// Register a default item model if neither items by meta nor an item mesh definition exist
|
// 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;
|
// ModelResourceLocation model;
|
||||||
|
//
|
||||||
// For block items, the default will try to use the default state of the associated block
|
// // For block items, the default will try to use the default state of the associated block
|
||||||
if( item instanceof BlockItem )
|
// if( item instanceof BlockItem )
|
||||||
{
|
// {
|
||||||
Block block = ( (BlockItem) item ).getBlock();
|
// Block block = ( (BlockItem) item ).getBlock();
|
||||||
|
//
|
||||||
// We can only do this once the blocks are actually registered...
|
// // We can only do this once the blocks are actually registered...
|
||||||
StateMapperHelper helper = new StateMapperHelper( item.getRegistryName() );
|
// model = new ModelResourceLocation(
|
||||||
model = helper.getModelResourceLocation( block.getDefaultState() );
|
// new ResourceLocation(
|
||||||
}
|
// block.getRegistryName().getNamespace(),
|
||||||
else
|
// "block/" + block.getRegistryName().getPath()
|
||||||
{
|
// )
|
||||||
model = new ModelResourceLocation( item.getRegistryName(), "inventory" );
|
// , "inventory" );
|
||||||
}
|
// }
|
||||||
factory.addBootstrapComponent( new ItemModelComponent( item, ImmutableMap.of( 0, model ) ) );
|
// else
|
||||||
|
// {
|
||||||
|
// model = new ModelResourceLocation( item.getRegistryName(), "inventory" );
|
||||||
|
// }
|
||||||
|
// factory.addBootstrapComponent( new ItemModelComponent( item, ImmutableMap.of( 0, model ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO : 1.12
|
// TODO : 1.12
|
||||||
@@ -145,12 +150,12 @@ class ItemRendering implements IItemRendering
|
|||||||
{
|
{
|
||||||
factory.addBootstrapComponent( new ItemVariantsComponent( item, resources ) );
|
factory.addBootstrapComponent( new ItemVariantsComponent( item, resources ) );
|
||||||
}
|
}
|
||||||
else if( this.itemMeshDefinition != null )
|
// FIXME else if( this.itemMeshDefinition != null )
|
||||||
{
|
// FIXME {
|
||||||
// Adding an empty variant list here will prevent Vanilla from trying to load the default item model in this
|
// FIXME // Adding an empty variant list here will prevent Vanilla from trying to load the default item model in this
|
||||||
// case
|
// FIXME // case
|
||||||
factory.addBootstrapComponent( new ItemVariantsComponent( item, Collections.emptyList() ) );
|
// FIXME factory.addBootstrapComponent( new ItemVariantsComponent( item, Collections.emptyList() ) );
|
||||||
}
|
// FIXME }
|
||||||
|
|
||||||
if( this.itemColor != null )
|
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.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||||
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
import appeng.client.render.model.BuiltInModelLoader;
|
|
||||||
|
|
||||||
|
|
||||||
@OnlyIn( Dist.CLIENT )
|
@OnlyIn( Dist.CLIENT )
|
||||||
public class BuiltInModelComponent implements IPreInitComponent
|
public class BuiltInModelComponent implements IPreInitComponent
|
||||||
@@ -51,7 +49,7 @@ public class BuiltInModelComponent implements IPreInitComponent
|
|||||||
{
|
{
|
||||||
this.hasInitialized = true;
|
this.hasInitialized = true;
|
||||||
|
|
||||||
BuiltInModelLoader loader = new BuiltInModelLoader( this.builtInModels );
|
// FIXME BuiltInModelLoader loader = new BuiltInModelLoader( this.builtInModels );
|
||||||
ModelLoaderRegistry.registerLoader( loader );
|
// FIXME ModelLoaderRegistry.registerLoader( loader );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,5 +12,5 @@ import appeng.bootstrap.IBootstrapComponent;
|
|||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface IEntityRegistrationComponent extends IBootstrapComponent
|
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.IRecipe;
|
||||||
|
import net.minecraft.item.crafting.IRecipeSerializer;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.registries.IForgeRegistry;
|
import net.minecraftforge.registries.IForgeRegistry;
|
||||||
|
|
||||||
@@ -12,5 +13,5 @@ import appeng.bootstrap.IBootstrapComponent;
|
|||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
public interface IRecipeRegistrationComponent extends IBootstrapComponent
|
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;
|
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 net.minecraftforge.api.distmarker.Dist;
|
||||||
|
|
||||||
import appeng.bootstrap.IModelRegistry;
|
import appeng.bootstrap.IModelRegistry;
|
||||||
@@ -35,19 +32,19 @@ import appeng.bootstrap.IModelRegistry;
|
|||||||
public class ItemMeshDefinitionComponent implements IModelRegistrationComponent
|
public class ItemMeshDefinitionComponent implements IModelRegistrationComponent
|
||||||
{
|
{
|
||||||
|
|
||||||
private final Item item;
|
// FIXME private final Item item;
|
||||||
|
// FIXME
|
||||||
|
// FIXME private final ItemMeshDefinition meshDefinition;
|
||||||
|
|
||||||
private final ItemMeshDefinition meshDefinition;
|
// FIXME public ItemMeshDefinitionComponent( @Nonnull Item item, @Nonnull ItemMeshDefinition meshDefinition )
|
||||||
|
// FIXME {
|
||||||
public ItemMeshDefinitionComponent( @Nonnull Item item, @Nonnull ItemMeshDefinition meshDefinition )
|
// FIXME this.item = item;
|
||||||
{
|
// FIXME this.meshDefinition = meshDefinition;
|
||||||
this.item = item;
|
// FIXME }
|
||||||
this.meshDefinition = meshDefinition;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void modelRegistration( Dist dist, IModelRegistry registry )
|
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 com.google.common.collect.Sets;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.model.IBakedModel;
|
import net.minecraft.client.renderer.model.IBakedModel;
|
||||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
import net.minecraft.client.renderer.model.ModelBakery;
|
||||||
import net.minecraft.util.registry.IRegistry;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
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.common.MinecraftForge;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
|
||||||
@@ -42,12 +40,10 @@ import appeng.core.AppEng;
|
|||||||
public class ModelOverrideComponent implements IPreInitComponent
|
public class ModelOverrideComponent implements IPreInitComponent
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final ModelResourceLocation MODEL_MISSING = new ModelResourceLocation( "builtin/missing", "missing" );
|
|
||||||
|
|
||||||
// Maps from resource path to customizer
|
// 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 );
|
this.customizer.put( resourcePath, customizer );
|
||||||
}
|
}
|
||||||
@@ -61,19 +57,18 @@ public class ModelOverrideComponent implements IPreInitComponent
|
|||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onModelBakeEvent( final ModelBakeEvent event )
|
public void onModelBakeEvent( final ModelBakeEvent event )
|
||||||
{
|
{
|
||||||
IRegistry<ModelResourceLocation, IBakedModel> modelRegistry = event.getModelRegistry();
|
Map<ResourceLocation, IBakedModel> modelRegistry = event.getModelRegistry();
|
||||||
Set<ModelResourceLocation> keys = Sets.newHashSet( modelRegistry.getKeys() );
|
Set<ResourceLocation> keys = Sets.newHashSet( modelRegistry.keySet() );
|
||||||
// IBakedModel missingModel = modelRegistry.getObject( MODEL_MISSING );
|
IBakedModel missingModel = modelRegistry.get(ModelBakery.MODEL_MISSING);
|
||||||
IModel missingModel = ModelLoaderRegistry.getMissingModel();
|
|
||||||
|
|
||||||
for( ModelResourceLocation location : keys )
|
for( ResourceLocation location : keys )
|
||||||
{
|
{
|
||||||
if( !location.getResourceDomain().equals( AppEng.MOD_ID ) )
|
if( !location.getNamespace().equals( AppEng.MOD_ID ) )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
IBakedModel orgModel = modelRegistry.getObject( location );
|
IBakedModel orgModel = modelRegistry.get( location );
|
||||||
|
|
||||||
// Don't customize the missing model. This causes Forge to swallow exceptions
|
// Don't customize the missing model. This causes Forge to swallow exceptions
|
||||||
if( orgModel == missingModel )
|
if( orgModel == missingModel )
|
||||||
@@ -81,14 +76,14 @@ public class ModelOverrideComponent implements IPreInitComponent
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> customizer = this.customizer.get( location.getResourcePath() );
|
BiFunction<ResourceLocation, IBakedModel, IBakedModel> customizer = this.customizer.get( location.getPath() );
|
||||||
if( customizer != null )
|
if( customizer != null )
|
||||||
{
|
{
|
||||||
IBakedModel newModel = customizer.apply( location, orgModel );
|
IBakedModel newModel = customizer.apply( location, orgModel );
|
||||||
|
|
||||||
if( newModel != 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.block.Block;
|
||||||
import net.minecraft.client.Minecraft;
|
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 net.minecraftforge.api.distmarker.Dist;
|
||||||
|
|
||||||
import appeng.bootstrap.IModelRegistry;
|
import appeng.bootstrap.IModelRegistry;
|
||||||
@@ -35,24 +32,24 @@ import appeng.bootstrap.IModelRegistry;
|
|||||||
public class StateMapperComponent implements IModelRegistrationComponent
|
public class StateMapperComponent implements IModelRegistrationComponent
|
||||||
{
|
{
|
||||||
|
|
||||||
private final Block block;
|
// FIXME private final Block block;
|
||||||
|
|
||||||
private final IStateMapper stateMapper;
|
// FIXME private final IStateMapper stateMapper;
|
||||||
|
// FIXME
|
||||||
public StateMapperComponent( Block block, IStateMapper stateMapper )
|
// FIXME public StateMapperComponent( Block block, IStateMapper stateMapper )
|
||||||
{
|
// FIXME {
|
||||||
this.block = block;
|
// FIXME this.block = block;
|
||||||
this.stateMapper = stateMapper;
|
// FIXME this.stateMapper = stateMapper;
|
||||||
}
|
// FIXME }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void modelRegistration( Dist dist, IModelRegistry registry )
|
public void modelRegistration( Dist dist, IModelRegistry registry )
|
||||||
{
|
{
|
||||||
registry.setCustomStateMapper( this.block, this.stateMapper );
|
// FIXME registry.setCustomStateMapper( this.block, this.stateMapper );
|
||||||
if( this.stateMapper instanceof IResourceManagerReloadListener )
|
// FIXME if( this.stateMapper instanceof IResourceManagerReloadListener )
|
||||||
{
|
// FIXME {
|
||||||
( (IReloadableResourceManager) Minecraft.getInstance().getResourceManager() )
|
// FIXME ( (IReloadableResourceManager) Minecraft.getInstance().getResourceManager() )
|
||||||
.registerReloadListener( (IResourceManagerReloadListener) this.stateMapper );
|
// FIXME .registerReloadListener( (IResourceManagerReloadListener) this.stateMapper );
|
||||||
}
|
// FIXME }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class TileEntityComponent implements IPreInitComponent
|
|||||||
{
|
{
|
||||||
if( !tileEntityDefinition.isRegistered() )
|
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 );
|
tileEntityDefinition.setRegistered( true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,8 +22,6 @@ package appeng.client;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import appeng.client.render.tesr.InscriberTESR;
|
|
||||||
import appeng.client.render.textures.ParticleTextures;
|
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.settings.KeyBinding;
|
import net.minecraft.client.settings.KeyBinding;
|
||||||
@@ -46,12 +44,7 @@ import appeng.api.util.AEColor;
|
|||||||
import appeng.block.AEBaseBlock;
|
import appeng.block.AEBaseBlock;
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
import appeng.core.AppEng;
|
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.helpers.IMouseWheelItem;
|
||||||
import appeng.hooks.TickHandler;
|
|
||||||
import appeng.hooks.TickHandler.PlayerColor;
|
|
||||||
import appeng.server.ServerHelper;
|
import appeng.server.ServerHelper;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||||
@@ -213,22 +206,21 @@ public class ClientHelper extends ServerHelper
|
|||||||
|
|
||||||
private void postPlayerRender( final RenderLivingEvent.Pre p )
|
private void postPlayerRender( final RenderLivingEvent.Pre p )
|
||||||
{
|
{
|
||||||
final PlayerColor player = TickHandler.INSTANCE.getPlayerColors().get( p.getEntity().getEntityId() );
|
// FIXME final PlayerColor player = TickHandler.INSTANCE.getPlayerColors().get( p.getEntity().getEntityId() );
|
||||||
if( player != null )
|
// FIXME if( player != null )
|
||||||
{
|
// FIXME {
|
||||||
final AEColor col = player.myColor;
|
// FIXME final AEColor col = player.myColor;
|
||||||
|
// FIXME final float r = 0xff & ( col.mediumVariant >> 16 );
|
||||||
final float r = 0xff & ( col.mediumVariant >> 16 );
|
// FIXME final float g = 0xff & ( col.mediumVariant >> 8 );
|
||||||
final float g = 0xff & ( col.mediumVariant >> 8 );
|
// FIXME final float b = 0xff & ( col.mediumVariant );
|
||||||
final float b = 0xff & ( col.mediumVariant );
|
// FIXME // FIXME: This is most certainly not going to work!
|
||||||
// FIXME: This is most certainly not going to work!
|
// FIXME GlStateManager.color4f( r / 255.0f, g / 255.0f, b / 255.0f, 1.0f );
|
||||||
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 )
|
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 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 );
|
// FIXME Minecraft.getInstance().particles.addEffect( fx );
|
||||||
@@ -305,15 +297,15 @@ public class ClientHelper extends ServerHelper
|
|||||||
|
|
||||||
if( mainHand || offHand )
|
if( mainHand || offHand )
|
||||||
{
|
{
|
||||||
try
|
// FIXME try
|
||||||
{
|
// FIXME {
|
||||||
NetworkHandler.instance().sendToServer( new PacketValueConfig( "Item", me.getScrollDelta() > 0 ? "WheelUp" : "WheelDown" ) );
|
// FIXME NetworkHandler.instance().sendToServer( new PacketValueConfig( "Item", me.getScrollDelta() > 0 ? "WheelUp" : "WheelDown" ) );
|
||||||
me.setCanceled( true );
|
// FIXME me.setCanceled( true );
|
||||||
}
|
// FIXME }
|
||||||
catch( final IOException e )
|
// FIXME catch( final IOException e )
|
||||||
{
|
// FIXME {
|
||||||
AELog.debug( e );
|
// FIXME AELog.debug( e );
|
||||||
}
|
// FIXME }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -321,8 +313,8 @@ public class ClientHelper extends ServerHelper
|
|||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onTextureStitch( final TextureStitchEvent.Pre event )
|
public void onTextureStitch( final TextureStitchEvent.Pre event )
|
||||||
{
|
{
|
||||||
ParticleTextures.registerSprite( event );
|
// FIXME ParticleTextures.registerSprite( event );
|
||||||
InscriberTESR.registerTexture( event );
|
// FIXME InscriberTESR.registerTexture( event );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -331,7 +331,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
final CompoundNBT encodedValue = itemStack.getTagCompound();
|
final CompoundNBT encodedValue = itemStack.getTag();
|
||||||
|
|
||||||
if( encodedValue == null )
|
if( encodedValue == null )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ public class FacadeDispatcherBakedModel extends DelegateBakedModel
|
|||||||
|
|
||||||
ItemStack textureItem = itemFacade.getTextureItem( stack );
|
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 );
|
FacadeBakedItemModel model = FacadeDispatcherBakedModel.this.cache.get( hash );
|
||||||
if( model == null )
|
if( model == null )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,18 +19,32 @@
|
|||||||
package appeng.client.render.effects;
|
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.client.particle.RedstoneParticle;
|
||||||
|
import net.minecraft.particles.BasicParticleType;
|
||||||
|
import net.minecraft.particles.RedstoneParticleData;
|
||||||
import net.minecraft.world.World;
|
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 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 )
|
static {
|
||||||
{
|
TYPE.setRegistryName(AppEng.MOD_ID, "charged_ore_fx");
|
||||||
super( w, x, y, z, 0.21f, 0.61f, 1.0f );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
@Override
|
||||||
public int getBrightnessForRender( final float par1 )
|
public int getBrightnessForRender( final float par1 )
|
||||||
{
|
{
|
||||||
@@ -43,4 +57,17 @@ public class ChargedOreFX extends RedstoneParticle
|
|||||||
}
|
}
|
||||||
return j1 << 20 | j1 << 4;
|
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.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
import javax.vecmath.Vector3f;
|
|
||||||
import javax.vecmath.Vector4f;
|
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.cache.CacheBuilder;
|
import com.google.common.cache.CacheBuilder;
|
||||||
@@ -32,9 +30,7 @@ import com.google.common.cache.LoadingCache;
|
|||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.client.renderer.model.BakedQuad;
|
import net.minecraft.client.renderer.model.BakedQuad;
|
||||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
import net.minecraft.client.renderer.model.IBakedModel;
|
||||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
|
||||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||||
import net.minecraft.client.renderer.vertex.VertexFormatElement;
|
import net.minecraft.client.renderer.vertex.VertexFormatElement;
|
||||||
@@ -42,8 +38,6 @@ import net.minecraft.util.Direction;
|
|||||||
import net.minecraft.util.math.Vec3i;
|
import net.minecraft.util.math.Vec3i;
|
||||||
import net.minecraftforge.client.model.pipeline.IVertexConsumer;
|
import net.minecraftforge.client.model.pipeline.IVertexConsumer;
|
||||||
import net.minecraftforge.client.model.pipeline.QuadGatheringTransformer;
|
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.block.AEBaseTileBlock;
|
||||||
import appeng.client.render.FacingToRotation;
|
import appeng.client.render.FacingToRotation;
|
||||||
@@ -143,7 +137,7 @@ public class AutoRotatingModel implements IBakedModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 ) )
|
if( !( state instanceof IExtendedBlockState ) )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,24 +23,24 @@ import java.util.Map;
|
|||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.model.IUnbakedModel;
|
||||||
import net.minecraft.resources.IResourceManager;
|
import net.minecraft.resources.IResourceManager;
|
||||||
import net.minecraft.resources.IResourceManagerReloadListener;
|
import net.minecraft.resources.IResourceManagerReloadListener;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.client.model.ICustomModelLoader;
|
|
||||||
import net.minecraftforge.client.model.IModel;
|
|
||||||
|
|
||||||
import appeng.core.AppEng;
|
import appeng.core.AppEng;
|
||||||
|
import net.minecraftforge.client.model.IModelLoader;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages built-in models.
|
* 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 );
|
this.builtInModels = ImmutableMap.copyOf( builtInModels );
|
||||||
}
|
}
|
||||||
@@ -48,7 +48,7 @@ public class BuiltInModelLoader implements ICustomModelLoader
|
|||||||
@Override
|
@Override
|
||||||
public boolean accepts( ResourceLocation modelLocation )
|
public boolean accepts( ResourceLocation modelLocation )
|
||||||
{
|
{
|
||||||
if( !modelLocation.getResourceDomain().equals( AppEng.MOD_ID ) )
|
if( !modelLocation.getNamespace().equals( AppEng.MOD_ID ) )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,17 +32,13 @@ import com.google.common.base.Strings;
|
|||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.client.renderer.model.BakedQuad;
|
import net.minecraft.client.renderer.model.BakedQuad;
|
||||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
import net.minecraft.client.renderer.model.IBakedModel;
|
||||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
|
||||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.util.math.Vec3d;
|
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.BlockQuartzGlass;
|
||||||
import appeng.decorative.solid.GlassState;
|
import appeng.decorative.solid.GlassState;
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !this.data.hasNoTags() )
|
if( !this.data.isEmpty() )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -374,7 +374,7 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
|
|||||||
final String name = '=' + Long.toString( inv.which, Character.MAX_RADIX );
|
final String name = '=' + Long.toString( inv.which, Character.MAX_RADIX );
|
||||||
final CompoundNBT tag = data.getCompoundTag( name );
|
final CompoundNBT tag = data.getCompoundTag( name );
|
||||||
|
|
||||||
if( tag.hasNoTags() )
|
if( tag.isEmpty() )
|
||||||
{
|
{
|
||||||
tag.putLong( "sortBy", inv.sortBy );
|
tag.putLong( "sortBy", inv.sortBy );
|
||||||
tag.putString("un", inv.unlocalizedName);
|
tag.putString("un", inv.unlocalizedName);
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ package appeng.core;
|
|||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
import appeng.tile.AEBaseTile;
|
||||||
import org.apache.logging.log4j.Level;
|
import org.apache.logging.log4j.Level;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
@@ -319,13 +320,13 @@ public final class AELog
|
|||||||
* @param pos
|
* @param pos
|
||||||
* @param aeBaseTile
|
* @param aeBaseTile
|
||||||
*/
|
*/
|
||||||
// FIXME public static void blockUpdate( @Nonnull final BlockPos pos, @Nonnull final AEBaseTile aeBaseTile )
|
public static void blockUpdate( @Nonnull final BlockPos pos, @Nonnull final AEBaseTile aeBaseTile )
|
||||||
// FIXME {
|
{
|
||||||
// FIXME if( AEConfig.instance().isFeatureEnabled( AEFeature.UPDATE_LOGGING ) )
|
if( AEConfig.instance().isFeatureEnabled( AEFeature.UPDATE_LOGGING ) )
|
||||||
// FIXME {
|
{
|
||||||
// FIXME info( BLOCK_UPDATE, aeBaseTile.getClass().getName(), pos );
|
info( BLOCK_UPDATE, aeBaseTile.getClass().getName(), pos );
|
||||||
// FIXME }
|
}
|
||||||
// FIXME }
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use to check for an enabled crafting log.
|
* Use to check for an enabled crafting log.
|
||||||
|
|||||||
@@ -22,67 +22,64 @@ package appeng.core;
|
|||||||
import appeng.api.IAppEngApi;
|
import appeng.api.IAppEngApi;
|
||||||
import appeng.api.features.IRegistryContainer;
|
import appeng.api.features.IRegistryContainer;
|
||||||
import appeng.api.networking.IGridHelper;
|
import appeng.api.networking.IGridHelper;
|
||||||
|
import appeng.api.parts.IPartHelper;
|
||||||
import appeng.api.storage.IStorageHelper;
|
import appeng.api.storage.IStorageHelper;
|
||||||
import appeng.api.util.IClientHelper;
|
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.PartModels;
|
||||||
import appeng.core.features.registries.RegistryContainer;
|
|
||||||
|
|
||||||
|
|
||||||
public final class Api implements IAppEngApi
|
public final class Api implements IAppEngApi
|
||||||
{
|
{
|
||||||
public static final Api INSTANCE = new Api();
|
public static final Api INSTANCE = new Api();
|
||||||
|
|
||||||
private final ApiPart partHelper;
|
// FIXME private final ApiPart partHelper;
|
||||||
|
|
||||||
// private MovableTileRegistry MovableRegistry = new MovableTileRegistry();
|
// private MovableTileRegistry MovableRegistry = new MovableTileRegistry();
|
||||||
private final IRegistryContainer registryContainer;
|
// FIXME private final IRegistryContainer registryContainer;
|
||||||
private final IStorageHelper storageHelper;
|
// FIXME private final IStorageHelper storageHelper;
|
||||||
private final IGridHelper networkHelper;
|
// FIXME private final IGridHelper networkHelper;
|
||||||
private final ApiDefinitions definitions;
|
private final ApiDefinitions definitions;
|
||||||
private final IClientHelper client;
|
// FIXME private final IClientHelper client;
|
||||||
|
|
||||||
private Api()
|
private Api()
|
||||||
{
|
{
|
||||||
this.storageHelper = new ApiStorage();
|
// FIXME this.storageHelper = new ApiStorage();
|
||||||
this.networkHelper = new ApiGrid();
|
// FIXME this.networkHelper = new ApiGrid();
|
||||||
this.registryContainer = new RegistryContainer();
|
// FIXME this.registryContainer = new RegistryContainer();
|
||||||
this.partHelper = new ApiPart();
|
// FIXME this.partHelper = new ApiPart();
|
||||||
this.definitions = new ApiDefinitions( (PartModels) this.registryContainer.partModels() );
|
PartModels partModels = new PartModels();
|
||||||
this.client = new ApiClientHelper();
|
this.definitions = new ApiDefinitions( partModels /* FIXME (PartModels) this.registryContainer.partModels() */ );
|
||||||
|
// FIXME this.client = new ApiClientHelper();
|
||||||
}
|
}
|
||||||
|
|
||||||
public PartModels getPartModels()
|
// FIXME public PartModels getPartModels()
|
||||||
{
|
// FIXME {
|
||||||
return (PartModels) this.registryContainer.partModels();
|
// FIXME return (PartModels) this.registryContainer.partModels();
|
||||||
}
|
// FIXME }
|
||||||
|
// FIXME
|
||||||
@Override
|
// FIXME @Override
|
||||||
public IRegistryContainer registries()
|
// FIXME public IRegistryContainer registries()
|
||||||
{
|
// FIXME {
|
||||||
return this.registryContainer;
|
// FIXME return this.registryContainer;
|
||||||
}
|
// FIXME }
|
||||||
|
// FIXME
|
||||||
@Override
|
// FIXME @Override
|
||||||
public IStorageHelper storage()
|
// FIXME public IStorageHelper storage()
|
||||||
{
|
// FIXME {
|
||||||
return this.storageHelper;
|
// FIXME return this.storageHelper;
|
||||||
}
|
// FIXME }
|
||||||
|
// FIXME
|
||||||
@Override
|
// FIXME @Override
|
||||||
public IGridHelper grid()
|
// FIXME public IGridHelper grid()
|
||||||
{
|
// FIXME {
|
||||||
return this.networkHelper;
|
// FIXME return this.networkHelper;
|
||||||
}
|
// FIXME }
|
||||||
|
// FIXME
|
||||||
@Override
|
// FIXME @Override
|
||||||
public ApiPart partHelper()
|
// FIXME public ApiPart partHelper()
|
||||||
{
|
// FIXME {
|
||||||
return this.partHelper;
|
// FIXME return this.partHelper;
|
||||||
}
|
// FIXME }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApiDefinitions definitions()
|
public ApiDefinitions definitions()
|
||||||
@@ -90,9 +87,35 @@ public final class Api implements IAppEngApi
|
|||||||
return this.definitions;
|
return this.definitions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME @Override
|
||||||
|
// FIXME public IClientHelper client()
|
||||||
|
// FIXME {
|
||||||
|
// FIXME return this.client;
|
||||||
|
// FIXME }
|
||||||
|
|
||||||
|
// FIXME
|
||||||
@Override
|
@Override
|
||||||
public IClientHelper client()
|
public IRegistryContainer registries() {
|
||||||
{
|
return null;
|
||||||
return this.client;
|
}
|
||||||
|
// 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.IDefinitions;
|
||||||
|
import appeng.api.definitions.IItems;
|
||||||
|
import appeng.api.definitions.IMaterials;
|
||||||
|
import appeng.api.definitions.IParts;
|
||||||
import appeng.bootstrap.FeatureFactory;
|
import appeng.bootstrap.FeatureFactory;
|
||||||
import appeng.core.api.definitions.ApiBlocks;
|
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;
|
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.
|
// TODO : Check if this can be final again after the Register part.
|
||||||
private ApiBlocks blocks;
|
private ApiBlocks blocks;
|
||||||
private ApiItems items;
|
// private ApiItems items;
|
||||||
private final ApiMaterials materials;
|
//private final ApiMaterials materials;
|
||||||
private final ApiParts parts;
|
//private final ApiParts parts;
|
||||||
|
|
||||||
private final FeatureFactory registry = new FeatureFactory();
|
private final FeatureFactory registry = new FeatureFactory();
|
||||||
|
|
||||||
public ApiDefinitions( final PartModels partModels )
|
public ApiDefinitions( final PartModels partModels )
|
||||||
{
|
{
|
||||||
this.blocks = new ApiBlocks( this.registry, partModels );
|
this.blocks = new ApiBlocks( this.registry, partModels );
|
||||||
this.items = new ApiItems( this.registry );
|
// this.items = new ApiItems( this.registry );
|
||||||
this.materials = new ApiMaterials( this.registry );
|
//this.materials = new ApiMaterials( this.registry );
|
||||||
this.parts = new ApiParts( this.registry, partModels );
|
//this.parts = new ApiParts( this.registry, partModels );
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// public void addBlocks( final PartModels partModels )
|
// public void addBlocks( final PartModels partModels )
|
||||||
@@ -61,7 +61,7 @@ public final class ApiDefinitions implements IDefinitions
|
|||||||
|
|
||||||
public FeatureFactory getRegistry()
|
public FeatureFactory getRegistry()
|
||||||
{
|
{
|
||||||
return this.registry;
|
return registry;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -71,20 +71,20 @@ public final class ApiDefinitions implements IDefinitions
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApiItems items()
|
public IItems items()
|
||||||
{
|
{
|
||||||
return this.items;
|
return null /* FIXME */;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApiMaterials materials()
|
public IMaterials materials()
|
||||||
{
|
{
|
||||||
return this.materials;
|
return null /* FIXME */;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 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.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.event.RegistryEvent;
|
||||||
|
import net.minecraftforge.eventbus.api.IEventBus;
|
||||||
import net.minecraftforge.fml.CrashReportExtender;
|
import net.minecraftforge.fml.CrashReportExtender;
|
||||||
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
import net.minecraftforge.fml.ModLoadingContext;
|
import net.minecraftforge.fml.ModLoadingContext;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
|
|
||||||
@@ -30,6 +40,7 @@ import net.minecraftforge.fml.config.ModConfig;
|
|||||||
|
|
||||||
import appeng.core.crash.ModCrashEnhancement;
|
import appeng.core.crash.ModCrashEnhancement;
|
||||||
import appeng.services.export.ExportConfig;
|
import appeng.services.export.ExportConfig;
|
||||||
|
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||||
|
|
||||||
@Mod(AppEng.MOD_ID)
|
@Mod(AppEng.MOD_ID)
|
||||||
public final class AppEng
|
public final class AppEng
|
||||||
@@ -65,12 +76,22 @@ public final class AppEng
|
|||||||
|
|
||||||
ModLoadingContext.get().registerConfig(ModConfig.Type.CLIENT, AEConfig.CLIENT_SPEC);
|
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() );
|
CrashReportExtender.registerCrashCallable( new ModCrashEnhancement() );
|
||||||
|
|
||||||
//FIXMEthis.registration = new Registration();
|
//FIXMEthis.registration = new Registration();
|
||||||
//FIXMEMinecraftForge.EVENT_BUS.register( this.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
|
// @Nonnull
|
||||||
|
|||||||
@@ -27,237 +27,188 @@ import java.util.Set;
|
|||||||
|
|
||||||
import javax.annotation.Nonnull;
|
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 com.google.common.base.Preconditions;
|
||||||
|
|
||||||
import net.minecraft.advancements.CriteriaTriggers;
|
import net.minecraft.advancements.CriteriaTriggers;
|
||||||
import net.minecraft.advancements.ICriterionInstance;
|
import net.minecraft.advancements.ICriterionInstance;
|
||||||
import net.minecraft.advancements.ICriterionTrigger;
|
import net.minecraft.advancements.ICriterionTrigger;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.block.statemap.IStateMapper;
|
import net.minecraft.client.renderer.ItemModelMesher;
|
||||||
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
import net.minecraft.client.renderer.model.ModelResourceLocation;
|
||||||
|
import net.minecraft.entity.EntityType;
|
||||||
import net.minecraft.item.Item;
|
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.util.ResourceLocation;
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraft.world.biome.Biome;
|
|
||||||
import net.minecraft.world.dimension.DimensionType;
|
import net.minecraft.world.dimension.DimensionType;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||||
import net.minecraftforge.client.model.ModelLoader;
|
import net.minecraftforge.client.event.ParticleFactoryRegisterEvent;
|
||||||
import net.minecraftforge.common.DimensionManager;
|
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
|
||||||
import net.minecraftforge.event.AttachCapabilitiesEvent;
|
|
||||||
import net.minecraftforge.event.RegistryEvent;
|
import net.minecraftforge.event.RegistryEvent;
|
||||||
|
import net.minecraftforge.eventbus.api.GenericEvent;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
|
||||||
import net.minecraftforge.fml.loading.FMLEnvironment;
|
import net.minecraftforge.fml.loading.FMLEnvironment;
|
||||||
import net.minecraftforge.registries.IForgeRegistry;
|
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.IBlockRegistrationComponent;
|
||||||
import appeng.bootstrap.components.IEntityRegistrationComponent;
|
|
||||||
import appeng.bootstrap.components.IInitComponent;
|
|
||||||
import appeng.bootstrap.components.IItemRegistrationComponent;
|
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
|
final class Registration
|
||||||
{
|
{
|
||||||
DimensionType storageDimensionType;
|
// DimensionType storageDimensionType;
|
||||||
int storageDimensionID;
|
// int storageDimensionID;
|
||||||
Biome storageBiome;
|
// Biome storageBiome;
|
||||||
AdvancementTriggers advancementTriggers;
|
// AdvancementTriggers advancementTriggers;
|
||||||
|
//
|
||||||
void preInitialize( final FMLPreInitializationEvent event )
|
// void preInitialize( final FMLPreInitializationEvent event )
|
||||||
{
|
// {
|
||||||
Capabilities.register();
|
// Capabilities.register();
|
||||||
|
//
|
||||||
final Api api = Api.INSTANCE;
|
// final Api api = Api.INSTANCE;
|
||||||
final IRecipeHandlerRegistry recipeRegistry = api.registries().recipes();
|
// final IRecipeHandlerRegistry recipeRegistry = api.registries().recipes();
|
||||||
this.registerCraftHandlers( recipeRegistry );
|
// this.registerCraftHandlers( recipeRegistry );
|
||||||
|
//
|
||||||
MinecraftForge.EVENT_BUS.register( OreDictionaryHandler.INSTANCE );
|
// MinecraftForge.EVENT_BUS.register( OreDictionaryHandler.INSTANCE );
|
||||||
|
//
|
||||||
ApiDefinitions definitions = api.definitions();
|
// ApiDefinitions definitions = api.definitions();
|
||||||
|
//
|
||||||
// Register
|
// // Register
|
||||||
definitions.getRegistry().getBootstrapComponents( IPreInitComponent.class ).forEachRemaining( b -> b.preInitialize( event.getSide() ) );
|
// definitions.getRegistry().getBootstrapComponents( IPreInitComponent.class ).forEachRemaining( b -> b.preInitialize( event.getSide() ) );
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
private void registerSpatialBiome( IForgeRegistry<Biome> registry )
|
// private void registerSpatialBiome( IForgeRegistry<Biome> registry )
|
||||||
{
|
// {
|
||||||
if( !AEConfig.instance().isFeatureEnabled( AEFeature.SPATIAL_IO ) )
|
// if( !AEConfig.instance().isFeatureEnabled( AEFeature.SPATIAL_IO ) )
|
||||||
{
|
// {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if( this.storageBiome == null )
|
// if( this.storageBiome == null )
|
||||||
{
|
// {
|
||||||
this.storageBiome = new BiomeGenStorage();
|
// this.storageBiome = new BiomeGenStorage();
|
||||||
}
|
// }
|
||||||
registry.register( this.storageBiome.setRegistryName( "appliedenergistics2:storage_biome" ) );
|
// registry.register( this.storageBiome.setRegistryName( "appliedenergistics2:storage_biome" ) );
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
private void registerSpatialDimension()
|
// private void registerSpatialDimension()
|
||||||
{
|
// {
|
||||||
final AEConfig config = AEConfig.instance();
|
// final AEConfig config = AEConfig.instance();
|
||||||
if( !config.isFeatureEnabled( AEFeature.SPATIAL_IO ) )
|
// if( !config.isFeatureEnabled( AEFeature.SPATIAL_IO ) )
|
||||||
{
|
// {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
if( config.getStorageProviderID() == -1 )
|
// if( config.getStorageProviderID() == -1 )
|
||||||
{
|
// {
|
||||||
final Set<Integer> ids = new HashSet<>();
|
// final Set<Integer> ids = new HashSet<>();
|
||||||
for( DimensionType type : DimensionType.values() )
|
// for( DimensionType type : DimensionType.values() )
|
||||||
{
|
// {
|
||||||
ids.add( type.getId() );
|
// ids.add( type.getId() );
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
int newId = -11;
|
// int newId = -11;
|
||||||
while( ids.contains( newId ) )
|
// while( ids.contains( newId ) )
|
||||||
{
|
// {
|
||||||
--newId;
|
// --newId;
|
||||||
}
|
// }
|
||||||
config.setStorageProviderID( newId );
|
// config.setStorageProviderID( newId );
|
||||||
config.save();
|
// config.save();
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
this.storageDimensionType = DimensionType.register( "Storage Cell", "_cell", config.getStorageProviderID(), StorageWorldProvider.class, true );
|
// this.storageDimensionType = DimensionType.register( "Storage Cell", "_cell", config.getStorageProviderID(), StorageWorldProvider.class, true );
|
||||||
|
//
|
||||||
if( config.getStorageDimensionID() == -1 )
|
// if( config.getStorageDimensionID() == -1 )
|
||||||
{
|
// {
|
||||||
config.setStorageDimensionID( DimensionManager.getNextFreeDimId() );
|
// config.setStorageDimensionID( DimensionManager.getNextFreeDimId() );
|
||||||
config.save();
|
// config.save();
|
||||||
}
|
// }
|
||||||
this.storageDimensionID = config.getStorageDimensionID();
|
// this.storageDimensionID = config.getStorageDimensionID();
|
||||||
|
//
|
||||||
DimensionManager.registerDimension( this.storageDimensionID, this.storageDimensionType );
|
// DimensionManager.registerDimension( this.storageDimensionID, this.storageDimensionType );
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
private void registerCraftHandlers( final IRecipeHandlerRegistry registry )
|
// private void registerCraftHandlers( final IRecipeHandlerRegistry registry )
|
||||||
{
|
// {
|
||||||
registry.addNewSubItemResolver( new AEItemResolver() );
|
// registry.addNewSubItemResolver( new AEItemResolver() );
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
public void initialize( @Nonnull final FMLInitializationEvent event, @Nonnull final File recipeDirectory )
|
// public void initialize( @Nonnull final FMLInitializationEvent event, @Nonnull final File recipeDirectory )
|
||||||
{
|
// {
|
||||||
Preconditions.checkNotNull( event );
|
// Preconditions.checkNotNull( event );
|
||||||
Preconditions.checkNotNull( recipeDirectory );
|
// Preconditions.checkNotNull( recipeDirectory );
|
||||||
Preconditions.checkArgument( !recipeDirectory.isFile() );
|
// Preconditions.checkArgument( !recipeDirectory.isFile() );
|
||||||
|
//
|
||||||
final Api api = Api.INSTANCE;
|
// final Api api = Api.INSTANCE;
|
||||||
final IRegistryContainer registries = api.registries();
|
// final IRegistryContainer registries = api.registries();
|
||||||
|
//
|
||||||
ApiDefinitions definitions = api.definitions();
|
// ApiDefinitions definitions = api.definitions();
|
||||||
definitions.getRegistry().getBootstrapComponents( IInitComponent.class ).forEachRemaining( b -> b.initialize( event.getSide() ) );
|
// definitions.getRegistry().getBootstrapComponents( IInitComponent.class ).forEachRemaining( b -> b.initialize( event.getSide() ) );
|
||||||
|
//
|
||||||
MinecraftForge.EVENT_BUS.register( TickHandler.INSTANCE );
|
// MinecraftForge.EVENT_BUS.register( TickHandler.INSTANCE );
|
||||||
|
//
|
||||||
MinecraftForge.EVENT_BUS.register( new PartPlacement() );
|
// MinecraftForge.EVENT_BUS.register( new PartPlacement() );
|
||||||
|
//
|
||||||
final IGridCacheRegistry gcr = registries.gridCache();
|
// final IGridCacheRegistry gcr = registries.gridCache();
|
||||||
gcr.registerGridCache( ITickManager.class, TickManagerCache.class );
|
// gcr.registerGridCache( ITickManager.class, TickManagerCache.class );
|
||||||
gcr.registerGridCache( IEnergyGrid.class, EnergyGridCache.class );
|
// gcr.registerGridCache( IEnergyGrid.class, EnergyGridCache.class );
|
||||||
gcr.registerGridCache( IPathingGrid.class, PathGridCache.class );
|
// gcr.registerGridCache( IPathingGrid.class, PathGridCache.class );
|
||||||
gcr.registerGridCache( IStorageGrid.class, GridStorageCache.class );
|
// gcr.registerGridCache( IStorageGrid.class, GridStorageCache.class );
|
||||||
gcr.registerGridCache( P2PCache.class, P2PCache.class );
|
// gcr.registerGridCache( P2PCache.class, P2PCache.class );
|
||||||
gcr.registerGridCache( ISpatialCache.class, SpatialPylonCache.class );
|
// gcr.registerGridCache( ISpatialCache.class, SpatialPylonCache.class );
|
||||||
gcr.registerGridCache( ISecurityGrid.class, SecurityCache.class );
|
// gcr.registerGridCache( ISecurityGrid.class, SecurityCache.class );
|
||||||
gcr.registerGridCache( ICraftingGrid.class, CraftingGridCache.class );
|
// gcr.registerGridCache( ICraftingGrid.class, CraftingGridCache.class );
|
||||||
|
//
|
||||||
registries.cell().addCellHandler( new BasicCellHandler() );
|
// registries.cell().addCellHandler( new BasicCellHandler() );
|
||||||
registries.cell().addCellHandler( new CreativeCellHandler() );
|
// registries.cell().addCellHandler( new CreativeCellHandler() );
|
||||||
registries.cell().addCellGuiHandler( new BasicItemCellGuiHandler() );
|
// registries.cell().addCellGuiHandler( new BasicItemCellGuiHandler() );
|
||||||
registries.cell().addCellGuiHandler( new BasicFluidCellGuiHandler() );
|
// registries.cell().addCellGuiHandler( new BasicFluidCellGuiHandler() );
|
||||||
|
//
|
||||||
api.definitions().materials().matterBall().maybeStack( 1 ).ifPresent( ammoStack ->
|
// api.definitions().materials().matterBall().maybeStack( 1 ).ifPresent( ammoStack ->
|
||||||
{
|
// {
|
||||||
final double weight = 32;
|
// final double weight = 32;
|
||||||
|
//
|
||||||
registries.matterCannon().registerAmmo( ammoStack, weight );
|
// registries.matterCannon().registerAmmo( ammoStack, weight );
|
||||||
} );
|
// } );
|
||||||
|
//
|
||||||
PartItemPredicate.register();
|
// PartItemPredicate.register();
|
||||||
Stats.register();
|
// Stats.register();
|
||||||
this.advancementTriggers = new AdvancementTriggers( new CriterionTrigggerRegistry() );
|
// this.advancementTriggers = new AdvancementTriggers( new CriterionTrigggerRegistry() );
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@SubscribeEvent
|
// @SubscribeEvent
|
||||||
public void registerBiomes( RegistryEvent.Register<Biome> event )
|
// public void registerBiomes( RegistryEvent.Register<Biome> event )
|
||||||
{
|
// {
|
||||||
final IForgeRegistry<Biome> registry = event.getRegistry();
|
// final IForgeRegistry<Biome> registry = event.getRegistry();
|
||||||
this.registerSpatialBiome( registry );
|
// this.registerSpatialBiome( registry );
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@SubscribeEvent
|
|
||||||
@OnlyIn( Dist.CLIENT )
|
@OnlyIn( Dist.CLIENT )
|
||||||
public void modelRegistryEvent( ModelRegistryEvent event )
|
public void modelRegistryEvent( ModelRegistryEvent event )
|
||||||
{
|
{
|
||||||
final ApiDefinitions definitions = Api.INSTANCE.definitions();
|
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;
|
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 )
|
public void registerBlocks( RegistryEvent.Register<Block> event )
|
||||||
{
|
{
|
||||||
final IForgeRegistry<Block> registry = event.getRegistry();
|
final IForgeRegistry<Block> registry = event.getRegistry();
|
||||||
@@ -266,7 +217,6 @@ final class Registration
|
|||||||
definitions.getRegistry().getBootstrapComponents( IBlockRegistrationComponent.class ).forEachRemaining( b -> b.blockRegistration( dist, registry ) );
|
definitions.getRegistry().getBootstrapComponents( IBlockRegistrationComponent.class ).forEachRemaining( b -> b.blockRegistration( dist, registry ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
|
||||||
public void registerItems( RegistryEvent.Register<Item> event )
|
public void registerItems( RegistryEvent.Register<Item> event )
|
||||||
{
|
{
|
||||||
final IForgeRegistry<Item> registry = event.getRegistry();
|
final IForgeRegistry<Item> registry = event.getRegistry();
|
||||||
@@ -275,289 +225,300 @@ final class Registration
|
|||||||
definitions.getRegistry().getBootstrapComponents( IItemRegistrationComponent.class ).forEachRemaining( b -> b.itemRegistration( dist, registry ) );
|
definitions.getRegistry().getBootstrapComponents( IItemRegistrationComponent.class ).forEachRemaining( b -> b.itemRegistration( dist, registry ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
// @SubscribeEvent
|
||||||
public void registerRecipes( RegistryEvent.Register<IRecipe> event )
|
// 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 IForgeRegistry<EntityType<?>> 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 ApiDefinitions definitions = Api.INSTANCE.definitions();
|
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 registerParticleTypes( RegistryEvent.Register<ParticleType<?>> event )
|
||||||
public void attachSpatialDimensionManager( AttachCapabilitiesEvent<World> event )
|
|
||||||
{
|
{
|
||||||
if( AEConfig.instance()
|
final IForgeRegistry<ParticleType<?>> registry = event.getRegistry();
|
||||||
.isFeatureEnabled( AEFeature.SPATIAL_IO ) && event.getObject() == DimensionManager.getWorld( AEConfig.instance().getStorageDimensionID() ) )
|
registry.register(ChargedOreFX.TYPE);
|
||||||
{
|
|
||||||
event.addCapability( new ResourceLocation( "appliedenergistics2:spatial_dimension_manager" ), new SpatialDimensionManager( event.getObject() ) );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void postInit( final FMLPostInitializationEvent event )
|
public void registerParticleFactories(ParticleFactoryRegisterEvent evt) {
|
||||||
{
|
Minecraft.getInstance().particles.registerFactory(ChargedOreFX.TYPE, ChargedOreFX.Factory::new);
|
||||||
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
|
//
|
||||||
{
|
// @SubscribeEvent
|
||||||
|
// public void attachSpatialDimensionManager( AttachCapabilitiesEvent<World> event )
|
||||||
@Override
|
// {
|
||||||
public void registerItemVariants( Item item, ResourceLocation... names )
|
// if( AEConfig.instance()
|
||||||
{
|
// .isFeatureEnabled( AEFeature.SPATIAL_IO ) && event.getObject() == DimensionManager.getWorld( AEConfig.instance().getStorageDimensionID() ) )
|
||||||
ModelLoader.registerItemVariants( item, names );
|
// {
|
||||||
}
|
// event.addCapability( new ResourceLocation( "appliedenergistics2:spatial_dimension_manager" ), new SpatialDimensionManager( event.getObject() ) );
|
||||||
|
// }
|
||||||
@Override
|
// }
|
||||||
public void setCustomModelResourceLocation( Item item, int metadata, ModelResourceLocation model )
|
//
|
||||||
{
|
// void postInit( final FMLPostInitializationEvent event )
|
||||||
ModelLoader.setCustomModelResourceLocation( item, metadata, model );
|
// {
|
||||||
}
|
// final IRegistryContainer registries = Api.INSTANCE.registries();
|
||||||
|
// ApiDefinitions definitions = Api.INSTANCE.definitions();
|
||||||
@Override
|
// final IParts parts = definitions.parts();
|
||||||
public void setCustomMeshDefinition( Item item, ItemMeshDefinition meshDefinition )
|
// final IBlocks blocks = definitions.blocks();
|
||||||
{
|
// final IItems items = definitions.items();
|
||||||
ModelLoader.setCustomMeshDefinition( item, meshDefinition );
|
//
|
||||||
}
|
// this.registerSpatialDimension();
|
||||||
|
//
|
||||||
@Override
|
// // default settings..
|
||||||
public void setCustomStateMapper( Block block, IStateMapper mapper )
|
// ( (P2PTunnelRegistry) registries.p2pTunnel() ).configure();
|
||||||
{
|
//
|
||||||
ModelLoader.setCustomStateMapper( block, mapper );
|
// // add to localization..
|
||||||
}
|
// PlayerMessages.values();
|
||||||
}
|
// GuiText.values();
|
||||||
|
//
|
||||||
private static class CriterionTrigggerRegistry implements ICriterionTriggerRegistry
|
// definitions.getRegistry().getBootstrapComponents( IPostInitComponent.class ).forEachRemaining( b -> b.postInitialize( event.getSide() ) );
|
||||||
{
|
//
|
||||||
private Method method;
|
// // Interface
|
||||||
|
// Upgrades.CRAFTING.registerItem( parts.iface(), 1 );
|
||||||
CriterionTrigggerRegistry()
|
// Upgrades.CRAFTING.registerItem( blocks.iface(), 1 );
|
||||||
{
|
//
|
||||||
this.method = ReflectionHelper.findMethod( CriteriaTriggers.class, "register", "func_192118_a", ICriterionTrigger.class );
|
// // IO Port!
|
||||||
this.method.setAccessible( true );
|
// Upgrades.SPEED.registerItem( blocks.iOPort(), 3 );
|
||||||
}
|
// Upgrades.REDSTONE.registerItem( blocks.iOPort(), 1 );
|
||||||
|
//
|
||||||
@Override
|
// // Level Emitter!
|
||||||
public void register( ICriterionTrigger<? extends ICriterionInstance> trigger )
|
// Upgrades.FUZZY.registerItem( parts.levelEmitter(), 1 );
|
||||||
{
|
// Upgrades.CRAFTING.registerItem( parts.levelEmitter(), 1 );
|
||||||
try
|
//
|
||||||
{
|
// // Import Bus
|
||||||
this.method.invoke( null, trigger );
|
// Upgrades.FUZZY.registerItem( parts.importBus(), 1 );
|
||||||
}
|
// Upgrades.REDSTONE.registerItem( parts.importBus(), 1 );
|
||||||
catch( IllegalAccessException | IllegalArgumentException | InvocationTargetException e )
|
// Upgrades.CAPACITY.registerItem( parts.importBus(), 2 );
|
||||||
{
|
// Upgrades.SPEED.registerItem( parts.importBus(), 4 );
|
||||||
AELog.debug( e );
|
//
|
||||||
}
|
// // 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.storage.data.IAEStack;
|
||||||
import appeng.api.util.IClientHelper;
|
import appeng.api.util.IClientHelper;
|
||||||
import appeng.core.localization.GuiText;
|
import appeng.core.localization.GuiText;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
|
||||||
|
|
||||||
public class ApiClientHelper implements IClientHelper
|
public class ApiClientHelper implements IClientHelper
|
||||||
{
|
{
|
||||||
@Override
|
@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 )
|
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 net.minecraft.world.IBlockReader;
|
||||||
|
|
||||||
import appeng.api.definitions.IBlockDefinition;
|
import appeng.api.definitions.IBlockDefinition;
|
||||||
|
import net.minecraftforge.fml.RegistryObject;
|
||||||
|
|
||||||
|
|
||||||
public class BlockDefinition extends ItemDefinition implements IBlockDefinition
|
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 )
|
public BlockDefinition( String registryName, Block block, BlockItem item )
|
||||||
{
|
{
|
||||||
super( registryName, item );
|
super( registryName, item );
|
||||||
this.block = Optional.ofNullable( block );
|
this.block = null; // FIXME // Optional.ofNullable( block );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final Optional<Block> maybeBlock()
|
public final RegistryObject<Block> maybeBlock()
|
||||||
{
|
{
|
||||||
return this.block;
|
return this.block;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
@Override
|
||||||
|
|||||||
@@ -24,9 +24,10 @@ import javax.annotation.Nullable;
|
|||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.ActionResultType;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.BlockRayTraceResult;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import appeng.block.AEBaseTileBlock;
|
import appeng.block.AEBaseTileBlock;
|
||||||
@@ -41,7 +42,7 @@ public class BlockCubeGenerator extends AEBaseTileBlock
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 );
|
final TileCubeGenerator tcg = this.getTileEntity( w, pos );
|
||||||
if( tcg != null )
|
if( tcg != null )
|
||||||
|
|||||||
@@ -24,9 +24,10 @@ import javax.annotation.Nullable;
|
|||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.ActionResultType;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.BlockRayTraceResult;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import appeng.block.AEBaseTileBlock;
|
import appeng.block.AEBaseTileBlock;
|
||||||
@@ -41,7 +42,7 @@ public class BlockPhantomNode extends AEBaseTileBlock
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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 );
|
final TilePhantomNode tpn = this.getTileEntity( w, pos );
|
||||||
tpn.triggerCrashMode();
|
tpn.triggerCrashMode();
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public class TileCubeGenerator extends AEBaseTile implements ITickable
|
|||||||
|
|
||||||
private void spawn()
|
private void spawn()
|
||||||
{
|
{
|
||||||
this.world.setBlockToAir( this.pos );
|
this.world.removeBlock(this.pos, false);
|
||||||
|
|
||||||
final Item i = this.is.getItem();
|
final Item i = this.is.getItem();
|
||||||
final Direction side = Direction.UP;
|
final Direction side = Direction.UP;
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public class ToolEraser extends AEBaseItem
|
|||||||
if( state == c_state )
|
if( state == c_state )
|
||||||
{
|
{
|
||||||
blocks++;
|
blocks++;
|
||||||
world.setBlockToAir( wc );
|
world.removeBlock(wc, false);
|
||||||
|
|
||||||
next.add( wc.add( 1, 0, 0 ) );
|
next.add( wc.add( 1, 0, 0 ) );
|
||||||
next.add( wc.add( -1, 0, 0 ) );
|
next.add( wc.add( -1, 0, 0 ) );
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ public class ToolReplicatorCard extends AEBaseItem
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
final CompoundNBT ish = player.getHeldItem( hand ).getTagCompound();
|
final CompoundNBT ish = player.getHeldItem( hand ).getTag();
|
||||||
if( ish != null )
|
if( ish != null )
|
||||||
{
|
{
|
||||||
final int src_x = ish.getInteger( "x" );
|
final int src_x = ish.getInteger( "x" );
|
||||||
|
|||||||
@@ -19,65 +19,63 @@
|
|||||||
package appeng.decorative.solid;
|
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.block.BlockState;
|
||||||
import net.minecraft.client.Minecraft;
|
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.BlockPos;
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
import java.util.Random;
|
||||||
import appeng.api.exceptions.MissingDefinitionException;
|
|
||||||
import appeng.client.render.effects.ChargedOreFX;
|
|
||||||
import appeng.core.AEConfig;
|
|
||||||
import appeng.core.AppEng;
|
|
||||||
|
|
||||||
|
|
||||||
public class BlockChargedQuartzOre extends BlockQuartzOre
|
public class BlockChargedQuartzOre extends BlockQuartzOre
|
||||||
{
|
{
|
||||||
@Override
|
public BlockChargedQuartzOre(Properties props) {
|
||||||
public Item getItemDropped( final BlockState state, final Random rand, final int fortune )
|
super(props);
|
||||||
{
|
|
||||||
return AEApi.instance()
|
|
||||||
.definitions()
|
|
||||||
.materials()
|
|
||||||
.certusQuartzCrystalCharged()
|
|
||||||
.maybeItem()
|
|
||||||
.orElseThrow( () -> new MissingDefinitionException( "Tried to access charged certus quartz crystal, even though they are disabled" ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// FIXME: Loot tables
|
||||||
public int damageDropped( final BlockState state )
|
// @Override
|
||||||
{
|
// public Item getItemDropped( final BlockState state, final Random rand, final int fortune )
|
||||||
return AEApi.instance()
|
// {
|
||||||
.definitions()
|
// return AEApi.instance()
|
||||||
.materials()
|
// .definitions()
|
||||||
.certusQuartzCrystalCharged()
|
// .materials()
|
||||||
.maybeStack( 1 )
|
// .certusQuartzCrystalCharged()
|
||||||
.orElseThrow( () -> new MissingDefinitionException( "Tried to access charged certus quartz crystal, even though they are disabled" ) )
|
// .maybeItem()
|
||||||
.getItemDamage();
|
// .orElseThrow( () -> new MissingDefinitionException( "Tried to access charged certus quartz crystal, even though they are disabled" ) );
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
@Override
|
// @Override
|
||||||
public ItemStack getPickBlock( BlockState state, RayTraceResult target, World world, BlockPos pos, PlayerEntity player )
|
// public int damageDropped( final BlockState state )
|
||||||
{
|
// {
|
||||||
return AEApi.instance()
|
// return AEApi.instance()
|
||||||
.definitions()
|
// .definitions()
|
||||||
.blocks()
|
// .materials()
|
||||||
.quartzOreCharged()
|
// .certusQuartzCrystalCharged()
|
||||||
.maybeStack( 1 )
|
// .maybeStack( 1 )
|
||||||
.orElseThrow( () -> new MissingDefinitionException( "Tried to access charged certus quartz ore, even though they are disabled" ) );
|
// .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
|
@Override
|
||||||
@OnlyIn( Dist.CLIENT )
|
@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() )
|
if( !AEConfig.instance().isEnableEffects() )
|
||||||
{
|
{
|
||||||
@@ -115,8 +113,7 @@ public class BlockChargedQuartzOre extends BlockQuartzOre
|
|||||||
|
|
||||||
if( AppEng.proxy.shouldAddParticles( r ) )
|
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().particles.addParticle(ChargedOreFX.TYPE, pos.getX() + xOff, pos.getY() + yOff, pos.getZ() + zOff, 0.0f, 0.0f, 0.0f);
|
||||||
Minecraft.getInstance().effectRenderer.addEffect( fx );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class BlockQuartzLamp extends BlockQuartzGlass
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@OnlyIn( Dist.CLIENT )
|
@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() )
|
if( !AEConfig.instance().isEnableEffects() )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,95 +19,79 @@
|
|||||||
package appeng.decorative.solid;
|
package appeng.decorative.solid;
|
||||||
|
|
||||||
|
|
||||||
import java.util.Random;
|
import appeng.block.AEBaseBlock;
|
||||||
|
|
||||||
import net.minecraft.block.material.Material;
|
|
||||||
import net.minecraft.block.BlockState;
|
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.BlockPos;
|
||||||
import net.minecraft.util.math.MathHelper;
|
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 class BlockQuartzOre extends AEBaseBlock
|
||||||
{
|
{
|
||||||
public BlockQuartzOre()
|
public BlockQuartzOre(Properties props) {
|
||||||
{
|
super(props);
|
||||||
super( Material.ROCK );
|
|
||||||
this.setHardness( 3.0F );
|
|
||||||
this.setResistance( 5.0F );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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
|
@Override
|
||||||
public BlockRenderLayer getBlockLayer()
|
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;
|
||||||
return BlockRenderLayer.CUTOUT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// FIXME: loot tables
|
||||||
public int quantityDropped( BlockState state, int fortune, Random rand )
|
// @Override
|
||||||
{
|
// public Item getItemDropped( final BlockState state, final Random rand, final int fortune )
|
||||||
if( fortune > 0 && Item.getItemFromBlock( this ) != this.getItemDropped( null, rand, fortune ) )
|
// {
|
||||||
{
|
// return AEApi.instance()
|
||||||
int j = rand.nextInt( fortune + 2 ) - 1;
|
// .definitions()
|
||||||
|
// .materials()
|
||||||
|
// .certusQuartzCrystal()
|
||||||
|
// .maybeItem()
|
||||||
|
// .orElseThrow( () -> new MissingDefinitionException( "Tried to access certus quartz crystal, even though they are disabled" ) );
|
||||||
|
// }
|
||||||
|
|
||||||
if( j < 0 )
|
// FIXME: loot tables
|
||||||
{
|
// @Override
|
||||||
j = 0;
|
// public int damageDropped( final BlockState state )
|
||||||
}
|
// {
|
||||||
|
// return AEApi.instance()
|
||||||
return this.quantityDropped( rand ) * ( j + 1 );
|
// .definitions()
|
||||||
}
|
// .materials()
|
||||||
else
|
// .certusQuartzCrystal()
|
||||||
{
|
// .maybeStack( 1 )
|
||||||
return this.quantityDropped( rand );
|
// .orElseThrow( () -> new MissingDefinitionException( "Tried to access certus quartz crystal, even though they are disabled" ) )
|
||||||
}
|
// .getItemDamage();
|
||||||
}
|
// }
|
||||||
|
|
||||||
@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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,9 +87,8 @@ public class BlockSkyStone extends AEBaseBlock
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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) {
|
||||||
{
|
super.onReplaced(state, w, pos, newState, isMoving);
|
||||||
super.breakBlock( w, pos, state );
|
|
||||||
|
|
||||||
if( Platform.isServer() )
|
if( Platform.isServer() )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -25,9 +25,10 @@ import net.minecraft.block.material.Material;
|
|||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.ActionResultType;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.BlockRayTraceResult;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import appeng.api.util.AEPartLocation;
|
import appeng.api.util.AEPartLocation;
|
||||||
@@ -45,7 +46,7 @@ public class BlockFluidInterface extends AEBaseTileBlock
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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() )
|
if( p.isShiftKeyDown() )
|
||||||
{
|
{
|
||||||
@@ -57,7 +58,7 @@ public class BlockFluidInterface extends AEBaseTileBlock
|
|||||||
{
|
{
|
||||||
if( Platform.isServer() )
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public class FluidDummyItem extends AEBaseItem
|
|||||||
{
|
{
|
||||||
if( is.hasTag() )
|
if( is.hasTag() )
|
||||||
{
|
{
|
||||||
CompoundNBT tag = is.getTagCompound();
|
CompoundNBT tag = is.getTag();
|
||||||
return FluidStack.loadFluidStackFromNBT( tag );
|
return FluidStack.loadFluidStackFromNBT( tag );
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -307,7 +307,7 @@ public class PartFluidLevelEmitter extends PartUpgradeable implements IStackWatc
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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() )
|
if( this.isLevelEmitterOn() )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ import net.minecraft.util.Hand;
|
|||||||
import net.minecraft.util.NonNullList;
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
@@ -85,9 +86,9 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
|
|||||||
|
|
||||||
@OnlyIn( Dist.CLIENT )
|
@OnlyIn( Dist.CLIENT )
|
||||||
@Override
|
@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 );
|
final MaterialType mt = this.getTypeByStack( stack );
|
||||||
if( mt == null )
|
if( mt == null )
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import net.minecraft.entity.Entity;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.util.NonNullList;
|
import net.minecraft.util.NonNullList;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
@@ -75,7 +76,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
|||||||
crystalSeedStack.setItemDamage( certus2 );
|
crystalSeedStack.setItemDamage( certus2 );
|
||||||
crystalSeedStack = newStyle( crystalSeedStack );
|
crystalSeedStack = newStyle( crystalSeedStack );
|
||||||
String itemName = crystalSeedStack.getItem().getRegistryName().getResourcePath();
|
String itemName = crystalSeedStack.getItem().getRegistryName().getResourcePath();
|
||||||
return new ResolverResult( itemName, crystalSeedStack.getDamage(), crystalSeedStack.getTagCompound() );
|
return new ResolverResult( itemName, crystalSeedStack.getDamage(), crystalSeedStack.getTag() );
|
||||||
} )
|
} )
|
||||||
.orElse( null );
|
.orElse( null );
|
||||||
|
|
||||||
@@ -91,7 +92,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
|||||||
{
|
{
|
||||||
if( is.hasTag() )
|
if( is.hasTag() )
|
||||||
{
|
{
|
||||||
return is.getTagCompound().getInteger( "progress" );
|
return is.getTag().getInteger( "progress" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -159,13 +160,13 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@OnlyIn( Dist.CLIENT )
|
@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() );
|
lines.add( ButtonToolTips.DoesntDespawn.getLocal() );
|
||||||
final int progress = getProgress( stack ) % SINGLE_OFFSET;
|
final int progress = getProgress( stack ) % SINGLE_OFFSET;
|
||||||
lines.add( Math.floor( (float) progress / (float) ( SINGLE_OFFSET / 100 ) ) + "%" );
|
lines.add( Math.floor( (float) progress / (float) ( SINGLE_OFFSET / 100 ) ) + "%" );
|
||||||
|
|
||||||
super.addCheckedInformation( stack, world, lines, advancedTooltips );
|
super.addInformation( stack, world, lines, advancedTooltips );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import net.minecraft.util.EnumActionResult;
|
|||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
@@ -103,7 +104,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@OnlyIn( Dist.CLIENT )
|
@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 );
|
final ICraftingPatternDetails details = this.getPatternForItem( stack, world );
|
||||||
|
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
|||||||
public ItemStack getTextureItem( ItemStack is )
|
public ItemStack getTextureItem( ItemStack is )
|
||||||
{
|
{
|
||||||
|
|
||||||
CompoundNBT nbt = is.getTagCompound();
|
CompoundNBT nbt = is.getTag();
|
||||||
|
|
||||||
if( nbt == null )
|
if( nbt == null )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import net.minecraft.util.EnumActionResult;
|
|||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
@@ -76,7 +77,7 @@ public abstract class AbstractStorageCell<T extends IAEStack<T>> extends AEBaseI
|
|||||||
|
|
||||||
@OnlyIn( Dist.CLIENT )
|
@OnlyIn( Dist.CLIENT )
|
||||||
@Override
|
@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()
|
AEApi.instance()
|
||||||
.client()
|
.client()
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import net.minecraft.client.util.ITooltipFlag;
|
import net.minecraft.client.util.ITooltipFlag;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
@@ -78,7 +79,7 @@ public class ItemCreativeStorageCell extends AEBaseItem implements ICellWorkbenc
|
|||||||
|
|
||||||
@OnlyIn( Dist.CLIENT )
|
@OnlyIn( Dist.CLIENT )
|
||||||
@Override
|
@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()
|
final IMEInventoryHandler<?> inventory = AEApi.instance()
|
||||||
.registries()
|
.registries()
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import net.minecraft.client.util.ITooltipFlag;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.DimensionManager;
|
import net.minecraftforge.common.DimensionManager;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
@@ -58,7 +59,7 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
|||||||
|
|
||||||
@OnlyIn( Dist.CLIENT )
|
@OnlyIn( Dist.CLIENT )
|
||||||
@Override
|
@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 );
|
final int id = this.getStoredDimensionID( stack );
|
||||||
if( id >= 0 )
|
if( id >= 0 )
|
||||||
@@ -108,7 +109,7 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
|||||||
{
|
{
|
||||||
if( is.hasTag() )
|
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( c.getInteger( NBT_SIZE_X_KEY ), c.getInteger( NBT_SIZE_Y_KEY ), c.getInteger( NBT_SIZE_Z_KEY ) );
|
||||||
}
|
}
|
||||||
return new WorldCoord( 0, 0, 0 );
|
return new WorldCoord( 0, 0, 0 );
|
||||||
@@ -119,7 +120,7 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
|||||||
{
|
{
|
||||||
if( is.hasTag() )
|
if( is.hasTag() )
|
||||||
{
|
{
|
||||||
final CompoundNBT c = is.getTagCompound();
|
final CompoundNBT c = is.getTag();
|
||||||
return c.getInteger( NBT_CELL_ID_KEY );
|
return c.getInteger( NBT_CELL_ID_KEY );
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ package appeng.items.tools;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.client.resources.I18n;
|
||||||
import net.minecraft.client.util.ITooltipFlag;
|
import net.minecraft.client.util.ITooltipFlag;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -30,6 +31,9 @@ import net.minecraft.util.EnumActionResult;
|
|||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
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.TextFormatting;
|
||||||
import net.minecraft.util.text.translation.I18n;
|
import net.minecraft.util.text.translation.I18n;
|
||||||
import net.minecraft.world.IBlockReader;
|
import net.minecraft.world.IBlockReader;
|
||||||
@@ -61,17 +65,17 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@OnlyIn( Dist.CLIENT )
|
@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 ) ) );
|
lines.add( this.getLocalizedName( this.getSettingsName( stack ) + ".name", this.getSettingsName( stack ) ) );
|
||||||
|
|
||||||
final CompoundNBT data = this.getData( 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" ) ) ) );
|
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 short freq = data.getShort( "freq" );
|
||||||
final String freqTooltip = TextFormatting.BOLD + Platform.p2p().toHexString( 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.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import org.apache.commons.lang3.text.WordUtils;
|
import org.apache.commons.lang3.text.WordUtils;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
@@ -248,7 +249,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
|||||||
|
|
||||||
public ItemStack getColor( final ItemStack is )
|
public ItemStack getColor( final ItemStack is )
|
||||||
{
|
{
|
||||||
final CompoundNBT c = is.getTagCompound();
|
final CompoundNBT c = is.getTag();
|
||||||
if( c != null && c.contains("color") )
|
if( c != null && c.contains("color") )
|
||||||
{
|
{
|
||||||
final CompoundNBT color = c.getCompoundTag( "color" );
|
final CompoundNBT color = c.getCompoundTag( "color" );
|
||||||
@@ -423,9 +424,9 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@OnlyIn( Dist.CLIENT )
|
@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()
|
final ICellInventoryHandler<IAEItemStack> cdi = AEApi.instance()
|
||||||
.registries()
|
.registries()
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
w.setBlockToAir( pos );
|
w.removeBlock(pos, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( r.getDrops() != null )
|
if( r.getDrops() != null )
|
||||||
@@ -176,7 +176,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
w.setBlockToAir( pos );
|
w.removeBlock(pos, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( r.getDrops() != null )
|
if( r.getDrops() != null )
|
||||||
@@ -268,14 +268,14 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
|||||||
{
|
{
|
||||||
if( blockID instanceof BlockTNT )
|
if( blockID instanceof BlockTNT )
|
||||||
{
|
{
|
||||||
w.setBlockToAir( pos );
|
w.removeBlock(pos, false);
|
||||||
( (BlockTNT) blockID ).explode( w, pos, state, p );
|
( (BlockTNT) blockID ).explode( w, pos, state, p );
|
||||||
return EnumActionResult.SUCCESS;
|
return EnumActionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( blockID instanceof BlockTinyTNT )
|
if( blockID instanceof BlockTinyTNT )
|
||||||
{
|
{
|
||||||
w.setBlockToAir( pos );
|
w.removeBlock(pos, false);
|
||||||
( (BlockTinyTNT) blockID ).startFuse( w, pos, p );
|
( (BlockTinyTNT) blockID ).startFuse( w, pos, p );
|
||||||
return EnumActionResult.SUCCESS;
|
return EnumActionResult.SUCCESS;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ import net.minecraft.util.math.AxisAlignedBB;
|
|||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
@@ -88,9 +89,9 @@ public class ToolMatterCannon extends AEBasePoweredItem implements IStorageCell<
|
|||||||
|
|
||||||
@OnlyIn( Dist.CLIENT )
|
@OnlyIn( Dist.CLIENT )
|
||||||
@Override
|
@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()
|
final ICellInventoryHandler<IAEItemStack> cdi = AEApi.instance()
|
||||||
.registries()
|
.registries()
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import net.minecraft.util.ActionResult;
|
|||||||
import net.minecraft.util.EnumActionResult;
|
import net.minecraft.util.EnumActionResult;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
@@ -78,9 +79,9 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell<
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@OnlyIn( Dist.CLIENT )
|
@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()
|
final ICellInventoryHandler<IAEItemStack> cdi = AEApi.instance()
|
||||||
.registries()
|
.registries()
|
||||||
|
|||||||
@@ -71,9 +71,9 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@OnlyIn( Dist.CLIENT )
|
@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() )
|
if( stack.hasTag() )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import net.minecraft.creativetab.CreativeTabs;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.util.NonNullList;
|
import net.minecraft.util.NonNullList;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
import net.minecraftforge.common.capabilities.ICapabilityProvider;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
@@ -59,9 +60,9 @@ public abstract class AEBasePoweredItem extends AEBaseItem implements IAEItemPow
|
|||||||
|
|
||||||
@OnlyIn( Dist.CLIENT )
|
@OnlyIn( Dist.CLIENT )
|
||||||
@Override
|
@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;
|
double internalCurrentPower = 0;
|
||||||
final double internalMaxPower = this.getAEMaxPower( stack );
|
final double internalMaxPower = this.getAEMaxPower( stack );
|
||||||
|
|
||||||
|
|||||||
@@ -309,7 +309,7 @@ public abstract class AEBasePart implements IPart, IGridProxyable, IActionHost,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@OnlyIn( Dist.CLIENT )
|
@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" );
|
( (AppEngInternalAEInventory) inv ).writeToNBT( output, "config" );
|
||||||
}
|
}
|
||||||
|
|
||||||
return output.hasNoTags() ? null : output;
|
return output.isEmpty() ? null : output;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean useStandardMemoryCard()
|
public boolean useStandardMemoryCard()
|
||||||
|
|||||||
@@ -901,14 +901,14 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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() )
|
for( final AEPartLocation side : AEPartLocation.values() )
|
||||||
{
|
{
|
||||||
final IPart p = this.getPart( side );
|
final IPart p = this.getPart( side );
|
||||||
if( p != null )
|
if( p != null )
|
||||||
{
|
{
|
||||||
p.randomDisplayTick( world, pos, r );
|
p.animateTick( world, pos, r );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ public interface ICableBusContainer
|
|||||||
boolean isLadder( LivingEntity entity );
|
boolean isLadder( LivingEntity entity );
|
||||||
|
|
||||||
@OnlyIn( Dist.CLIENT )
|
@OnlyIn( Dist.CLIENT )
|
||||||
void randomDisplayTick( World world, BlockPos pos, Random r );
|
void animateTick( World world, BlockPos pos, Random r );
|
||||||
|
|
||||||
int getLightValue();
|
int getLightValue();
|
||||||
|
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ public class NullCableBusContainer implements ICableBusContainer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
@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() )
|
if( this.isLevelEmitterOn() )
|
||||||
{
|
{
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user