Compiles again.
This commit is contained in:
@@ -19,31 +19,15 @@
|
||||
package appeng.debug;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeChunkManager;
|
||||
import net.minecraftforge.common.ForgeChunkManager.LoadingCallback;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.AppEng;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
|
||||
public class BlockChunkloader extends AEBaseTileBlock implements LoadingCallback
|
||||
{
|
||||
public class BlockChunkloader extends AEBaseTileBlock<TileChunkLoader> {
|
||||
|
||||
public BlockChunkloader()
|
||||
{
|
||||
super( Material.IRON );
|
||||
ForgeChunkManager.setForcedChunkLoadingCallback( AppEng.instance(), this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ticketsLoaded( final List<Ticket> tickets, final World world )
|
||||
{
|
||||
|
||||
}
|
||||
public BlockChunkloader() {
|
||||
super(Block.Properties.create(Material.IRON));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ package appeng.debug;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -38,7 +39,7 @@ public class BlockCubeGenerator extends AEBaseTileBlock<TileCubeGenerator>
|
||||
|
||||
public BlockCubeGenerator()
|
||||
{
|
||||
super( Material.IRON );
|
||||
super(Block.Properties.create(Material.IRON) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,17 +19,18 @@
|
||||
package appeng.debug;
|
||||
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
|
||||
|
||||
public class BlockEnergyGenerator extends AEBaseTileBlock
|
||||
public class BlockEnergyGenerator extends AEBaseTileBlock<TileEnergyGenerator>
|
||||
{
|
||||
|
||||
public BlockEnergyGenerator()
|
||||
{
|
||||
super( Material.IRON );
|
||||
super( Block.Properties.create(Material.IRON) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,17 +19,18 @@
|
||||
package appeng.debug;
|
||||
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
|
||||
|
||||
public class BlockItemGen extends AEBaseTileBlock
|
||||
public class BlockItemGen extends AEBaseTileBlock<TileItemGen>
|
||||
{
|
||||
|
||||
public BlockItemGen()
|
||||
{
|
||||
super( Material.IRON );
|
||||
super( Block.Properties.create(Material.IRON) );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ package appeng.debug;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -38,7 +39,7 @@ public class BlockPhantomNode extends AEBaseTileBlock<TilePhantomNode>
|
||||
|
||||
public BlockPhantomNode()
|
||||
{
|
||||
super( Material.IRON );
|
||||
super( Block.Properties.create(Material.IRON) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,76 +19,53 @@
|
||||
package appeng.debug;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraftforge.common.ForgeChunkManager;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Type;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
|
||||
|
||||
public class TileChunkLoader extends AEBaseTile implements ITickableTileEntity
|
||||
{
|
||||
public class TileChunkLoader extends AEBaseTile implements ITickableTileEntity {
|
||||
|
||||
private boolean requestTicket = true;
|
||||
private Ticket ct = null;
|
||||
public TileChunkLoader(TileEntityType<?> tileEntityTypeIn) {
|
||||
super(tileEntityTypeIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick()
|
||||
{
|
||||
if( this.requestTicket )
|
||||
{
|
||||
this.requestTicket = false;
|
||||
this.initTicket();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onLoad() {
|
||||
super.onLoad();
|
||||
|
||||
private void initTicket()
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
World world = getWorld();
|
||||
if (world instanceof ServerWorld) {
|
||||
ChunkPos chunkPos = new ChunkPos(getPos());
|
||||
((ServerWorld) world).forceChunk(chunkPos.x, chunkPos.z, true);
|
||||
}
|
||||
}
|
||||
|
||||
this.ct = ForgeChunkManager.requestTicket( AppEng.instance(), this.world, Type.NORMAL );
|
||||
@Override
|
||||
public void remove() {
|
||||
World world = getWorld();
|
||||
if (world instanceof ServerWorld) {
|
||||
ChunkPos chunkPos = new ChunkPos(getPos());
|
||||
((ServerWorld) world).forceChunk(chunkPos.x, chunkPos.z, false);
|
||||
}
|
||||
}
|
||||
|
||||
if( this.ct == null )
|
||||
{
|
||||
final MinecraftServer server = ServerLifecycleHooks.getCurrentServer();
|
||||
if( server != null )
|
||||
{
|
||||
final List<ServerPlayerEntity> pl = server.getPlayerList().getPlayers();
|
||||
for( final ServerPlayerEntity p : pl )
|
||||
{
|
||||
p.sendMessage( new StringTextComponent( "Can't chunk load.." ) );
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
@Override
|
||||
public void tick() {
|
||||
// Validate the force-status
|
||||
World world = getWorld();
|
||||
if (world instanceof ServerWorld) {
|
||||
ChunkPos chunkPos = new ChunkPos(getPos());
|
||||
ServerWorld serverWorld = (ServerWorld) world;
|
||||
|
||||
AELog.info( "New Ticket " + this.ct.toString() );
|
||||
ForgeChunkManager.forceChunk( this.ct, new ChunkPos( this.pos.getX() >> 4, this.pos.getZ() >> 4 ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate()
|
||||
{
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AELog.info( "Released Ticket " + this.ct.toString() );
|
||||
ForgeChunkManager.releaseTicket( this.ct );
|
||||
}
|
||||
if (!serverWorld.getForcedChunks().contains(chunkPos.asLong())) {
|
||||
AELog.debug("Force-loading chunk @ %d,%d in %s", chunkPos.x, chunkPos.z, serverWorld.dimension.getType().getRegistryName());
|
||||
serverWorld.forceChunk(chunkPos.x, chunkPos.z, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,18 +19,19 @@
|
||||
package appeng.debug;
|
||||
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.DirectionalPlaceContext;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
|
||||
|
||||
public class TileCubeGenerator extends AEBaseTile implements ITickableTileEntity
|
||||
@@ -41,6 +42,10 @@ public class TileCubeGenerator extends AEBaseTile implements ITickableTileEntity
|
||||
private int countdown = 20 * 10;
|
||||
private PlayerEntity who = null;
|
||||
|
||||
public TileCubeGenerator(TileEntityType<?> tileEntityTypeIn) {
|
||||
super(tileEntityTypeIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick()
|
||||
{
|
||||
@@ -79,7 +84,10 @@ public class TileCubeGenerator extends AEBaseTile implements ITickableTileEntity
|
||||
for( int z = -half; z < half; z++ )
|
||||
{
|
||||
final BlockPos p = this.pos.add( x, y - 1, z );
|
||||
i.onItemUse( this.who, this.world, p, Hand.MAIN_HAND, side, 0.5f, 0.0f, 0.5f );
|
||||
ItemUseContext useContext = new DirectionalPlaceContext(
|
||||
this.world, p, side, this.is, side.getOpposite()
|
||||
);
|
||||
i.onItemUse(useContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,10 @@ import com.google.common.math.IntMath;
|
||||
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.energy.CapabilityEnergy;
|
||||
@@ -44,40 +47,41 @@ public class TileEnergyGenerator extends AEBaseTile implements ITickableTileEnti
|
||||
*/
|
||||
private static final int BASE_ENERGY = 8;
|
||||
|
||||
public TileEnergyGenerator(TileEntityType<?> tileEntityTypeIn) {
|
||||
super(tileEntityTypeIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick()
|
||||
{
|
||||
int tier = 1;
|
||||
final EnumSet<Direction> validEnergyReceivers = EnumSet.noneOf( Direction.class );
|
||||
World world = this.getWorld();
|
||||
if (world == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
int tier = 1;
|
||||
for( Direction facing : Direction.values() )
|
||||
{
|
||||
final TileEntity te = this.getWorld().getTileEntity( this.getPos().offset( facing ) );
|
||||
final TileEntity te = world.getTileEntity( this.getPos().offset( facing ) );
|
||||
|
||||
if( te instanceof TileEnergyGenerator )
|
||||
{
|
||||
tier++;
|
||||
}
|
||||
|
||||
if( te != null && te.hasCapability( CapabilityEnergy.ENERGY, facing.getOpposite() ) )
|
||||
{
|
||||
validEnergyReceivers.add( facing );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
final int energyToInsert = IntMath.pow( BASE_ENERGY, tier );
|
||||
|
||||
for( Direction facing : validEnergyReceivers )
|
||||
for( Direction facing : Direction.values() )
|
||||
{
|
||||
final TileEntity te = this.getWorld().getTileEntity( this.getPos().offset( facing ) );
|
||||
final IEnergyStorage cap = te.getCapability( CapabilityEnergy.ENERGY, facing.getOpposite() );
|
||||
final LazyOptional<IEnergyStorage> cap = te.getCapability( CapabilityEnergy.ENERGY, facing.getOpposite() );
|
||||
|
||||
if( cap.canReceive() )
|
||||
{
|
||||
|
||||
cap.receiveEnergy( energyToInsert, false );
|
||||
}
|
||||
cap.ifPresent(consumer -> {
|
||||
if (consumer.canReceive()) {
|
||||
consumer.receiveEnergy( energyToInsert, false );
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,14 +28,17 @@ import javax.annotation.Nullable;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraftforge.common.capabilities.Capability;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.tile.AEBaseTile;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
|
||||
public class TileItemGen extends AEBaseTile
|
||||
@@ -45,26 +48,32 @@ public class TileItemGen extends AEBaseTile
|
||||
|
||||
private final IItemHandler handler = new QueuedItemHandler();
|
||||
|
||||
public TileItemGen()
|
||||
{
|
||||
public TileItemGen(TileEntityType<?> tileEntityTypeIn) {
|
||||
super(tileEntityTypeIn);
|
||||
if( POSSIBLE_ITEMS.isEmpty() )
|
||||
{
|
||||
for( final Object obj : Item.REGISTRY )
|
||||
for( final Item mi : ForgeRegistries.ITEMS)
|
||||
{
|
||||
final Item mi = (Item) obj;
|
||||
if( mi != null && mi != Items.AIR )
|
||||
{
|
||||
if( mi.isDamageable() )
|
||||
{
|
||||
// FIXME: Rethink if this branch is necessary
|
||||
for( int dmg = 0; dmg < mi.getMaxDamage(); dmg++ )
|
||||
{
|
||||
POSSIBLE_ITEMS.add( new ItemStack( mi, 1, dmg ) );
|
||||
ItemStack item = new ItemStack(mi, 1);
|
||||
item.setDamage(dmg);
|
||||
POSSIBLE_ITEMS.add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mi.getGroup() == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
final NonNullList<ItemStack> list = NonNullList.create();
|
||||
mi.getSubItems( mi.getCreativeTab(), list );
|
||||
mi.fillItemGroup( mi.getGroup(), list );
|
||||
POSSIBLE_ITEMS.addAll( list );
|
||||
}
|
||||
}
|
||||
@@ -101,6 +110,11 @@ public class TileItemGen extends AEBaseTile
|
||||
return POSSIBLE_ITEMS.peek() != null ? POSSIBLE_ITEMS.peek().copy() : ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(int slot, @Nonnull ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlots()
|
||||
{
|
||||
|
||||
@@ -21,6 +21,7 @@ package appeng.debug;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Direction;
|
||||
|
||||
import appeng.api.networking.IGridNode;
|
||||
@@ -35,6 +36,10 @@ public class TilePhantomNode extends AENetworkTile
|
||||
private AENetworkProxy proxy = null;
|
||||
private boolean crashMode = false;
|
||||
|
||||
public TilePhantomNode(TileEntityType<?> tileEntityTypeIn) {
|
||||
super(tileEntityTypeIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridNode getGridNode( final AEPartLocation dir )
|
||||
{
|
||||
|
||||
@@ -19,19 +19,6 @@
|
||||
package appeng.debug;
|
||||
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.networking.IGridConnection;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
@@ -51,18 +38,44 @@ import appeng.me.cache.TickManagerCache;
|
||||
import appeng.parts.p2p.PartP2PTunnel;
|
||||
import appeng.tile.networking.TileController;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
|
||||
public class ToolDebugCard extends AEBaseItem
|
||||
{
|
||||
|
||||
public ToolDebugCard(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onItemUseFirst( final PlayerEntity player, final World world, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final Hand hand )
|
||||
{
|
||||
public ActionResultType onItemUseFirst(ItemStack stack, ItemUseContext context) {
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
PlayerEntity player = context.getPlayer();
|
||||
World world = context.getWorld();
|
||||
BlockPos pos = context.getPos();
|
||||
Direction side = context.getFace();
|
||||
|
||||
if (player == null) {
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
if( player.isCrouching() )
|
||||
{
|
||||
int grids = 0;
|
||||
@@ -133,7 +146,7 @@ public class ToolDebugCard extends AEBaseItem
|
||||
|
||||
if( center.getMachine() instanceof PartP2PTunnel )
|
||||
{
|
||||
this.outputMsg( player, "Freq: " + ( (PartP2PTunnel) center.getMachine() ).getFrequency() );
|
||||
this.outputMsg( player, "Freq: " + ( (PartP2PTunnel<?>) center.getMachine() ).getFrequency() );
|
||||
}
|
||||
|
||||
final TickManagerCache tmc = g.getCache( ITickManager.class );
|
||||
@@ -205,7 +218,7 @@ public class ToolDebugCard extends AEBaseItem
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
private void outputMsg( final ICommandSender player, final String string )
|
||||
private void outputMsg(final Entity player, final String string )
|
||||
{
|
||||
player.sendMessage( new StringTextComponent( string ) );
|
||||
}
|
||||
|
||||
@@ -19,20 +19,19 @@
|
||||
package appeng.debug;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.core.AELog;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class ToolEraser extends AEBaseItem
|
||||
@@ -40,14 +39,25 @@ public class ToolEraser extends AEBaseItem
|
||||
|
||||
private static final int BLOCK_ERASE_LIMIT = 90000;
|
||||
|
||||
public ToolEraser(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onItemUseFirst( final PlayerEntity player, final World world, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final Hand hand )
|
||||
{
|
||||
public ActionResultType onItemUseFirst(ItemStack stack, ItemUseContext context) {
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
PlayerEntity player = context.getPlayer();
|
||||
World world = context.getWorld();
|
||||
BlockPos pos = context.getPos();
|
||||
|
||||
if (player == null) {
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
final BlockState state = world.getBlockState( pos );
|
||||
|
||||
List<BlockPos> next = new ArrayList<>();
|
||||
|
||||
@@ -20,37 +20,47 @@ package appeng.debug;
|
||||
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.util.Platform;
|
||||
import appeng.worldgen.MeteoritePlacer;
|
||||
import appeng.worldgen.meteorite.StandardWorld;
|
||||
|
||||
|
||||
public class ToolMeteoritePlacer extends AEBaseItem
|
||||
{
|
||||
|
||||
public ToolMeteoritePlacer(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onItemUseFirst( final PlayerEntity player, final World world, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final Hand hand )
|
||||
{
|
||||
public ActionResultType onItemUseFirst(ItemStack stack, ItemUseContext context) {
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
final MeteoritePlacer mp = new MeteoritePlacer();
|
||||
final boolean worked = mp.spawnMeteorite( new StandardWorld( world ), pos.getX(), pos.getY(), pos.getZ() );
|
||||
PlayerEntity player = context.getPlayer();
|
||||
World world = context.getWorld();
|
||||
BlockPos pos = context.getPos();
|
||||
|
||||
if( !worked )
|
||||
{
|
||||
player.sendMessage( new StringTextComponent( "Un-suitable Location." ) );
|
||||
if (player == null) {
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
//FIXME final MeteoritePlacer mp = new MeteoritePlacer();
|
||||
//FIXME final boolean worked = mp.spawnMeteorite( new StandardWorld( world ), pos.getX(), pos.getY(), pos.getZ() );
|
||||
//FIXME
|
||||
//FIXME if( !worked )
|
||||
//FIXME {
|
||||
//FIXME player.sendMessage( new StringTextComponent( "Un-suitable Location." ) );
|
||||
//FIXME }
|
||||
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,20 +19,6 @@
|
||||
package appeng.debug;
|
||||
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
@@ -41,18 +27,47 @@ import appeng.api.util.AEPartLocation;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUseContext;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
|
||||
|
||||
public class ToolReplicatorCard extends AEBaseItem
|
||||
{
|
||||
|
||||
public ToolReplicatorCard(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResultType onItemUseFirst( final PlayerEntity player, final World world, final BlockPos pos, final Direction side, final float hitX, final float hitY, final float hitZ, final Hand hand )
|
||||
{
|
||||
public ActionResultType onItemUseFirst(ItemStack stack, ItemUseContext context) {
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
PlayerEntity player = context.getPlayer();
|
||||
World world = context.getWorld();
|
||||
BlockPos pos = context.getPos();
|
||||
Direction side = context.getFace();
|
||||
Hand hand = context.getHand();
|
||||
|
||||
if (player == null) {
|
||||
return ActionResultType.PASS;
|
||||
}
|
||||
|
||||
int x = pos.getX();
|
||||
int y = pos.getY();
|
||||
int z = pos.getZ();
|
||||
@@ -66,8 +81,8 @@ public class ToolReplicatorCard extends AEBaseItem
|
||||
tag.putInt( "y", y );
|
||||
tag.putInt( "z", z );
|
||||
tag.putInt( "side", side.ordinal() );
|
||||
tag.putInt( "dimid", world.provider.getDimension() );
|
||||
player.getHeldItem( hand ).setTagCompound( tag );
|
||||
tag.putInt( "dimid", world.getDimension().getType().getId() );
|
||||
player.getHeldItem( hand ).setTag( tag );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -84,7 +99,7 @@ public class ToolReplicatorCard extends AEBaseItem
|
||||
final int src_z = ish.getInt( "z" );
|
||||
final int src_side = ish.getInt( "side" );
|
||||
final int dimid = ish.getInt( "dimid" );
|
||||
final World src_w = DimensionManager.getWorld( dimid );
|
||||
final World src_w = world.getServer().getWorld(DimensionType.getById(dimid));
|
||||
|
||||
final TileEntity te = src_w.getTileEntity( new BlockPos( src_x, src_y, src_z ) );
|
||||
if( te instanceof IGridHost )
|
||||
@@ -136,10 +151,10 @@ public class ToolReplicatorCard extends AEBaseItem
|
||||
if( blk != null && blk.hasTileEntity( state ) )
|
||||
{
|
||||
final TileEntity ote = src_w.getTileEntity( p );
|
||||
final TileEntity nte = blk.createTileEntity( world, state );
|
||||
final TileEntity nte = blk.createTileEntity( state, world );
|
||||
final CompoundNBT data = new CompoundNBT();
|
||||
ote.writeToNBT( data );
|
||||
nte.readFromNBT( data.copy() );
|
||||
ote.write( data );
|
||||
nte.read( data.copy() );
|
||||
world.setTileEntity( d, nte );
|
||||
}
|
||||
world.notifyBlockUpdate( d, prev, state, 3 );
|
||||
@@ -175,7 +190,7 @@ public class ToolReplicatorCard extends AEBaseItem
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
private void outputMsg( final ICommandSender player, final String string )
|
||||
private void outputMsg(final Entity player, final String string )
|
||||
{
|
||||
player.sendMessage( new StringTextComponent( string ) );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user