commit
fbd6cb2d13
4 changed files with 48 additions and 69 deletions
|
@ -18,25 +18,21 @@ public class BlankTeleporter extends Teleporter
|
||||||
* Create a new portal near an entity.
|
* Create a new portal near an entity.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void placeInPortal(Entity par1Entity, double par2, double par4, double par6, float par8)
|
public void placeInPortal(Entity par1Entity, float rotationyaw) {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void setEntityPosition(Entity entity, double x, double y, double z)
|
public void setEntityPosition(Entity entity, double x, double y, double z) {
|
||||||
{
|
|
||||||
entity.lastTickPosX = entity.prevPosX = entity.posX = x;
|
entity.lastTickPosX = entity.prevPosX = entity.posX = x;
|
||||||
entity.lastTickPosY = entity.prevPosY = entity.posY = y + entity.yOffset;
|
entity.lastTickPosY = entity.prevPosY = entity.posY = y + entity.getYOffset();
|
||||||
entity.lastTickPosZ = entity.prevPosZ = entity.posZ = z;
|
entity.lastTickPosZ = entity.prevPosZ = entity.posZ = z;
|
||||||
entity.setPosition(x, y, z);
|
entity.setPosition(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeStalePortalLocations(long par1)
|
public void removeStalePortalLocations(long par1) {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,15 +4,15 @@ package com.zixiken.dimdoors;
|
||||||
import com.zixiken.dimdoors.config.DDProperties;
|
import com.zixiken.dimdoors.config.DDProperties;
|
||||||
import com.zixiken.dimdoors.core.DDLock;
|
import com.zixiken.dimdoors.core.DDLock;
|
||||||
import com.zixiken.dimdoors.items.behaviors.DispenserBehaviorStabilizedRS;
|
import com.zixiken.dimdoors.items.behaviors.DispenserBehaviorStabilizedRS;
|
||||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
|
||||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
|
||||||
import net.minecraft.block.BlockDispenser;
|
import net.minecraft.block.BlockDispenser;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
|
||||||
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||||
import com.zixiken.dimdoors.items.ItemDDKey;
|
import com.zixiken.dimdoors.items.ItemDDKey;
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
|
||||||
|
|
||||||
public class CraftingManager
|
public class CraftingManager
|
||||||
{
|
{
|
||||||
|
@ -57,7 +57,7 @@ public class CraftingManager
|
||||||
{
|
{
|
||||||
|
|
||||||
GameRegistry.addRecipe(new ItemStack(DimDoors.itemWarpDoor, 1),
|
GameRegistry.addRecipe(new ItemStack(DimDoors.itemWarpDoor, 1),
|
||||||
"yxy", 'x', Items.ender_pearl, 'y', Items.wooden_door);
|
"yxy", 'x', Items.ender_pearl, 'y', Items.oak_door);
|
||||||
}
|
}
|
||||||
if (properties.CraftingTransTrapdoorAllowed)
|
if (properties.CraftingTransTrapdoorAllowed)
|
||||||
{
|
{
|
||||||
|
|
|
@ -116,9 +116,8 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
|
||||||
* adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
|
* adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
|
public void updateTick(World par1World, BlockPos pos, IBlockState state, Random rand) {
|
||||||
{
|
this.updateAttachedTile(par1World, pos);
|
||||||
this.updateAttachedTile(par1World, par2, par3, par4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -216,37 +215,29 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
|
||||||
* their own) Args: x, y, z, neighbor blockID
|
* their own) Args: x, y, z, neighbor blockID
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block neighbor)
|
public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighbor) {
|
||||||
{
|
|
||||||
|
int metadata = getMetaFromState(world.getBlockState(pos));
|
||||||
int metadata = world.getBlockMetadata(x, y, z);
|
if (isUpperDoorBlock(state)) {
|
||||||
if (isUpperDoorBlock(metadata))
|
if (world.getBlockState(pos.down()) != this) {
|
||||||
{
|
world.setBlockToAir(pos);
|
||||||
if (world.getBlock(x, y - 1, z) != this)
|
|
||||||
{
|
|
||||||
world.setBlockToAir(x, y, z);
|
|
||||||
}
|
}
|
||||||
if (!neighbor.isAir(world, x, y, z) && neighbor != this)
|
if (!neighbor.isAir(world, pos) && neighbor != this) {
|
||||||
{
|
this.onNeighborBlockChange(world, pos.down(), state, neighbor);
|
||||||
this.onNeighborBlockChange(world, x, y - 1, z, neighbor);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
if (world.getBlockState(pos.up()) != this) {
|
||||||
if (world.getBlock(x, y + 1, z) != this)
|
world.setBlockToAir(pos);
|
||||||
{
|
if (!world.isRemote) {
|
||||||
world.setBlockToAir(x, y, z);
|
this.dropBlockAsItem(world, pos, state, 0);
|
||||||
if (!world.isRemote)
|
|
||||||
{
|
|
||||||
this.dropBlockAsItem(world, x, y, z, metadata, 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(this.getLockStatus(world, x, y, z)<=1)
|
else if(this.getLockStatus(world, pos)<=1) {
|
||||||
{
|
boolean powered = world.isBlockPowered(pos) || world.isBlockPowered(pos.up());
|
||||||
boolean powered = world.isBlockIndirectlyGettingPowered(x, y, z) || world.isBlockIndirectlyGettingPowered(x, y + 1, z);
|
if ((powered || !neighbor.isAir(world, pos) && neighbor.canProvidePower()) && neighbor != this)
|
||||||
if ((powered || !neighbor.isAir(world, x, y, z) && neighbor.canProvidePower()) && neighbor != this)
|
|
||||||
{
|
{
|
||||||
this.func_150014_a(world, x, y, z, powered);
|
this.toggleDoor(world, pos, powered);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -257,8 +248,7 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player)
|
public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) {
|
||||||
{
|
|
||||||
return new ItemStack(this.getDoorItem(), 1, 0);
|
return new ItemStack(this.getDoorItem(), 1, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,14 +256,13 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
|
||||||
* Returns the ID of the items to drop on destruction.
|
* Returns the ID of the items to drop on destruction.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(int metadata, Random random, int fortune)
|
public Item getItemDropped(IBlockState state, Random random, int fortune) {
|
||||||
{
|
return isUpperDoorBlock(state) ? null : this.getDoorItem();
|
||||||
return isUpperDoorBlock(metadata) ? null : this.getDoorItem();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public Item getItem(World world, int x, int y, int z) {
|
public Item getItem(World world, BlockPos pos) {
|
||||||
return this.getDoorItem();
|
return this.getDoorItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,17 +273,14 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enterDimDoor(World world, BlockPos pos, Entity entity)
|
public void enterDimDoor(World world, BlockPos pos, Entity entity) {
|
||||||
{
|
|
||||||
// FX entities dont exist on the server
|
// FX entities dont exist on the server
|
||||||
if (world.isRemote)
|
if (world.isRemote) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that this is the top block of the door
|
// Check that this is the top block of the door
|
||||||
if (world.getBlock(x, y - 1, z) == this)
|
if (world.getBlock(x, y - 1, z) == this) {
|
||||||
{
|
|
||||||
int metadata = world.getBlockMetadata(x, y - 1, z);
|
int metadata = world.getBlockMetadata(x, y - 1, z);
|
||||||
boolean canUse = isDoorOpen(metadata);
|
boolean canUse = isDoorOpen(metadata);
|
||||||
if (canUse && entity instanceof EntityPlayer)
|
if (canUse && entity instanceof EntityPlayer)
|
||||||
|
@ -345,9 +331,7 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
|
||||||
* 1 if there is a lock;
|
* 1 if there is a lock;
|
||||||
* 2 if the lock is locked.
|
* 2 if the lock is locked.
|
||||||
* @param world
|
* @param world
|
||||||
* @param x
|
* @param pos
|
||||||
* @param y
|
|
||||||
* @param z
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public byte getLockStatus(World world, BlockPos pos)
|
public byte getLockStatus(World world, BlockPos pos)
|
||||||
|
@ -396,7 +380,7 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
player.playSound(DimDoors.modid + ":doorLocked", 1F, 1F);
|
player.playSound(DimDoors.MODID + ":doorLocked", 1F, 1F);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,19 +395,18 @@ public abstract class BaseDimDoor extends BlockDoor implements IDimDoor, ITileEn
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity initDoorTE(World world, int x, int y, int z)
|
public TileEntity initDoorTE(World world, BlockPos pos) {
|
||||||
{
|
TileEntity te = this.createTileEntity(world, world.getBlockState(pos));
|
||||||
TileEntity te = this.createNewTileEntity(world, world.getBlockMetadata(x, y, z));
|
world.setTileEntity(pos, te);
|
||||||
world.setTileEntity(x, y, z, te);
|
|
||||||
return te;
|
return te;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(World world, int x, int y, int z, Block oldBlock, int oldMeta)
|
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
||||||
{
|
{
|
||||||
// This function runs on the server side after a block is replaced
|
// This function runs on the server side after a block is replaced
|
||||||
// We MUST call super.breakBlock() since it involves removing tile entities
|
// We MUST call super.breakBlock() since it involves removing tile entities
|
||||||
super.breakBlock(world, x, y, z, oldBlock, oldMeta);
|
super.breakBlock(world, pos, state);
|
||||||
|
|
||||||
// Schedule rift regeneration for this block if it was replaced
|
// Schedule rift regeneration for this block if it was replaced
|
||||||
if (world.getBlock(x, y, z) != oldBlock)
|
if (world.getBlock(x, y, z) != oldBlock)
|
||||||
|
|
|
@ -22,9 +22,9 @@ import com.zixiken.dimdoors.util.Point4D;
|
||||||
import com.zixiken.dimdoors.watcher.ClientDimData;
|
import com.zixiken.dimdoors.watcher.ClientDimData;
|
||||||
import com.zixiken.dimdoors.watcher.ClientLinkData;
|
import com.zixiken.dimdoors.watcher.ClientLinkData;
|
||||||
import com.zixiken.dimdoors.watcher.UpdateWatcherProxy;
|
import com.zixiken.dimdoors.watcher.UpdateWatcherProxy;
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class regulates all the operations involving the storage and
|
* This class regulates all the operations involving the storage and
|
||||||
|
@ -451,7 +451,7 @@ public class PocketManager
|
||||||
|
|
||||||
public static NewDimData registerDimension(World world)
|
public static NewDimData registerDimension(World world)
|
||||||
{
|
{
|
||||||
return registerDimension(world.provider.dimensionId, null, DimensionType.ROOT);
|
return registerDimension(world.provider.getDimensionId(), null, DimensionType.ROOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -588,12 +588,12 @@ public class PocketManager
|
||||||
|
|
||||||
public static NewDimData getDimensionData(World dimension)
|
public static NewDimData getDimensionData(World dimension)
|
||||||
{
|
{
|
||||||
return PocketManager.dimensionData.get(dimension.provider.dimensionId);
|
return PocketManager.dimensionData.get(dimension.provider.getDimensionId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static NewDimData createDimensionData(World world)
|
public static NewDimData createDimensionData(World world)
|
||||||
{
|
{
|
||||||
return createDimensionData(world.provider.dimensionId);
|
return createDimensionData(world.provider.getDimensionId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static NewDimData createDimensionDataDangerously(int dimensionID)
|
public static NewDimData createDimensionDataDangerously(int dimensionID)
|
||||||
|
@ -658,7 +658,7 @@ public class PocketManager
|
||||||
|
|
||||||
public static DimLink getLink(int x, int y, int z, World world)
|
public static DimLink getLink(int x, int y, int z, World world)
|
||||||
{
|
{
|
||||||
return getLink(x, y, z, world.provider.dimensionId);
|
return getLink(x, y, z, world.provider.getDimensionId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static DimLink getLink(Point4D point)
|
public static DimLink getLink(Point4D point)
|
||||||
|
|
Loading…
Add table
Reference in a new issue