More low-hanging fruit.
This commit is contained in:
@@ -3,6 +3,7 @@ package StevenDimDoors.experimental;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.chunk.Chunk;
|
import net.minecraft.world.chunk.Chunk;
|
||||||
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
import net.minecraft.world.chunk.storage.ExtendedBlockStorage;
|
||||||
@@ -16,7 +17,7 @@ public class MazeBuilder
|
|||||||
{
|
{
|
||||||
MazeDesign design = MazeDesigner.generate(random);
|
MazeDesign design = MazeDesigner.generate(random);
|
||||||
Point3D offset = new Point3D(x - design.width() / 2, y - design.height() - 1, z - design.length() / 2);
|
Point3D offset = new Point3D(x - design.width() / 2, y - design.height() - 1, z - design.length() / 2);
|
||||||
SphereDecayOperation decay = new SphereDecayOperation(random, 0, 0, Block.stoneBrick.blockID, 2);
|
SphereDecayOperation decay = new SphereDecayOperation(random, Blocks.air, 0, Blocks.stonebrick, 2);
|
||||||
|
|
||||||
buildRooms(design.getRoomGraph(), world, offset);
|
buildRooms(design.getRoomGraph(), world, offset);
|
||||||
carveDoorways(design.getRoomGraph(), world, offset, decay, random);
|
carveDoorways(design.getRoomGraph(), world, offset, decay, random);
|
||||||
@@ -37,7 +38,7 @@ public class MazeBuilder
|
|||||||
for (IGraphNode<PartitionNode, DoorwayData> node : roomGraph.nodes())
|
for (IGraphNode<PartitionNode, DoorwayData> node : roomGraph.nodes())
|
||||||
{
|
{
|
||||||
PartitionNode room = node.data();
|
PartitionNode room = node.data();
|
||||||
buildBox(world, offset, room.minCorner(), room.maxCorner(), Block.stoneBrick.blockID, 0);
|
buildBox(world, offset, room.minCorner(), room.maxCorner(), Blocks.stonebrick, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,28 +147,28 @@ public class MazeBuilder
|
|||||||
|
|
||||||
private static void carveDoorAlongX(World world, int x, int y, int z)
|
private static void carveDoorAlongX(World world, int x, int y, int z)
|
||||||
{
|
{
|
||||||
setBlockDirectly(world, x, y, z, 0, 0);
|
setBlockDirectly(world, x, y, z, Blocks.air, 0);
|
||||||
setBlockDirectly(world, x, y + 1, z, 0, 0);
|
setBlockDirectly(world, x, y + 1, z, Blocks.air, 0);
|
||||||
setBlockDirectly(world, x + 1, y, z, 0, 0);
|
setBlockDirectly(world, x + 1, y, z, Blocks.air, 0);
|
||||||
setBlockDirectly(world, x + 1, y + 1, z, 0, 0);
|
setBlockDirectly(world, x + 1, y + 1, z, Blocks.air, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void carveDoorAlongZ(World world, int x, int y, int z)
|
private static void carveDoorAlongZ(World world, int x, int y, int z)
|
||||||
{
|
{
|
||||||
setBlockDirectly(world, x, y, z, 0, 0);
|
setBlockDirectly(world, x, y, z, Blocks.air, 0);
|
||||||
setBlockDirectly(world, x, y + 1, z, 0, 0);
|
setBlockDirectly(world, x, y + 1, z, Blocks.air, 0);
|
||||||
setBlockDirectly(world, x, y, z + 1, 0, 0);
|
setBlockDirectly(world, x, y, z + 1, Blocks.air, 0);
|
||||||
setBlockDirectly(world, x, y + 1, z + 1, 0, 0);
|
setBlockDirectly(world, x, y + 1, z + 1, Blocks.air, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void carveHole(World world, int x, int y, int z)
|
private static void carveHole(World world, int x, int y, int z)
|
||||||
{
|
{
|
||||||
setBlockDirectly(world, x, y, z, 0, 0);
|
setBlockDirectly(world, x, y, z, Blocks.air, 0);
|
||||||
setBlockDirectly(world, x, y + 1, z, 0, 0);
|
setBlockDirectly(world, x, y + 1, z, Blocks.air, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static void buildBox(World world, Point3D offset, Point3D minCorner, Point3D maxCorner, int blockID, int metadata)
|
private static void buildBox(World world, Point3D offset, Point3D minCorner, Point3D maxCorner, Block block, int metadata)
|
||||||
{
|
{
|
||||||
int minX = minCorner.getX() + offset.getX();
|
int minX = minCorner.getX() + offset.getX();
|
||||||
int minY = minCorner.getY() + offset.getY();
|
int minY = minCorner.getY() + offset.getY();
|
||||||
@@ -183,35 +184,30 @@ public class MazeBuilder
|
|||||||
{
|
{
|
||||||
for (z = minZ; z <= maxZ; z++)
|
for (z = minZ; z <= maxZ; z++)
|
||||||
{
|
{
|
||||||
setBlockDirectly(world, x, minY, z, blockID, metadata);
|
setBlockDirectly(world, x, minY, z, block, metadata);
|
||||||
setBlockDirectly(world, x, maxY, z, blockID, metadata);
|
setBlockDirectly(world, x, maxY, z, block, metadata);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (x = minX; x <= maxX; x++)
|
for (x = minX; x <= maxX; x++)
|
||||||
{
|
{
|
||||||
for (y = minY; y <= maxY; y++)
|
for (y = minY; y <= maxY; y++)
|
||||||
{
|
{
|
||||||
setBlockDirectly(world, x, y, minZ, blockID, metadata);
|
setBlockDirectly(world, x, y, minZ, block, metadata);
|
||||||
setBlockDirectly(world, x, y, maxZ, blockID, metadata);
|
setBlockDirectly(world, x, y, maxZ, block, metadata);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (z = minZ; z <= maxZ; z++)
|
for (z = minZ; z <= maxZ; z++)
|
||||||
{
|
{
|
||||||
for (y = minY; y <= maxY; y++)
|
for (y = minY; y <= maxY; y++)
|
||||||
{
|
{
|
||||||
setBlockDirectly(world, minX, y, z, blockID, metadata);
|
setBlockDirectly(world, minX, y, z, block, metadata);
|
||||||
setBlockDirectly(world, maxX, y, z, blockID, metadata);
|
setBlockDirectly(world, maxX, y, z, block, metadata);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setBlockDirectly(World world, int x, int y, int z, int blockID, int metadata)
|
private static void setBlockDirectly(World world, int x, int y, int z, Block block, int metadata)
|
||||||
{
|
{
|
||||||
if (blockID != 0 && Block.blocksList[blockID] == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int cX = x >> 4;
|
int cX = x >> 4;
|
||||||
int cZ = z >> 4;
|
int cZ = z >> 4;
|
||||||
int cY = y >> 4;
|
int cY = y >> 4;
|
||||||
@@ -228,7 +224,7 @@ public class MazeBuilder
|
|||||||
extBlockStorage = new ExtendedBlockStorage(cY << 4, !world.provider.hasNoSky);
|
extBlockStorage = new ExtendedBlockStorage(cY << 4, !world.provider.hasNoSky);
|
||||||
chunk.getBlockStorageArray()[cY] = extBlockStorage;
|
chunk.getBlockStorageArray()[cY] = extBlockStorage;
|
||||||
}
|
}
|
||||||
extBlockStorage.setExtBlockID(localX, y & 15, localZ, blockID);
|
extBlockStorage.setExtBlockID(localX, y & 15, localZ, block);
|
||||||
extBlockStorage.setExtBlockMetadata(localX, y & 15, localZ, metadata);
|
extBlockStorage.setExtBlockMetadata(localX, y & 15, localZ, metadata);
|
||||||
chunk.setChunkModified();
|
chunk.setChunkModified();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,18 +29,18 @@ public class SphereDecayOperation extends WorldOperation
|
|||||||
private double centerX;
|
private double centerX;
|
||||||
private double centerY;
|
private double centerY;
|
||||||
private double centerZ;
|
private double centerZ;
|
||||||
private int primaryBlockID;
|
private Block primaryBlock;
|
||||||
private int primaryMetadata;
|
private int primaryMetadata;
|
||||||
private int secondaryBlockID;
|
private Block secondaryBlock;
|
||||||
private int secondaryMetadata;
|
private int secondaryMetadata;
|
||||||
|
|
||||||
public SphereDecayOperation(Random random, int primaryBlockID, int primaryMetadata, int secondaryBlockID, int secondaryMetadata)
|
public SphereDecayOperation(Random random, Block primaryBlock, int primaryMetadata, Block secondaryBlock, int secondaryMetadata)
|
||||||
{
|
{
|
||||||
super("SphereDecayOperation");
|
super("SphereDecayOperation");
|
||||||
this.random = random;
|
this.random = random;
|
||||||
this.primaryBlockID = primaryBlockID;
|
this.primaryBlock = primaryBlock;
|
||||||
this.primaryMetadata = primaryMetadata;
|
this.primaryMetadata = primaryMetadata;
|
||||||
this.secondaryBlockID = secondaryBlockID;
|
this.secondaryBlock = secondaryBlock;
|
||||||
this.secondaryMetadata = secondaryMetadata;
|
this.secondaryMetadata = secondaryMetadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,11 +72,11 @@ public class SphereDecayOperation extends WorldOperation
|
|||||||
|
|
||||||
if (squareDistance < 0.5 || random.nextDouble() < scaling / squareDistance)
|
if (squareDistance < 0.5 || random.nextDouble() < scaling / squareDistance)
|
||||||
{
|
{
|
||||||
world.setBlock(x, y, z, primaryBlockID, primaryMetadata, 1);
|
world.setBlock(x, y, z, primaryBlock, primaryMetadata, 1);
|
||||||
}
|
}
|
||||||
else if (random.nextDouble() < scaling / squareDistance)
|
else if (random.nextDouble() < scaling / squareDistance)
|
||||||
{
|
{
|
||||||
world.setBlock(x, y, z, secondaryBlockID, secondaryMetadata, 1);
|
world.setBlock(x, y, z, secondaryBlock, secondaryMetadata, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package StevenDimDoors.mod_pocketDim;
|
package StevenDimDoors.mod_pocketDim;
|
||||||
|
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockDispenser;
|
import net.minecraft.block.BlockDispenser;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@@ -14,10 +16,9 @@ import StevenDimDoors.mod_pocketDim.config.DDProperties;
|
|||||||
import StevenDimDoors.mod_pocketDim.core.DDLock;
|
import StevenDimDoors.mod_pocketDim.core.DDLock;
|
||||||
import StevenDimDoors.mod_pocketDim.items.ItemDDKey;
|
import StevenDimDoors.mod_pocketDim.items.ItemDDKey;
|
||||||
import StevenDimDoors.mod_pocketDim.items.behaviors.DispenserBehaviorStabilizedRS;
|
import StevenDimDoors.mod_pocketDim.items.behaviors.DispenserBehaviorStabilizedRS;
|
||||||
import cpw.mods.fml.common.ICraftingHandler;
|
|
||||||
import cpw.mods.fml.common.registry.GameRegistry;
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
|
|
||||||
public class CraftingManager implements ICraftingHandler
|
public class CraftingManager
|
||||||
{
|
{
|
||||||
CraftingManager() { }
|
CraftingManager() { }
|
||||||
|
|
||||||
@@ -123,19 +124,19 @@ public class CraftingManager implements ICraftingHandler
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@SubscribeEvent
|
||||||
public void onCrafting(EntityPlayer player, ItemStack item, IInventory craftMatrix)
|
public void onCrafting(PlayerEvent.ItemCraftedEvent event)
|
||||||
{
|
{
|
||||||
if(item.getItem() instanceof ItemDDKey)
|
if(event.crafting.getItem() instanceof ItemDDKey)
|
||||||
{
|
{
|
||||||
ItemDDKey keyItem = (ItemDDKey) item.getItem();
|
ItemDDKey keyItem = (ItemDDKey) event.crafting.getItem();
|
||||||
ItemStack topKey = null;
|
ItemStack topKey = null;
|
||||||
ItemStack bottomKey = null;
|
ItemStack bottomKey = null;
|
||||||
int topKeySlot = 0;
|
int topKeySlot = 0;
|
||||||
|
|
||||||
for(int i = 0; i<craftMatrix.getSizeInventory();i++)
|
for(int i = 0; i<event.craftMatrix.getSizeInventory();i++)
|
||||||
{
|
{
|
||||||
ItemStack slot = craftMatrix.getStackInSlot(i);
|
ItemStack slot = event.craftMatrix.getStackInSlot(i);
|
||||||
if(slot!=null)
|
if(slot!=null)
|
||||||
{
|
{
|
||||||
if(topKey==null)
|
if(topKey==null)
|
||||||
@@ -151,18 +152,11 @@ public class CraftingManager implements ICraftingHandler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
DDLock.addKeys(bottomKey, DDLock.getKeys(topKey));
|
DDLock.addKeys(bottomKey, DDLock.getKeys(topKey));
|
||||||
item.setTagCompound(bottomKey.getTagCompound());
|
event.crafting.setTagCompound(bottomKey.getTagCompound());
|
||||||
player.inventory.addItemStackToInventory(topKey);
|
event.player.inventory.addItemStackToInventory(topKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSmelting(EntityPlayer player, ItemStack item)
|
|
||||||
{
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void registerDispenserBehaviors()
|
public static void registerDispenserBehaviors()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package StevenDimDoors.mod_pocketDim;
|
package StevenDimDoors.mod_pocketDim;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.eventhandler.EventPriority;
|
||||||
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
import net.minecraft.client.audio.SoundManager;
|
import net.minecraft.client.audio.SoundManager;
|
||||||
import net.minecraft.client.audio.SoundPoolEntry;
|
import net.minecraft.client.audio.SoundPoolEntry;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
@@ -11,8 +13,6 @@ import net.minecraft.world.WorldProvider;
|
|||||||
import net.minecraft.world.chunk.Chunk;
|
import net.minecraft.world.chunk.Chunk;
|
||||||
import net.minecraftforge.client.event.sound.PlayBackgroundMusicEvent;
|
import net.minecraftforge.client.event.sound.PlayBackgroundMusicEvent;
|
||||||
import net.minecraftforge.client.event.sound.SoundLoadEvent;
|
import net.minecraftforge.client.event.sound.SoundLoadEvent;
|
||||||
import net.minecraftforge.event.EventPriority;
|
|
||||||
import net.minecraftforge.event.ForgeSubscribe;
|
|
||||||
import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
import net.minecraftforge.event.entity.living.LivingDeathEvent;
|
||||||
import net.minecraftforge.event.entity.living.LivingFallEvent;
|
import net.minecraftforge.event.entity.living.LivingFallEvent;
|
||||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||||
@@ -59,7 +59,7 @@ public class EventHookContainer
|
|||||||
this.regenerator = regenerator;
|
this.regenerator = regenerator;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ForgeSubscribe(priority = EventPriority.LOW)
|
@SubscribeEvent(priority = EventPriority.LOW)
|
||||||
public void onInitMapGen(InitMapGenEvent event)
|
public void onInitMapGen(InitMapGenEvent event)
|
||||||
{
|
{
|
||||||
// Replace the Nether fortress generator with our own only if any
|
// Replace the Nether fortress generator with our own only if any
|
||||||
@@ -74,7 +74,7 @@ public class EventHookContainer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
@ForgeSubscribe
|
@SubscribeEvent
|
||||||
public void onSoundLoad(SoundLoadEvent event)
|
public void onSoundLoad(SoundLoadEvent event)
|
||||||
{
|
{
|
||||||
event.manager.addSound(mod_pocketDim.modid + ":doorLockRemoved.ogg");
|
event.manager.addSound(mod_pocketDim.modid + ":doorLockRemoved.ogg");
|
||||||
@@ -93,7 +93,7 @@ public class EventHookContainer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
@ForgeSubscribe
|
@SubscribeEvent
|
||||||
public void onSoundEffectResult(PlayBackgroundMusicEvent event)
|
public void onSoundEffectResult(PlayBackgroundMusicEvent event)
|
||||||
{
|
{
|
||||||
if (FMLClientHandler.instance().getClient().thePlayer.worldObj.provider.dimensionId == mod_pocketDim.properties.LimboDimensionID)
|
if (FMLClientHandler.instance().getClient().thePlayer.worldObj.provider.dimensionId == mod_pocketDim.properties.LimboDimensionID)
|
||||||
@@ -102,7 +102,7 @@ public class EventHookContainer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ForgeSubscribe
|
@SubscribeEvent
|
||||||
public void onPlayerEvent(PlayerInteractEvent event)
|
public void onPlayerEvent(PlayerInteractEvent event)
|
||||||
{
|
{
|
||||||
// Handle all door placement here
|
// Handle all door placement here
|
||||||
@@ -135,7 +135,7 @@ public class EventHookContainer
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ForgeSubscribe
|
@SubscribeEvent
|
||||||
public void onWorldLoad(WorldEvent.Load event)
|
public void onWorldLoad(WorldEvent.Load event)
|
||||||
{
|
{
|
||||||
// We need to initialize PocketManager here because onServerAboutToStart
|
// We need to initialize PocketManager here because onServerAboutToStart
|
||||||
@@ -153,13 +153,13 @@ public class EventHookContainer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ForgeSubscribe
|
@SubscribeEvent
|
||||||
public void onPlayerFall(LivingFallEvent event)
|
public void onPlayerFall(LivingFallEvent event)
|
||||||
{
|
{
|
||||||
event.setCanceled(event.entity.worldObj.provider.dimensionId == properties.LimboDimensionID);
|
event.setCanceled(event.entity.worldObj.provider.dimensionId == properties.LimboDimensionID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ForgeSubscribe(priority = EventPriority.HIGHEST)
|
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||||
public boolean onDeathWithHighPriority(LivingDeathEvent event)
|
public boolean onDeathWithHighPriority(LivingDeathEvent event)
|
||||||
{
|
{
|
||||||
// Teleport the entity to Limbo if it's a player in a pocket dimension
|
// Teleport the entity to Limbo if it's a player in a pocket dimension
|
||||||
@@ -175,7 +175,7 @@ public class EventHookContainer
|
|||||||
if(entity.worldObj.provider instanceof PocketProvider)
|
if(entity.worldObj.provider instanceof PocketProvider)
|
||||||
{
|
{
|
||||||
EntityPlayer player = (EntityPlayer) entity;
|
EntityPlayer player = (EntityPlayer) entity;
|
||||||
mod_pocketDim.deathTracker.addUsername(player.username);
|
mod_pocketDim.deathTracker.addUsername(player.getGameProfile().getName());
|
||||||
revivePlayerInLimbo(player);
|
revivePlayerInLimbo(player);
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
return false;
|
return false;
|
||||||
@@ -192,7 +192,7 @@ public class EventHookContainer
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ForgeSubscribe(priority = EventPriority.LOWEST)
|
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||||
public boolean onDeathWithLowPriority(LivingDeathEvent event)
|
public boolean onDeathWithLowPriority(LivingDeathEvent event)
|
||||||
{
|
{
|
||||||
// This low-priority handler gives mods a chance to save a player from
|
// This low-priority handler gives mods a chance to save a player from
|
||||||
@@ -206,7 +206,7 @@ public class EventHookContainer
|
|||||||
if (entity instanceof EntityPlayer && isValidSourceForLimbo(entity.worldObj.provider))
|
if (entity instanceof EntityPlayer && isValidSourceForLimbo(entity.worldObj.provider))
|
||||||
{
|
{
|
||||||
EntityPlayer player = (EntityPlayer) entity;
|
EntityPlayer player = (EntityPlayer) entity;
|
||||||
mod_pocketDim.deathTracker.addUsername(player.username);
|
mod_pocketDim.deathTracker.addUsername(player.getGameProfile().getName());
|
||||||
|
|
||||||
if (properties.LimboEnabled && !properties.LimboReturnsInventoryEnabled)
|
if (properties.LimboEnabled && !properties.LimboReturnsInventoryEnabled)
|
||||||
{
|
{
|
||||||
@@ -240,7 +240,7 @@ public class EventHookContainer
|
|||||||
DDTeleporter.teleportEntity(player, destination, false);
|
DDTeleporter.teleportEntity(player, destination, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ForgeSubscribe
|
@SubscribeEvent
|
||||||
public void onWorldSave(WorldEvent.Save event)
|
public void onWorldSave(WorldEvent.Save event)
|
||||||
{
|
{
|
||||||
if (event.world.provider.dimensionId == 0)
|
if (event.world.provider.dimensionId == 0)
|
||||||
@@ -254,7 +254,7 @@ public class EventHookContainer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ForgeSubscribe
|
@SubscribeEvent
|
||||||
public void onChunkLoad(ChunkEvent.Load event)
|
public void onChunkLoad(ChunkEvent.Load event)
|
||||||
{
|
{
|
||||||
// Schedule rift regeneration for any links located in this chunk.
|
// Schedule rift regeneration for any links located in this chunk.
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ package StevenDimDoors.mod_pocketDim.core;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
|
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityList;
|
import net.minecraft.entity.EntityList;
|
||||||
@@ -381,7 +384,7 @@ public class DDTeleporter
|
|||||||
newWorld.getChunkProvider().loadChunk(MathHelper.floor_double(entity.posX) >> 4, MathHelper.floor_double(entity.posZ) >> 4);
|
newWorld.getChunkProvider().loadChunk(MathHelper.floor_double(entity.posX) >> 4, MathHelper.floor_double(entity.posZ) >> 4);
|
||||||
// Tell Forge we're moving its players so everyone else knows.
|
// Tell Forge we're moving its players so everyone else knows.
|
||||||
// Let's try doing this down here in case this is what's killing NEI.
|
// Let's try doing this down here in case this is what's killing NEI.
|
||||||
GameRegistry.onPlayerChangedDimension((EntityPlayer)entity);
|
FMLCommonHandler.instance().firePlayerChangedDimensionEvent((EntityPlayer)entity, oldWorld.provider.dimensionId, newWorld.provider.dimensionId);
|
||||||
}
|
}
|
||||||
DDTeleporter.placeInPortal(entity, newWorld, destination, properties, checkOrientation);
|
DDTeleporter.placeInPortal(entity, newWorld, destination, properties, checkOrientation);
|
||||||
return entity;
|
return entity;
|
||||||
|
|||||||
@@ -33,12 +33,12 @@ public class FillContainersOperation extends WorldOperation
|
|||||||
@Override
|
@Override
|
||||||
protected boolean applyToBlock(World world, int x, int y, int z)
|
protected boolean applyToBlock(World world, int x, int y, int z)
|
||||||
{
|
{
|
||||||
int blockID = world.getBlockId(x, y, z);
|
Block block = world.getBlock(x, y, z);
|
||||||
|
|
||||||
// Fill empty chests and dispensers
|
// Fill empty chests and dispensers
|
||||||
if (Block.blocksList[blockID] instanceof BlockContainer)
|
if (block instanceof BlockContainer)
|
||||||
{
|
{
|
||||||
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
|
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
// Fill chests
|
// Fill chests
|
||||||
if (tileEntity instanceof TileEntityChest)
|
if (tileEntity instanceof TileEntityChest)
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class ModBlockFilter extends SchematicFilter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//No matching exception found. Replace the block.
|
//No matching exception found. Replace the block.
|
||||||
blocks[index] = replacementBlockID;
|
blocks[index] = replacementBlock;
|
||||||
metadata[index] = replacementMetadata;
|
metadata[index] = replacementMetadata;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package StevenDimDoors.mod_pocketDim;
|
package StevenDimDoors.mod_pocketDim;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.creativetab.CreativeTabs;
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
@@ -189,7 +191,7 @@ public class mod_pocketDim
|
|||||||
{
|
{
|
||||||
// Initialize ServerTickHandler instance
|
// Initialize ServerTickHandler instance
|
||||||
serverTickHandler = new ServerTickHandler();
|
serverTickHandler = new ServerTickHandler();
|
||||||
TickRegistry.registerTickHandler(serverTickHandler, Side.SERVER);
|
FMLCommonHandler.instance().bus().register(serverTickHandler);
|
||||||
|
|
||||||
// Initialize LimboDecay instance: required for BlockLimbo
|
// Initialize LimboDecay instance: required for BlockLimbo
|
||||||
limboDecay = new LimboDecay(properties);
|
limboDecay = new LimboDecay(properties);
|
||||||
@@ -307,7 +309,7 @@ public class mod_pocketDim
|
|||||||
|
|
||||||
CraftingManager.registerRecipes(properties);
|
CraftingManager.registerRecipes(properties);
|
||||||
CraftingManager.registerDispenserBehaviors();
|
CraftingManager.registerDispenserBehaviors();
|
||||||
GameRegistry.registerCraftingHandler(new CraftingManager());
|
FMLCommonHandler.instance().bus().register(new CraftingManager());
|
||||||
|
|
||||||
DungeonHelper.initialize();
|
DungeonHelper.initialize();
|
||||||
gatewayGenerator = new GatewayGenerator(properties);
|
gatewayGenerator = new GatewayGenerator(properties);
|
||||||
|
|||||||
@@ -1,13 +1,15 @@
|
|||||||
package StevenDimDoors.mod_pocketDim.ticking;
|
package StevenDimDoors.mod_pocketDim.ticking;
|
||||||
|
|
||||||
|
import java.lang.reflect.Type;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
|
||||||
import StevenDimDoors.mod_pocketDim.core.DDTeleporter;
|
import StevenDimDoors.mod_pocketDim.core.DDTeleporter;
|
||||||
import cpw.mods.fml.common.ITickHandler;
|
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||||
import cpw.mods.fml.common.TickType;
|
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
|
||||||
public class ServerTickHandler implements ITickHandler, IRegularTickSender
|
public class ServerTickHandler implements IRegularTickSender
|
||||||
{
|
{
|
||||||
private static final String PROFILING_LABEL = "Dimensional Doors: Server Tick";
|
private static final String PROFILING_LABEL = "Dimensional Doors: Server Tick";
|
||||||
|
|
||||||
@@ -32,10 +34,19 @@ public class ServerTickHandler implements ITickHandler, IRegularTickSender
|
|||||||
receivers.clear();
|
receivers.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@SubscribeEvent
|
||||||
public void tickStart(EnumSet<TickType> type, Object... tickData)
|
public void tickEvent(TickEvent event) {
|
||||||
{
|
if (event.side != Side.SERVER)
|
||||||
if (type.equals(EnumSet.of(TickType.SERVER)))
|
return;
|
||||||
|
|
||||||
|
if (event.phase == TickEvent.Phase.START)
|
||||||
|
tickStart(event.type);
|
||||||
|
else if (event.phase == TickEvent.Phase.END)
|
||||||
|
tickEnd(event.type);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void tickStart(TickEvent.Type type) {
|
||||||
|
if (type.equals(EnumSet.of(TickEvent.Type.SERVER)))
|
||||||
{
|
{
|
||||||
for (RegularTickReceiverInfo info : receivers)
|
for (RegularTickReceiverInfo info : receivers)
|
||||||
{
|
{
|
||||||
@@ -54,8 +65,7 @@ public class ServerTickHandler implements ITickHandler, IRegularTickSender
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void tickEnd(TickEvent.Type type)
|
||||||
public void tickEnd(EnumSet<TickType> type, Object... tickData)
|
|
||||||
{
|
{
|
||||||
for (RegularTickReceiverInfo info : receivers)
|
for (RegularTickReceiverInfo info : receivers)
|
||||||
{
|
{
|
||||||
@@ -66,16 +76,4 @@ public class ServerTickHandler implements ITickHandler, IRegularTickSender
|
|||||||
}
|
}
|
||||||
tickCount++; //There is no need to reset the counter. Let it overflow.
|
tickCount++; //There is no need to reset the counter. Let it overflow.
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumSet<TickType> ticks()
|
|
||||||
{
|
|
||||||
return EnumSet.of(TickType.SERVER);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getLabel()
|
|
||||||
{
|
|
||||||
return PROFILING_LABEL; //Used for profiling!
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -547,7 +547,7 @@ public class PocketBuilder
|
|||||||
extBlockStorage = new ExtendedBlockStorage(cY << 4, !world.provider.hasNoSky);
|
extBlockStorage = new ExtendedBlockStorage(cY << 4, !world.provider.hasNoSky);
|
||||||
chunk.getBlockStorageArray()[cY] = extBlockStorage;
|
chunk.getBlockStorageArray()[cY] = extBlockStorage;
|
||||||
}
|
}
|
||||||
extBlockStorage.setExtBlockID(localX, y & 15, localZ, blockID);
|
extBlockStorage.setExtBlockID(localX, y & 15, localZ, block);
|
||||||
extBlockStorage.setExtBlockMetadata(localX, y & 15, localZ, metadata);
|
extBlockStorage.setExtBlockMetadata(localX, y & 15, localZ, metadata);
|
||||||
chunk.setChunkModified();
|
chunk.setChunkModified();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public class PocketProvider extends WorldProvider
|
|||||||
@Override
|
@Override
|
||||||
protected void registerWorldChunkManager()
|
protected void registerWorldChunkManager()
|
||||||
{
|
{
|
||||||
super.worldChunkMgr = new WorldChunkManagerHell(mod_pocketDim.pocketBiome, 1, 1);
|
super.worldChunkMgr = new WorldChunkManagerHell(mod_pocketDim.pocketBiome, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -47,14 +47,14 @@ public class PocketProvider extends WorldProvider
|
|||||||
public Vec3 getSkyColor(Entity cameraEntity, float partialTicks)
|
public Vec3 getSkyColor(Entity cameraEntity, float partialTicks)
|
||||||
{
|
{
|
||||||
setCloudRenderer( new CloudRenderBlank());
|
setCloudRenderer( new CloudRenderBlank());
|
||||||
return this.worldObj.getWorldVec3Pool().getVecFromPool(0d, 0d, 0d);
|
return Vec3.createVectorHelper(0d, 0d, 0d);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
@Override
|
@Override
|
||||||
public Vec3 getFogColor(float par1, float par2)
|
public Vec3 getFogColor(float par1, float par2)
|
||||||
{
|
{
|
||||||
return this.worldObj.getWorldVec3Pool().getVecFromPool(0d, 0d, 0d);
|
return Vec3.createVectorHelper(0d, 0d, 0d);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -70,7 +70,7 @@ public class PocketProvider extends WorldProvider
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canSnowAt(int x, int y, int z)
|
public boolean canSnowAt(int x, int y, int z, boolean light)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class DDNetherFortressGenerator extends MapGenNetherBridge
|
|||||||
// If we don't do this, Minecraft will crash when a fortress tries to generate.
|
// If we don't do this, Minecraft will crash when a fortress tries to generate.
|
||||||
// Moreover, use Fortress as our structure identifier so that if DD is removed,
|
// Moreover, use Fortress as our structure identifier so that if DD is removed,
|
||||||
// fortresses will generate properly using Vanilla code.
|
// fortresses will generate properly using Vanilla code.
|
||||||
MapGenStructureIO.func_143034_b(DDStructureNetherBridgeStart.class, "Fortress");
|
MapGenStructureIO.func_143031_a(DDStructureNetherBridgeStart.class, "Fortress");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -10,8 +10,9 @@ import net.minecraft.world.gen.structure.StructureBoundingBox;
|
|||||||
import net.minecraft.world.gen.structure.StructureComponent;
|
import net.minecraft.world.gen.structure.StructureComponent;
|
||||||
import StevenDimDoors.mod_pocketDim.config.DDProperties;
|
import StevenDimDoors.mod_pocketDim.config.DDProperties;
|
||||||
import net.minecraft.world.gen.structure.StructureNetherBridgePieces;
|
import net.minecraft.world.gen.structure.StructureNetherBridgePieces;
|
||||||
|
import net.minecraft.world.gen.structure.StructureStart;
|
||||||
|
|
||||||
public class DDStructureNetherBridgeStart extends StructureNetherBridgePieces.Start
|
public class DDStructureNetherBridgeStart extends StructureStart
|
||||||
{
|
{
|
||||||
public static final int MAX_GATEWAY_GENERATION_CHANCE = 100;
|
public static final int MAX_GATEWAY_GENERATION_CHANCE = 100;
|
||||||
|
|
||||||
@@ -25,7 +26,7 @@ public class DDStructureNetherBridgeStart extends StructureNetherBridgePieces.St
|
|||||||
public DDStructureNetherBridgeStart(World world, Random random, int chunkX, int chunkZ, DDProperties properties)
|
public DDStructureNetherBridgeStart(World world, Random random, int chunkX, int chunkZ, DDProperties properties)
|
||||||
{
|
{
|
||||||
// StructureNetherBridgeStart handles designing the fortress for us
|
// StructureNetherBridgeStart handles designing the fortress for us
|
||||||
super(random, chunkX, chunkZ);
|
super(chunkX, chunkZ);
|
||||||
|
|
||||||
Iterator componentIterator;
|
Iterator componentIterator;
|
||||||
StructureComponent component;
|
StructureComponent component;
|
||||||
|
|||||||
Reference in New Issue
Block a user