Fixed doors slamming shut on pressure plates
This commit is contained in:
parent
a13fc069eb
commit
b105d002c5
4 changed files with 69 additions and 8 deletions
|
@ -96,7 +96,7 @@ public class DDTeleporter
|
|||
|
||||
if (Block.blocksList[blockIDBottom] != null)
|
||||
{
|
||||
if(!Block.blocksList[blockIDBottom].isBlockReplaceable(world, point.getX(), point.getY(), point.getZ()))
|
||||
if(!Block.blocksList[blockIDBottom].isBlockReplaceable(world, point.getX(), point.getY(), point.getZ())&&world.isBlockOpaqueCube(point.getX(), point.getY(), point.getZ()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ import StevenDimDoors.mod_pocketDim.items.ItemWarpDoor;
|
|||
import StevenDimDoors.mod_pocketDim.items.ItemWorldThread;
|
||||
import StevenDimDoors.mod_pocketDim.items.itemRiftRemover;
|
||||
import StevenDimDoors.mod_pocketDim.ticking.CommonTickHandler;
|
||||
import StevenDimDoors.mod_pocketDim.ticking.FastRiftRegenerator;
|
||||
import StevenDimDoors.mod_pocketDim.ticking.LimboDecay;
|
||||
import StevenDimDoors.mod_pocketDim.ticking.MobMonolith;
|
||||
import StevenDimDoors.mod_pocketDim.ticking.CustomLimboPopulator;
|
||||
|
@ -141,6 +142,7 @@ public class mod_pocketDim
|
|||
|
||||
public static DDProperties properties;
|
||||
public static CustomLimboPopulator spawner; //Added this field temporarily. Will be refactored out later.
|
||||
public FastRiftRegenerator fastRiftRegenerator;
|
||||
public static GatewayGenerator gatewayGenerator;
|
||||
public static PlayerTracker tracker;
|
||||
|
||||
|
@ -162,8 +164,6 @@ public class mod_pocketDim
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onPreInitialization(FMLPreInitializationEvent event)
|
||||
{
|
||||
|
@ -190,6 +190,7 @@ public class mod_pocketDim
|
|||
spawner = new CustomLimboPopulator(commonTickHandler, properties);
|
||||
new RiftRegenerator(commonTickHandler); //No need to store the reference
|
||||
LimboDecay decay = new LimboDecay(commonTickHandler, properties);
|
||||
this.fastRiftRegenerator = new FastRiftRegenerator(commonTickHandler);
|
||||
|
||||
transientDoor = new TransientDoor(properties.TransientDoorID, Material.iron, properties).setHardness(1.0F) .setUnlocalizedName("transientDoor");
|
||||
goldenDimensionalDoor = new BlockGoldDimDoor(properties.GoldenDimensionalDoorID, Material.iron, properties).setHardness(1.0F) .setUnlocalizedName("dimDoorGold");
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
package StevenDimDoors.mod_pocketDim.ticking;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import StevenDimDoors.mod_pocketDim.DDProperties;
|
||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||
import StevenDimDoors.mod_pocketDim.core.DimLink;
|
||||
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||
import StevenDimDoors.mod_pocketDim.util.ChunkLocation;
|
||||
import StevenDimDoors.mod_pocketDim.util.Point4D;
|
||||
|
||||
public class FastRiftRegenerator implements IRegularTickReceiver {
|
||||
|
||||
private static final int RIFT_REGENERATION_INTERVAL = 10; //Regenerate random rifts every 200 ticks
|
||||
private ArrayList<Point4D> locationsToRegen=new ArrayList<Point4D>();
|
||||
|
||||
public FastRiftRegenerator(IRegularTickSender sender)
|
||||
{
|
||||
sender.registerForTicking(this, RIFT_REGENERATION_INTERVAL, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyTick()
|
||||
{
|
||||
regenerateRiftsInAllWorlds();
|
||||
}
|
||||
|
||||
public void regenerateRiftsInAllWorlds()
|
||||
{
|
||||
if(this.locationsToRegen.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
List<Integer> loadedWorlds = (List<Integer>)Arrays.asList(DimensionManager.getIDs());
|
||||
|
||||
for(Point4D point: this.locationsToRegen)
|
||||
{
|
||||
if(loadedWorlds.contains(point.getDimension())&&PocketManager.getLink(point)!=null)
|
||||
{
|
||||
World world = DimensionManager.getWorld(point.getDimension());
|
||||
|
||||
if(point!=null)
|
||||
{
|
||||
if (!mod_pocketDim.blockRift.isBlockImmune(world, point.getX(), point.getY(), point.getZ())&& world.getChunkProvider().chunkExists(point.getX() >> 4, point.getZ() >> 4))
|
||||
{
|
||||
world.setBlock(point.getX(), point.getY(), point.getZ(), mod_pocketDim.blockRift.blockID);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
this.locationsToRegen.clear();
|
||||
}
|
||||
public void registerRiftForRegen(int x, int y, int z, int dimID)
|
||||
{
|
||||
this.locationsToRegen.add(new Point4D(x,y,z,dimID));
|
||||
}
|
||||
|
||||
}
|
|
@ -47,11 +47,7 @@ public class TileEntityDimDoor extends TileEntity
|
|||
{
|
||||
if(PocketManager.getLink(xCoord, yCoord, zCoord, worldObj)!=null)
|
||||
{
|
||||
this.worldObj.setBlock(xCoord, yCoord, zCoord, mod_pocketDim.blockRift.blockID);
|
||||
}
|
||||
else if(PocketManager.getLink(xCoord, yCoord+1, zCoord, worldObj)!=null)
|
||||
{
|
||||
this.worldObj.setBlock(xCoord, yCoord+1, zCoord, mod_pocketDim.blockRift.blockID,0,2);
|
||||
mod_pocketDim.instance.fastRiftRegenerator.registerRiftForRegen(xCoord, yCoord, zCoord, this.worldObj.provider.dimensionId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue