teaked personal pocket generation rules
This commit is contained in:
@@ -1,14 +1,11 @@
|
|||||||
package StevenDimDoors.mod_pocketDim;
|
package StevenDimDoors.mod_pocketDim;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
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;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.Item;
|
|
||||||
import net.minecraft.item.ItemDoor;
|
import net.minecraft.item.ItemDoor;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.ChunkCoordinates;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
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;
|
||||||
@@ -20,11 +17,11 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
|||||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
|
import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
|
||||||
import net.minecraftforge.event.terraingen.InitMapGenEvent;
|
import net.minecraftforge.event.terraingen.InitMapGenEvent;
|
||||||
import net.minecraftforge.event.world.WorldEvent;
|
import net.minecraftforge.event.world.WorldEvent;
|
||||||
import StevenDimDoors.mod_pocketDim.blocks.BaseDimDoor;
|
|
||||||
import StevenDimDoors.mod_pocketDim.config.DDProperties;
|
import StevenDimDoors.mod_pocketDim.config.DDProperties;
|
||||||
import StevenDimDoors.mod_pocketDim.core.DDTeleporter;
|
import StevenDimDoors.mod_pocketDim.core.DDTeleporter;
|
||||||
|
import StevenDimDoors.mod_pocketDim.core.NewDimData;
|
||||||
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
import StevenDimDoors.mod_pocketDim.core.PocketManager;
|
||||||
import StevenDimDoors.mod_pocketDim.items.BaseItemDoor;
|
import StevenDimDoors.mod_pocketDim.items.ItemWarpDoor;
|
||||||
import StevenDimDoors.mod_pocketDim.util.Point4D;
|
import StevenDimDoors.mod_pocketDim.util.Point4D;
|
||||||
import StevenDimDoors.mod_pocketDim.world.LimboProvider;
|
import StevenDimDoors.mod_pocketDim.world.LimboProvider;
|
||||||
import StevenDimDoors.mod_pocketDim.world.PocketProvider;
|
import StevenDimDoors.mod_pocketDim.world.PocketProvider;
|
||||||
@@ -78,7 +75,6 @@ public class EventHookContainer
|
|||||||
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)
|
||||||
;
|
|
||||||
{
|
{
|
||||||
this.playMusicForDim(FMLClientHandler.instance().getClient().thePlayer.worldObj);
|
this.playMusicForDim(FMLClientHandler.instance().getClient().thePlayer.worldObj);
|
||||||
}
|
}
|
||||||
@@ -96,6 +92,20 @@ public class EventHookContainer
|
|||||||
ItemStack stack = event.entityPlayer.inventory.getCurrentItem();
|
ItemStack stack = event.entityPlayer.inventory.getCurrentItem();
|
||||||
if (stack != null && stack.getItem() instanceof ItemDoor)
|
if (stack != null && stack.getItem() instanceof ItemDoor)
|
||||||
{
|
{
|
||||||
|
if(stack.getItem() instanceof ItemWarpDoor)
|
||||||
|
{
|
||||||
|
NewDimData data = PocketManager.getDimensionData(world);
|
||||||
|
while(data.depth()>0)
|
||||||
|
{
|
||||||
|
if(PocketManager.getPersonalPocketMapping().containsValue(data))
|
||||||
|
{
|
||||||
|
mod_pocketDim.sendChat(event.entityPlayer,("Something prevents the Warp Door from tunneling out here"));
|
||||||
|
event.setCanceled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
data = data.parent();
|
||||||
|
}
|
||||||
|
}
|
||||||
if (mod_pocketDim.itemDimensionalDoor.tryToPlaceDoor(stack, event.entityPlayer, world,
|
if (mod_pocketDim.itemDimensionalDoor.tryToPlaceDoor(stack, event.entityPlayer, world,
|
||||||
event.x, event.y, event.z, event.face))
|
event.x, event.y, event.z, event.face))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -314,6 +314,14 @@ public class PocketBuilder
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**I know this is almost a copy of generateNewPocket, but we might want to change other things.
|
||||||
|
*
|
||||||
|
* @param link
|
||||||
|
* @param properties
|
||||||
|
* @param player
|
||||||
|
* @param door
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
public static boolean generateNewPersonalPocket(DimLink link, DDProperties properties,Entity player, Block door)
|
public static boolean generateNewPersonalPocket(DimLink link, DDProperties properties,Entity player, Block door)
|
||||||
{
|
{
|
||||||
//incase a chicken walks in or something
|
//incase a chicken walks in or something
|
||||||
@@ -343,20 +351,19 @@ public class PocketBuilder
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Calculate the destination point
|
//Calculate the destination point
|
||||||
Point4D dest = LimboProvider.getLimboSkySpawn((EntityPlayer) player, properties);
|
|
||||||
Point4D source = link.source();
|
Point4D source = link.source();
|
||||||
int destinationY = yCoordHelper.adjustDestinationY(link.source().getY(), world.getHeight(), wallThickness + 1, size);
|
int destinationY = yCoordHelper.adjustDestinationY(link.source().getY(), world.getHeight(), wallThickness + 1, size);
|
||||||
int orientation = getDoorOrientation(source, properties);
|
int orientation = getDoorOrientation(source, properties);
|
||||||
|
|
||||||
//Place a link leading back out of the pocket
|
//Place a link leading back out of the pocket
|
||||||
DimLink reverseLink = dimension.createLink(dest.getX(), destinationY, dest.getZ(), LinkTypes.REVERSE,(link.orientation()+2)%4);
|
DimLink reverseLink = dimension.createLink(source.getX(), destinationY, source.getZ(), LinkTypes.REVERSE,(link.orientation()+2)%4);
|
||||||
parent.setDestination(reverseLink, source.getX(), source.getY(), source.getZ());
|
parent.setDestination(reverseLink, source.getX(), source.getY(), source.getZ());
|
||||||
|
|
||||||
//Build the actual pocket area
|
//Build the actual pocket area
|
||||||
buildPocket(world, dest.getX(), destinationY, dest.getZ(), orientation, size, wallThickness, properties, door);
|
buildPocket(world, source.getX(), destinationY, source.getZ(), orientation, size, wallThickness, properties, door);
|
||||||
|
|
||||||
//Finish up destination initialization
|
//Finish up destination initialization
|
||||||
dimension.initializePocket(dest.getX(), destinationY, dest.getZ(), orientation, link);
|
dimension.initializePocket(source.getX(), destinationY, source.getZ(), orientation, link);
|
||||||
dimension.setFilled(true);
|
dimension.setFilled(true);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user