Remove unused code
This commit is contained in:
parent
6c1d784691
commit
21e0003871
39 changed files with 180 additions and 349 deletions
|
@ -29,7 +29,6 @@ public class DimDoors {
|
|||
|
||||
@Mod.Instance(DimDoors.MODID)
|
||||
public static DimDoors instance;
|
||||
|
||||
public static Logger log; // TODO: make non-static?
|
||||
|
||||
@SidedProxy(clientSide = "org.dimdev.dimdoors.client.DDProxyClient",
|
||||
|
@ -70,14 +69,6 @@ public class DimDoors {
|
|||
event.registerServerCommand(new CommandPocket());
|
||||
}
|
||||
|
||||
public static boolean isClient() {
|
||||
return proxy.isClient();
|
||||
}
|
||||
|
||||
public static boolean isServer() {
|
||||
return !isClient();
|
||||
}
|
||||
|
||||
public static void chat(Entity entity, String text) {
|
||||
entity.sendMessage(new TextComponentString("[DimDoors] " + text));
|
||||
}
|
||||
|
|
|
@ -50,8 +50,8 @@ public class DDProxyClient extends DDProxyCommon {
|
|||
}
|
||||
|
||||
@Override
|
||||
public WorldServer getWorldServer(int dimId) {
|
||||
return Minecraft.getMinecraft().getIntegratedServer().getWorld(dimId);
|
||||
public WorldServer getWorldServer(int dim) {
|
||||
return Minecraft.getMinecraft().getIntegratedServer().getWorld(dim);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package org.dimdev.dimdoors.client;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import org.dimdev.dimdoors.shared.entities.EntityMonolith;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.dimdev.dimdoors.client;
|
||||
|
||||
import org.dimdev.ddutils.WorldUtils;
|
||||
import org.dimdev.dimdoors.shared.world.DimDoorDimensions;
|
||||
import org.dimdev.dimdoors.shared.world.ModDimensions;
|
||||
import net.minecraft.client.particle.ParticleSimpleAnimated;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
@ -23,7 +22,7 @@ public class ParticleRiftEffect extends ParticleSimpleAnimated { // TODO: colors
|
|||
|
||||
particleScale *= scale;
|
||||
particleMaxAge = size - spread / 2 + rand.nextInt(spread);
|
||||
colorMultiplier = DimDoorDimensions.isPocketDimension(WorldUtils.getDim(world)) ? pocketColorMultiplier : nonPocketColorMultiplier;
|
||||
colorMultiplier = ModDimensions.isDimDoorsPocketDimension(world) ? pocketColorMultiplier : nonPocketColorMultiplier;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,7 +20,7 @@ import java.util.List;
|
|||
@SideOnly(Side.CLIENT)
|
||||
public class RenderMonolith extends RenderLiving<EntityMonolith> {
|
||||
|
||||
protected ModelMonolith obeliskModel;
|
||||
protected ModelMonolith monolithModel;
|
||||
|
||||
protected static final List<ResourceLocation> monolith_textures = Arrays.asList(
|
||||
new ResourceLocation(DimDoors.MODID + ":textures/mobs/monolith/monolith0.png"),
|
||||
|
@ -45,7 +45,7 @@ public class RenderMonolith extends RenderLiving<EntityMonolith> {
|
|||
|
||||
public RenderMonolith(RenderManager manager, float f) {
|
||||
super(manager, new ModelMonolith(), f);
|
||||
obeliskModel = (ModelMonolith) mainModel;
|
||||
monolithModel = (ModelMonolith) mainModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -72,8 +72,7 @@ public class RenderMonolith extends RenderLiving<EntityMonolith> {
|
|||
//this.renderLeash(entity, x, y, z, par8, par9);
|
||||
}
|
||||
|
||||
public void render(EntityMonolith par1EntityLivingBase, double x, double y, double z, float par8, float par9)
|
||||
{
|
||||
public void render(EntityMonolith par1EntityLivingBase, double x, double y, double z, float par8, float par9) {
|
||||
if (MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Pre<>(par1EntityLivingBase, this, 1, x, y, z))) return;
|
||||
GL11.glPushMatrix();
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
|
@ -97,7 +96,7 @@ public class RenderMonolith extends RenderLiving<EntityMonolith> {
|
|||
|
||||
GL11.glScalef(-1.0F, -1.0F, 1.0F);
|
||||
preRenderCallback(par1EntityLivingBase, par9);
|
||||
GL11.glRotatef(par1EntityLivingBase.pitchLevel , 1.0F, 0.0F, 0.0F);
|
||||
GL11.glRotatef(par1EntityLivingBase.pitchLevel, 1.0F, 0.0F, 0.0F);
|
||||
GL11.glTranslatef(0.0F, 24.0F * f6 - 0.0078125F, 0.0F);
|
||||
|
||||
|
||||
|
@ -124,6 +123,7 @@ public class RenderMonolith extends RenderLiving<EntityMonolith> {
|
|||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityMonolith monolith) {
|
||||
return monolith_textures.get(monolith.getTextureState()); //return new ResourceLocation(DimDoors.MODID + ":textures/mobs/monolith/monolith" + monolith.getTextureState() + ".png");
|
||||
return monolith_textures.get(monolith.getTextureState());
|
||||
//return new ResourceLocation(DimDoors.MODID + ":textures/mobs/monolith/monolith" + monolith.getTextureState() + ".png");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package org.dimdev.dimdoors.shared;
|
||||
|
||||
import org.dimdev.dimdoors.DimDoors;
|
||||
import java.io.File;
|
||||
|
||||
import org.dimdev.dimdoors.shared.world.gateways.DimensionFilter;
|
||||
|
@ -21,7 +20,7 @@ public final class DDConfig {
|
|||
@Getter private static int maxPocketSize = 15;
|
||||
@Getter private static int privatePocketSize = 3;
|
||||
@Getter private static int publicPocketSize = 2;
|
||||
@Getter private static int baseDimID = 684;
|
||||
@Getter private static int baseDim = 684;
|
||||
@Getter private static int maxDungeonDepth = 100;
|
||||
@Getter private static int owCoordinateOffsetBase = 64;
|
||||
@Getter private static double owCoordinateOffsetPower = 1.3;
|
||||
|
@ -66,9 +65,9 @@ public final class DDConfig {
|
|||
|
||||
// Setup general
|
||||
config.addCustomCategoryComment("general", "General configuration options.");
|
||||
Property prop = config.get("general", "baseDimID", baseDimID,
|
||||
Property prop = config.get("general", "baseDim", baseDim,
|
||||
"Dimension ID of the first Dimensional Doors dimension. Other dimensions will use consecutive IDs. NB: If you change this after creating a world, you may lose these dimensions. [default: 684]");
|
||||
baseDimID = prop.getInt(baseDimID);
|
||||
baseDim = prop.getInt(baseDim);
|
||||
|
||||
//Dungeons
|
||||
config.addCustomCategoryComment("dungeons", "The following options will determine the depths, wandering offsets and contents of Dungeon Pockets.");
|
||||
|
@ -103,11 +102,10 @@ public final class DDConfig {
|
|||
"Is Monolith Teleportation enabled? [default: true]");
|
||||
monolithTeleportationEnabled = prop.getBoolean();
|
||||
|
||||
//Pocket_Dimensions
|
||||
//Pocket Dimensions
|
||||
config.addCustomCategoryComment("pocket_dimension", "The following values determine the maximum sizes of different kinds of pockets. These values will only influence new worlds.");
|
||||
pocketGridSize = setConfigIntWithMaxAndMin(config, "pocket_dimension", "pocketGridSize", pocketGridSize,
|
||||
"Sets how many chunks apart all pockets in pocket dimensions should be placed. [min: 4, max: 32, default: 32]", 4, 32);
|
||||
DimDoors.log.info("pocketGridSize was set to " + pocketGridSize);
|
||||
|
||||
maxPocketSize = setConfigIntWithMaxAndMin(config, "pocket_dimension", "maxPocketSize", maxPocketSize,
|
||||
"Sets how deep and wide any pocket can be. [min: 0, max: pocketGridSize/2, default: 4]", 0, (int) ((double) pocketGridSize / 2 - 0.5));
|
||||
|
|
|
@ -7,7 +7,7 @@ import org.dimdev.dimdoors.shared.items.ModItems;
|
|||
import org.dimdev.dimdoors.shared.rifts.*;
|
||||
import org.dimdev.dimdoors.shared.sound.ModSounds;
|
||||
import org.dimdev.dimdoors.shared.tileentities.*;
|
||||
import org.dimdev.dimdoors.shared.world.DimDoorDimensions;
|
||||
import org.dimdev.dimdoors.shared.world.ModDimensions;
|
||||
import org.dimdev.dimdoors.shared.world.ModBiomes;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
@ -28,7 +28,7 @@ public abstract class DDProxyCommon implements IDDProxy {
|
|||
MinecraftForge.EVENT_BUS.register(ModBiomes.class);
|
||||
|
||||
registerTileEntities();
|
||||
DimDoorDimensions.registerDimensions();
|
||||
ModDimensions.registerDimensions();
|
||||
|
||||
EntityRegistry.registerModEntity(new ResourceLocation(DimDoors.MODID, "mob_monolith"), EntityMonolith.class, "monolith", 0, DimDoors.instance, 70, 1, true);
|
||||
EntityRegistry.registerEgg(new ResourceLocation(DimDoors.MODID, "mob_monolith"), 0, 0xffffff);
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
package org.dimdev.dimdoors.shared;
|
||||
|
||||
import org.dimdev.dimdoors.DimDoors;
|
||||
import org.dimdev.dimdoors.shared.pockets.PocketRegistry;
|
||||
import org.dimdev.dimdoors.shared.rifts.RiftRegistry;
|
||||
import org.dimdev.dimdoors.shared.world.DimDoorDimensions;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.util.DamageSource;
|
||||
|
@ -13,36 +9,41 @@ import net.minecraftforge.event.entity.living.LivingHurtEvent;
|
|||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent;
|
||||
import org.dimdev.dimdoors.shared.pockets.PocketRegistry;
|
||||
import org.dimdev.dimdoors.shared.rifts.RiftRegistry;
|
||||
import org.dimdev.dimdoors.shared.world.ModDimensions;
|
||||
|
||||
public final class EventHandler {
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGHEST) // don't let other mods do something based on the event
|
||||
public static void onLivingHurt(LivingHurtEvent event) {
|
||||
Entity entity = event.getEntity();
|
||||
if (entity.dimension == DimDoorDimensions.limbo.getId() && event.getSource() == DamageSource.FALL) {
|
||||
if (entity.dimension == ModDimensions.LIMBO.getId() && event.getSource() == DamageSource.FALL) {
|
||||
event.setCanceled(true);// no fall damage in limbo
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onEntityEnterChunk(EntityEvent.EnteringChunk event) {
|
||||
// TODO: Pass to PocketLib
|
||||
Entity entity = event.getEntity();
|
||||
if (entity instanceof EntityPlayerMP) {
|
||||
EntityPlayerMP player = (EntityPlayerMP) entity;
|
||||
World world = entity.world;
|
||||
int dimID = world.provider.getDimension();
|
||||
if (!world.isRemote && !player.isDead && DimDoorDimensions.isPocketDimension(dimID) && !PocketRegistry.getForDim(dimID).isPlayerAllowedToBeHere(player, player.getPosition())) {
|
||||
// TODO: Avoid players even getting here by making a maximum build distance that's smaller than the pocket size
|
||||
// TODO: This doesn't really work yet.
|
||||
DimDoors.chat(player, "You travelled too far into the void and have been sent to Limbo.");
|
||||
// PocketRegistry.sendToLimbo(player); // TODO
|
||||
int dim = world.provider.getDimension();
|
||||
if (!world.isRemote
|
||||
&& !player.isDead
|
||||
&& ModDimensions.isDimDoorsPocketDimension(world)
|
||||
&& !PocketRegistry.getForDim(dim).isPlayerAllowedToBeHere(player, player.getPosition())) {
|
||||
// TODO: make the world circular
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority=EventPriority.LOWEST)
|
||||
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||
public static void onDimensionChange(PlayerEvent.PlayerChangedDimensionEvent event) {
|
||||
if (DimDoorDimensions.isPocketDimension(event.fromDim) && !DimDoorDimensions.isPocketDimension(event.toDim)) {
|
||||
// TODO: PocketLib compatibility
|
||||
if (ModDimensions.isDimDoorsPocketDimension(event.fromDim) && !ModDimensions.isDimDoorsPocketDimension(event.toDim)) {
|
||||
RiftRegistry.setOverworldRift(event.player.getCachedUniqueIdString(), null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
package org.dimdev.dimdoors.shared;
|
||||
|
||||
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||
|
||||
public interface IChunkLoader {
|
||||
|
||||
boolean isInitialized();
|
||||
|
||||
void initialize(Ticket ticket);
|
||||
}
|
|
@ -21,7 +21,7 @@ public interface IDDProxy {
|
|||
|
||||
public EntityPlayer getLocalPlayer();
|
||||
|
||||
public WorldServer getWorldServer(int dimId);
|
||||
public WorldServer getWorldServer(int dim);
|
||||
|
||||
public void setCloudRenderer(WorldProvider provider, IRenderHandler renderer);
|
||||
|
||||
|
|
|
@ -7,19 +7,15 @@ import net.minecraft.util.math.RayTraceResult;
|
|||
import net.minecraft.world.World;
|
||||
|
||||
public final class RayTraceHelper {
|
||||
public static boolean isRift(RayTraceResult hit, World world) {
|
||||
return isNotNull(hit) && hit.typeOfHit == RayTraceResult.Type.BLOCK && world.getTileEntity(hit.getBlockPos()) instanceof TileEntityFloatingRift;
|
||||
public static boolean isFloatingRift(RayTraceResult hit, World world) {
|
||||
return hit != null && hit.typeOfHit == RayTraceResult.Type.BLOCK && world.getTileEntity(hit.getBlockPos()) instanceof TileEntityFloatingRift;
|
||||
}
|
||||
|
||||
public static boolean isAbstractRift(RayTraceResult hit, World world) {
|
||||
return isNotNull(hit) && hit.typeOfHit == RayTraceResult.Type.BLOCK && world.getTileEntity(hit.getBlockPos()) instanceof TileEntityRift;
|
||||
public static boolean isRift(RayTraceResult hit, World world) {
|
||||
return hit != null && hit.typeOfHit == RayTraceResult.Type.BLOCK && world.getTileEntity(hit.getBlockPos()) instanceof TileEntityRift;
|
||||
}
|
||||
|
||||
public static boolean isLivingEntity(RayTraceResult hit) {
|
||||
return isNotNull(hit) && hit.typeOfHit == RayTraceResult.Type.ENTITY && hit.entityHit instanceof EntityLivingBase;
|
||||
}
|
||||
|
||||
private static boolean isNotNull(RayTraceResult hit) {
|
||||
return hit != null;
|
||||
return hit != null && hit.typeOfHit == RayTraceResult.Type.ENTITY && hit.entityHit instanceof EntityLivingBase;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package org.dimdev.dimdoors.shared;
|
|||
import org.dimdev.dimdoors.shared.pockets.Pocket;
|
||||
import org.dimdev.dimdoors.shared.pockets.PocketRegistry;
|
||||
import org.dimdev.ddutils.Location;
|
||||
import org.dimdev.dimdoors.shared.world.DimDoorDimensions;
|
||||
import org.dimdev.dimdoors.shared.world.ModDimensions;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.ToString;
|
||||
|
@ -35,7 +35,7 @@ public class VirtualLocation {
|
|||
|
||||
public static VirtualLocation fromLocation(Location location) {
|
||||
VirtualLocation virtualLocation = null;
|
||||
if (DimDoorDimensions.isPocketDimension(location.getDim())) {
|
||||
if (ModDimensions.isDimDoorsPocketDimension(location.getDim())) {
|
||||
Pocket pocket = PocketRegistry.getForDim(location.getDim()).getPocketAt(location.getPos());
|
||||
if (pocket != null) {
|
||||
virtualLocation = pocket.getVirtualLocation(); // TODO: pocket-relative coordinates
|
||||
|
|
|
@ -7,7 +7,7 @@ import org.dimdev.dimdoors.shared.rifts.TileEntityRift;
|
|||
import org.dimdev.ddutils.Location;
|
||||
import org.dimdev.ddutils.TeleportUtils;
|
||||
import org.dimdev.ddutils.WorldUtils;
|
||||
import org.dimdev.dimdoors.shared.world.DimDoorDimensions;
|
||||
import org.dimdev.dimdoors.shared.world.ModDimensions;
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
|
@ -73,7 +73,7 @@ public class CommandPocket extends CommandBase {
|
|||
if (sender instanceof EntityPlayerMP) {
|
||||
EntityPlayerMP player = getCommandSenderAsPlayer(sender);
|
||||
// Make sure the player is in a pocket world
|
||||
if (!DimDoorDimensions.isPocketDimension(WorldUtils.getDim(player.world))) {
|
||||
if (!ModDimensions.isDimDoorsPocketDimension(player.world)) {
|
||||
DimDoors.chat(player, "You must be in a pocket dimension to use this command!");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ public class EntityMonolith extends EntityFlying implements IMob {
|
|||
}
|
||||
|
||||
public boolean isDangerous() {
|
||||
return DDConfig.isMonolithTeleportationEnabled() && (world.provider instanceof WorldProviderLimbo || DDConfig.isDangerousLimboMonolithsEnabled());
|
||||
return DDConfig.isMonolithTeleportationEnabled() && (world.provider instanceof WorldProviderLimbo || DDConfig.isDangerousLimboMonolithsEnabled());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -58,7 +58,7 @@ public class ItemRiftBlade extends ItemSword {
|
|||
}
|
||||
//SchematicHandler.Instance.getPersonalPocketTemplate().place(0, 20, 0, 20, 0, 0, 1, EnumPocketType.DUNGEON); //this line can be activated for testing purposes
|
||||
RayTraceResult hit = rayTrace(worldIn, playerIn, true);
|
||||
if (RayTraceHelper.isRift(hit, worldIn)) {
|
||||
if (RayTraceHelper.isFloatingRift(hit, worldIn)) {
|
||||
TileEntityFloatingRift rift = (TileEntityFloatingRift) worldIn.getTileEntity(hit.getBlockPos());
|
||||
rift.teleport(playerIn);
|
||||
|
||||
|
|
|
@ -1,32 +1,21 @@
|
|||
package org.dimdev.dimdoors.shared.items;
|
||||
|
||||
import org.dimdev.dimdoors.DimDoors;
|
||||
import org.dimdev.dimdoors.shared.RayTraceHelper;
|
||||
import org.dimdev.dimdoors.shared.tileentities.TileEntityFloatingRift;
|
||||
|
||||
import java.util.HashSet;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemTool;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
import org.dimdev.dimdoors.DimDoors;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Robijnvogel
|
||||
*/
|
||||
public class ItemRiftConnectionTool extends ItemTool {
|
||||
public class ItemRiftConnectionTool extends Item {
|
||||
|
||||
public static final String ID = "rift_connection_tool";
|
||||
|
||||
ItemRiftConnectionTool() {
|
||||
super(1.0F, -2.8F, ToolMaterial.WOOD, new HashSet<>());
|
||||
//@todo add extra stuff?
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(16);
|
||||
setCreativeTab(DimDoors.DIM_DOORS_CREATIVE_TAB);
|
||||
setUnlocalizedName(ID);
|
||||
|
@ -35,69 +24,8 @@ public class ItemRiftConnectionTool extends ItemTool {
|
|||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) {
|
||||
// TODO: reimplement this using the new registry system (open a GUI that allows configuring the rift)
|
||||
ItemStack stack = playerIn.getHeldItem(handIn);
|
||||
|
||||
if (worldIn.isRemote) {
|
||||
return new ActionResult<>(EnumActionResult.FAIL, stack);
|
||||
}
|
||||
if (!stack.hasTagCompound()) {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
compound.setBoolean("isInConnectMode", true);
|
||||
stack.setTagCompound(compound);
|
||||
}
|
||||
|
||||
RayTraceResult hit = rayTrace(worldIn, playerIn, true);
|
||||
if (RayTraceHelper.isAbstractRift(hit, worldIn)) {
|
||||
TileEntityFloatingRift rift = (TileEntityFloatingRift) worldIn.getTileEntity(hit.getBlockPos());
|
||||
if (playerIn.isSneaking()) {
|
||||
return selectRift(stack, worldIn, rift, playerIn); //new ActionResult(EnumActionResult.PASS, stack));
|
||||
}
|
||||
} else {
|
||||
return changeMode(stack, playerIn);
|
||||
}
|
||||
|
||||
return new ActionResult<>(EnumActionResult.FAIL, stack);
|
||||
}
|
||||
|
||||
private ActionResult<ItemStack> selectRift(ItemStack stack, World worldIn, TileEntityFloatingRift rift, EntityPlayer playerIn) {
|
||||
NBTTagCompound compound = stack.getTagCompound();
|
||||
if (compound.getBoolean("isInConnectMode")) {
|
||||
if (compound.hasKey("RiftID")) {
|
||||
int primaryRiftID = compound.getInteger("RiftID");
|
||||
//int secondaryRiftID = rift.getRiftID(); TODO rift
|
||||
//DimDoors.chat(playerIn, "Pairing rift " + primaryRiftID
|
||||
// + " with rift " + secondaryRiftID + ".");
|
||||
//RiftRegistry.INSTANCE.pair(primaryRiftID, secondaryRiftID); TODO rift
|
||||
compound.removeTag("RiftID");
|
||||
stack.damageItem(1, playerIn);
|
||||
} else {
|
||||
//int riftID = rift.getRiftID();
|
||||
//compound.setInteger("RiftID", riftID);
|
||||
//DimDoors.chat(playerIn, "Rift " + riftID + " stored for connecting.");
|
||||
}
|
||||
} else {
|
||||
if (!worldIn.isRemote) {
|
||||
//int riftID = rift.getRiftID();
|
||||
//RiftRegistry.INSTANCE.unpair(riftID);
|
||||
//DimDoors.chat(playerIn, "Rift " + riftID + " and its paired rift are now disconnected.");
|
||||
}
|
||||
stack.damageItem(1, playerIn);
|
||||
}
|
||||
return new ActionResult<>(EnumActionResult.SUCCESS, stack);
|
||||
}
|
||||
|
||||
private ActionResult<ItemStack> changeMode(ItemStack stack, EntityPlayer player) {
|
||||
NBTTagCompound compound = stack.getTagCompound();
|
||||
if (compound.getBoolean("isInConnectMode")) {
|
||||
compound.setBoolean("isInConnectMode", false);
|
||||
if (compound.hasKey("RiftID")) {
|
||||
compound.removeTag("RiftID");
|
||||
}
|
||||
} else {
|
||||
compound.setBoolean("isInConnectMode", true);
|
||||
}
|
||||
DimDoors.chat(player, "Connection tool mode set to: "
|
||||
+ (compound.getBoolean("isInConnectMode") ? "Connect" : "Disconnect"));
|
||||
return new ActionResult<>(EnumActionResult.SUCCESS, stack);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public class ItemRiftRemover extends Item {
|
|||
}
|
||||
|
||||
RayTraceResult hit = rayTrace(world, playerIn, true);
|
||||
if (RayTraceHelper.isRift(hit, world)) {
|
||||
if (RayTraceHelper.isFloatingRift(hit, world)) {
|
||||
TileEntityFloatingRift rift = (TileEntityFloatingRift) world.getTileEntity(hit.getBlockPos());
|
||||
world.setBlockState(rift.getPos(), Blocks.AIR.getDefaultState());
|
||||
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
package org.dimdev.dimdoors.shared.items;
|
||||
|
||||
import lombok.*;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
@ -15,15 +13,12 @@ import org.dimdev.ddutils.nbt.INBTStorable;
|
|||
import org.dimdev.ddutils.nbt.NBTUtils;
|
||||
import org.dimdev.ddutils.nbt.SavedToNBT;
|
||||
import org.dimdev.dimdoors.DimDoors;
|
||||
import org.dimdev.ddutils.I18nUtils;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import org.dimdev.dimdoors.shared.blocks.IRiftProvider;
|
||||
import org.dimdev.dimdoors.shared.blocks.ModBlocks;
|
||||
import org.dimdev.dimdoors.shared.rifts.GlobalDestination;
|
||||
import org.dimdev.dimdoors.shared.rifts.RiftDestination;
|
||||
import org.dimdev.dimdoors.shared.rifts.TileEntityRift;
|
||||
import org.dimdev.dimdoors.shared.sound.ModSounds;
|
||||
|
||||
|
|
|
@ -31,10 +31,10 @@ public final class ModItems {
|
|||
public static final ItemRiftSignature RIFT_SIGNATURE = new ItemRiftSignature();
|
||||
|
||||
// Armors
|
||||
public static ItemWovenWorldThreadArmor HELMET_WOVEN_WORLD_THREAD = new ItemWovenWorldThreadArmor("helmet_woven_world_thread", 1, EntityEquipmentSlot.HEAD);
|
||||
public static ItemWovenWorldThreadArmor CHESTPLATE_WOVEN_WORLD_THREAD = new ItemWovenWorldThreadArmor("chestplate_woven_world_thread", 1, EntityEquipmentSlot.CHEST);
|
||||
public static ItemWovenWorldThreadArmor LEGGINGS_WOVEN_WORLD_THREAD = new ItemWovenWorldThreadArmor("leggings_woven_world_thread", 2, EntityEquipmentSlot.LEGS);
|
||||
public static ItemWovenWorldThreadArmor BOOTS_WOVEN_WORLD_THREAD = new ItemWovenWorldThreadArmor("boots_woven_world_thread", 1, EntityEquipmentSlot.FEET);
|
||||
public static final ItemWovenWorldThreadArmor HELMET_WOVEN_WORLD_THREAD = new ItemWovenWorldThreadArmor("helmet_woven_world_thread", 1, EntityEquipmentSlot.HEAD);
|
||||
public static final ItemWovenWorldThreadArmor CHESTPLATE_WOVEN_WORLD_THREAD = new ItemWovenWorldThreadArmor("chestplate_woven_world_thread", 1, EntityEquipmentSlot.CHEST);
|
||||
public static final ItemWovenWorldThreadArmor LEGGINGS_WOVEN_WORLD_THREAD = new ItemWovenWorldThreadArmor("leggings_woven_world_thread", 2, EntityEquipmentSlot.LEGS);
|
||||
public static final ItemWovenWorldThreadArmor BOOTS_WOVEN_WORLD_THREAD = new ItemWovenWorldThreadArmor("boots_woven_world_thread", 1, EntityEquipmentSlot.FEET);
|
||||
|
||||
// ItemBlocks
|
||||
public static final ItemFabric FABRIC = new ItemFabric();
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
package org.dimdev.dimdoors.shared.pockets;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author s101426
|
||||
*/
|
||||
public enum EnumPocketType {
|
||||
|
||||
PRIVATE, PUBLIC, DUNGEON;
|
||||
|
||||
public static EnumPocketType getFromInt(int integer) {
|
||||
switch (integer) {
|
||||
case 0:
|
||||
return EnumPocketType.PRIVATE;
|
||||
case 1:
|
||||
return EnumPocketType.PUBLIC;
|
||||
case 2:
|
||||
default:
|
||||
return EnumPocketType.DUNGEON;
|
||||
}
|
||||
}
|
||||
|
||||
public int getIntValue() {
|
||||
switch (this) {
|
||||
case PRIVATE:
|
||||
return 0;
|
||||
case PUBLIC:
|
||||
return 1;
|
||||
case DUNGEON:
|
||||
default:
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -27,13 +27,13 @@ import net.minecraft.util.math.BlockPos;
|
|||
@SavedToNBT @Getter @Setter /*package-private*/ Location entrance;
|
||||
@SavedToNBT @Getter /*package-private*/ List<Location> riftLocations;
|
||||
|
||||
@Getter int dimID; // Not saved
|
||||
@Getter int dim; // Not saved
|
||||
|
||||
public Pocket() {}
|
||||
|
||||
public Pocket(int id, int dimID, int x, int z) {
|
||||
public Pocket(int id, int dim, int x, int z) {
|
||||
this.id = id;
|
||||
this.dimID = dimID;
|
||||
this.dim = dim;
|
||||
this.x = x;
|
||||
this.z = z;
|
||||
riftLocations = new ArrayList<>();
|
||||
|
@ -45,12 +45,12 @@ import net.minecraft.util.math.BlockPos;
|
|||
|
||||
boolean isInBounds(BlockPos pos) {
|
||||
// pocket bounds
|
||||
int gridSize = PocketRegistry.getForDim(dimID).getGridSize();
|
||||
int pocMinX = x * gridSize;
|
||||
int pocMinZ = z * gridSize;
|
||||
int pocMaxX = pocMinX + (size + 1) * 16;
|
||||
int pocMaxZ = pocMinX + (size + 1) * 16;
|
||||
return pocMinX <= pos.getX() && pocMinZ <= pos.getZ() && pos.getX() < pocMaxX && pos.getZ() < pocMaxZ;
|
||||
int gridSize = PocketRegistry.getForDim(dim).getGridSize();
|
||||
int minX = x * gridSize;
|
||||
int minZ = z * gridSize;
|
||||
int maxX = minX + (size + 1) * 16;
|
||||
int maxZ = minX + (size + 1) * 16;
|
||||
return minX <= pos.getX() && minZ <= pos.getZ() && pos.getX() < maxX && pos.getZ() < maxZ;
|
||||
}
|
||||
|
||||
public List<TileEntityRift> getRifts() {
|
||||
|
@ -95,7 +95,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
destIterator.remove();
|
||||
if (index == selectedEntranceIndex) {
|
||||
entrance = new Location(rift.getWorld(), rift.getPos());
|
||||
PocketRegistry.getForDim(dimID).markDirty();
|
||||
PocketRegistry.getForDim(dim).markDirty();
|
||||
List<WeightedRiftDestination> ifDestinations = ((PocketEntranceDestination) dest).getIfDestinations();
|
||||
for (WeightedRiftDestination ifDestination : ifDestinations) {
|
||||
destIterator.add(new WeightedRiftDestination(ifDestination.getDestination(), ifDestination.getWeight() / wdest.getWeight(), ifDestination.getGroup()));
|
||||
|
@ -148,7 +148,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
}
|
||||
|
||||
public BlockPos getOrigin() {
|
||||
int gridSize = PocketRegistry.getForDim(dimID).getGridSize();
|
||||
int gridSize = PocketRegistry.getForDim(dim).getGridSize();
|
||||
return new BlockPos(x * gridSize, 0, z * gridSize); // TODO: configurable yBase?
|
||||
}
|
||||
|
||||
|
|
|
@ -2,16 +2,16 @@ package org.dimdev.dimdoors.shared.pockets;
|
|||
|
||||
import org.dimdev.dimdoors.DimDoors;
|
||||
import org.dimdev.dimdoors.shared.*;
|
||||
import org.dimdev.dimdoors.shared.world.DimDoorDimensions;
|
||||
import org.dimdev.dimdoors.shared.world.ModDimensions;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class PocketGenerator {
|
||||
|
||||
public static Pocket generatePocketFromTemplate(int dimID, PocketTemplate pocketTemplate, VirtualLocation virtualLocation) {
|
||||
public static Pocket generatePocketFromTemplate(int dim, PocketTemplate pocketTemplate, VirtualLocation virtualLocation) {
|
||||
DimDoors.log.info("Generating pocket from template " + pocketTemplate.getName() + " at virtual location " + virtualLocation);
|
||||
|
||||
PocketRegistry registry = PocketRegistry.getForDim(dimID);
|
||||
PocketRegistry registry = PocketRegistry.getForDim(dim);
|
||||
Pocket pocket = registry.newPocket();
|
||||
pocketTemplate.place(pocket, 0); // TODO: config option for yBase
|
||||
pocket.setVirtualLocation(virtualLocation);
|
||||
|
@ -20,12 +20,12 @@ public class PocketGenerator {
|
|||
|
||||
public static Pocket generatePrivatePocket(VirtualLocation virtualLocation) {
|
||||
PocketTemplate pocketTemplate = SchematicHandler.INSTANCE.getPersonalPocketTemplate();
|
||||
return generatePocketFromTemplate(DimDoorDimensions.getPrivateDimID(), pocketTemplate, virtualLocation);
|
||||
return generatePocketFromTemplate(ModDimensions.getPrivateDim(), pocketTemplate, virtualLocation);
|
||||
}
|
||||
|
||||
public static Pocket generatePublicPocket(VirtualLocation virtualLocation) {
|
||||
PocketTemplate pocketTemplate = SchematicHandler.INSTANCE.getPublicPocketTemplate();
|
||||
return generatePocketFromTemplate(DimDoorDimensions.getPublicDimID(), pocketTemplate, virtualLocation);
|
||||
return generatePocketFromTemplate(ModDimensions.getPublicDim(), pocketTemplate, virtualLocation);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -41,6 +41,6 @@ public class PocketGenerator {
|
|||
String group = random.nextFloat() < netherProbability ? "nether" : "ruins";
|
||||
PocketTemplate pocketTemplate = SchematicHandler.INSTANCE.getRandomTemplate(group, depth, DDConfig.getMaxPocketSize(), false);
|
||||
|
||||
return generatePocketFromTemplate(DimDoorDimensions.getDungeonDimID(), pocketTemplate, virtualLocation);
|
||||
return generatePocketFromTemplate(ModDimensions.getDungeonDim(), pocketTemplate, virtualLocation);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,16 +8,14 @@ import org.dimdev.ddutils.math.GridUtils;
|
|||
import org.dimdev.dimdoors.DimDoors;
|
||||
import org.dimdev.ddutils.nbt.NBTUtils;
|
||||
import org.dimdev.ddutils.WorldUtils;
|
||||
import org.dimdev.dimdoors.shared.world.DimDoorDimensions;
|
||||
import org.dimdev.dimdoors.shared.world.ModDimensions;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.storage.MapStorage;
|
||||
import net.minecraft.world.storage.WorldSavedData;
|
||||
|
@ -35,7 +33,7 @@ import net.minecraft.world.storage.WorldSavedData;
|
|||
@SavedToNBT @Getter /*package-private*/ Map<Integer, Pocket> pockets; // TODO: remove getter?
|
||||
@SavedToNBT @Getter /*package-private*/ int nextID;
|
||||
|
||||
@Getter private int dimID;
|
||||
@Getter private int dim;
|
||||
|
||||
public PocketRegistry() {
|
||||
super(DATA_NAME);
|
||||
|
@ -45,10 +43,10 @@ import net.minecraft.world.storage.WorldSavedData;
|
|||
super(s);
|
||||
}
|
||||
|
||||
public static PocketRegistry getForDim(int dimID) {
|
||||
if (!DimDoorDimensions.isPocketDimension(dimID)) throw new UnsupportedOperationException("PocketRegistry is only available for pocket dimensions!");
|
||||
public static PocketRegistry getForDim(int dim) {
|
||||
if (!ModDimensions.isDimDoorsPocketDimension(dim)) throw new UnsupportedOperationException("PocketRegistry is only available for pocket dimensions!");
|
||||
|
||||
MapStorage storage = WorldUtils.getWorld(dimID).getPerWorldStorage();
|
||||
MapStorage storage = WorldUtils.getWorld(dim).getPerWorldStorage();
|
||||
PocketRegistry instance = (PocketRegistry) storage.getOrLoadData(PocketRegistry.class, DATA_NAME);
|
||||
|
||||
if (instance == null) {
|
||||
|
@ -57,7 +55,11 @@ import net.minecraft.world.storage.WorldSavedData;
|
|||
storage.setData(DATA_NAME, instance);
|
||||
}
|
||||
|
||||
instance.dimID = dimID;
|
||||
instance.dim = dim;
|
||||
for (Pocket pocket : instance.pockets.values()) {
|
||||
pocket.dim = dim;
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
@ -128,7 +130,7 @@ import net.minecraft.world.storage.WorldSavedData;
|
|||
public Pocket newPocket(int id) {
|
||||
if (pockets.get(id) != null) return null;
|
||||
GridUtils.GridPos pos = idToGridPos(id);
|
||||
Pocket pocket = new Pocket(id, dimID, pos.getX(), pos.getZ());
|
||||
Pocket pocket = new Pocket(id, dim, pos.getX(), pos.getZ());
|
||||
pockets.put(id, pocket);
|
||||
if (id >= nextID) nextID = id + 1;
|
||||
markDirty();
|
||||
|
@ -202,8 +204,7 @@ import net.minecraft.world.storage.WorldSavedData;
|
|||
}
|
||||
|
||||
public boolean isPlayerAllowedToBeHere(EntityPlayerMP player, BlockPos pos) {
|
||||
return true; // TODO: fix this
|
||||
//Pocket pocket = getPocketAt(pos);
|
||||
//return pocket != null && pocket.isInBounds(pos);
|
||||
Pocket pocket = getPocketAt(pos);
|
||||
return pocket != null && pocket.isInBounds(pos);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,13 +40,13 @@ public class PocketTemplate {
|
|||
|
||||
public void place(Pocket pocket, int yBase) {
|
||||
pocket.setSize(size);
|
||||
int gridSize = PocketRegistry.getForDim(pocket.dimID).getGridSize();
|
||||
int dimID = pocket.dimID;
|
||||
int gridSize = PocketRegistry.getForDim(pocket.dim).getGridSize();
|
||||
int dim = pocket.dim;
|
||||
int xBase = pocket.getX() * gridSize * 16;
|
||||
int zBase = pocket.getZ() * gridSize * 16;
|
||||
DimDoors.log.info("Placing new pocket using schematic " + schematic.schematicName + " at x = " + xBase + ", z = " + zBase);
|
||||
|
||||
WorldServer world = DimDoors.proxy.getWorldServer(dimID);
|
||||
WorldServer world = DimDoors.proxy.getWorldServer(dim);
|
||||
Schematic.place(schematic, world, xBase, yBase, zBase);
|
||||
|
||||
// Set pocket riftLocations
|
||||
|
|
|
@ -9,9 +9,7 @@ import lombok.Getter;
|
|||
import lombok.ToString;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
@ -29,7 +27,7 @@ import java.util.List;
|
|||
|
||||
@Override
|
||||
public boolean teleport(TileEntityRift rift, Entity entity) {
|
||||
if (entity instanceof EntityPlayer) DimDoors.chat((EntityPlayer) entity, "The entrances of this dungeon has not been linked. Either this is a bug or you are in dungeon-building mode.");
|
||||
if (entity instanceof EntityPlayer) DimDoors.chat(entity, "The entrances of this dungeon has not been linked. Either this is a bug or you are in dungeon-building mode.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ public class PocketExitDestination extends RiftDestination {
|
|||
|
||||
@Override
|
||||
public boolean teleport(TileEntityRift rift, Entity entity) {
|
||||
if (entity instanceof EntityPlayer) DimDoors.chat((EntityPlayer) entity, "The exit of this dungeon has not been linked. Either this is a bug or you are in dungeon-building mode.");
|
||||
if (entity instanceof EntityPlayer) DimDoors.chat(entity, "The exit of this dungeon has not been linked. Either this is a bug or you are in dungeon-building mode.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import org.dimdev.dimdoors.DimDoors;
|
|||
import org.dimdev.dimdoors.shared.pockets.Pocket;
|
||||
import org.dimdev.dimdoors.shared.pockets.PocketGenerator;
|
||||
import org.dimdev.dimdoors.shared.pockets.PocketRegistry;
|
||||
import org.dimdev.dimdoors.shared.world.DimDoorDimensions;
|
||||
import org.dimdev.dimdoors.shared.world.ModDimensions;
|
||||
import org.dimdev.ddutils.EntityUtils;
|
||||
import org.dimdev.ddutils.Location;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
@ -33,8 +33,8 @@ public class PrivateDestination extends RiftDestination {
|
|||
public boolean teleport(TileEntityRift rift, Entity entity) {
|
||||
String uuid = EntityUtils.getEntityOwnerUUID(entity);
|
||||
if (uuid != null) {
|
||||
PocketRegistry privatePocketRegistry = PocketRegistry.getForDim(DimDoorDimensions.getPrivateDimID());
|
||||
RiftRegistry privateRiftRegistry = RiftRegistry.getForDim(DimDoorDimensions.getPrivateDimID());
|
||||
PocketRegistry privatePocketRegistry = PocketRegistry.getForDim(ModDimensions.getPrivateDim());
|
||||
RiftRegistry privateRiftRegistry = RiftRegistry.getForDim(ModDimensions.getPrivateDim());
|
||||
Pocket pocket = privatePocketRegistry.getPocket(privatePocketRegistry.getPrivatePocketID(uuid));
|
||||
if (pocket == null) { // generate the private pocket and get its entrances
|
||||
pocket = PocketGenerator.generatePrivatePocket(rift.virtualLocation != null ? rift.virtualLocation.toBuilder().depth(-1).build() : null); // set to where the pocket was first created
|
||||
|
|
|
@ -3,7 +3,7 @@ package org.dimdev.dimdoors.shared.rifts;
|
|||
import org.dimdev.dimdoors.DimDoors;
|
||||
import org.dimdev.dimdoors.shared.pockets.Pocket;
|
||||
import org.dimdev.dimdoors.shared.pockets.PocketRegistry;
|
||||
import org.dimdev.dimdoors.shared.world.DimDoorDimensions;
|
||||
import org.dimdev.dimdoors.shared.world.ModDimensions;
|
||||
import org.dimdev.dimdoors.shared.world.limbodimension.WorldProviderLimbo;
|
||||
import org.dimdev.dimdoors.shared.world.pocketdimension.WorldProviderPersonalPocket;
|
||||
import org.dimdev.ddutils.EntityUtils;
|
||||
|
@ -14,7 +14,6 @@ import lombok.Builder;
|
|||
import lombok.Getter;
|
||||
import lombok.ToString;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
@Getter @AllArgsConstructor @Builder(toBuilder = true) @ToString
|
||||
|
@ -37,8 +36,8 @@ public class PrivatePocketExitDestination extends RiftDestination { // TODO: mer
|
|||
Location destLoc;
|
||||
String uuid = EntityUtils.getEntityOwnerUUID(entity);
|
||||
if (uuid != null) {
|
||||
PocketRegistry privatePocketRegistry = PocketRegistry.getForDim(DimDoorDimensions.getPrivateDimID());
|
||||
RiftRegistry privateRiftRegistry = RiftRegistry.getForDim(DimDoorDimensions.getPrivateDimID());
|
||||
PocketRegistry privatePocketRegistry = PocketRegistry.getForDim(ModDimensions.getPrivateDim());
|
||||
RiftRegistry privateRiftRegistry = RiftRegistry.getForDim(ModDimensions.getPrivateDim());
|
||||
destLoc = privateRiftRegistry.getPrivatePocketExit(uuid);
|
||||
if (rift.getWorld().provider instanceof WorldProviderPersonalPocket && privatePocketRegistry.getPrivatePocketID(uuid) == privatePocketRegistry.posToID(rift.getPos())) {
|
||||
privateRiftRegistry.setPrivatePocketEntrance(uuid, rift.getLocation()); // Remember which exit was used for next time the pocket is entered
|
||||
|
@ -66,7 +65,7 @@ public class PrivatePocketExitDestination extends RiftDestination { // TODO: mer
|
|||
Pocket pocket = privatePocketRegistry.getPocketAt(rift.getPos());
|
||||
String uuid = privatePocketRegistry.getPrivatePocketOwner(pocket.getId());
|
||||
if (uuid != null) {
|
||||
RiftRegistry.getForDim(DimDoorDimensions.getPrivateDimID()).addPrivatePocketEntrance(uuid, rift.getLocation());
|
||||
RiftRegistry.getForDim(ModDimensions.getPrivateDim()).addPrivatePocketEntrance(uuid, rift.getLocation());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ import org.dimdev.ddutils.nbt.INBTStorable;
|
|||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import lombok.*; // Don't change import order! (Gradle bug): https://stackoverflow.com/questions/26557133/
|
||||
import org.dimdev.ddutils.nbt.SavedToNBT;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.google.common.collect.ConcurrentHashMultiset;
|
|||
import com.google.common.collect.Multiset;
|
||||
import org.dimdev.ddutils.nbt.NBTUtils;
|
||||
import org.dimdev.ddutils.nbt.SavedToNBT;
|
||||
import org.dimdev.dimdoors.shared.world.DimDoorDimensions;
|
||||
import org.dimdev.dimdoors.shared.world.ModDimensions;
|
||||
import org.dimdev.ddutils.nbt.INBTStorable; // Don't change imports order! (Gradle bug): https://stackoverflow.com/questions/26557133/
|
||||
import org.dimdev.ddutils.Location;
|
||||
import org.dimdev.ddutils.WorldUtils;
|
||||
|
@ -71,8 +71,8 @@ import java.util.*;
|
|||
super(s);
|
||||
}
|
||||
|
||||
public static RiftRegistry getForDim(int dimID) {
|
||||
MapStorage storage = WorldUtils.getWorld(dimID).getPerWorldStorage();
|
||||
public static RiftRegistry getForDim(int dim) {
|
||||
MapStorage storage = WorldUtils.getWorld(dim).getPerWorldStorage();
|
||||
RiftRegistry instance = (RiftRegistry) storage.getOrLoadData(RiftRegistry.class, DATA_NAME);
|
||||
|
||||
if (instance == null) {
|
||||
|
@ -81,8 +81,8 @@ import java.util.*;
|
|||
storage.setData(DATA_NAME, instance);
|
||||
}
|
||||
|
||||
instance.world = WorldUtils.getWorld(dimID);
|
||||
instance.dim = dimID;
|
||||
instance.world = WorldUtils.getWorld(dim);
|
||||
instance.dim = dim;
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ import java.util.*;
|
|||
//TileEntityRift riftEntity = (TileEntityRift) destinationRegistry.world.getTileEntity(destination.getPos());
|
||||
//riftEntity.allSourcesGone(); // TODO
|
||||
}
|
||||
getForDim(DimDoorDimensions.getPrivateDimID()).privatePocketEntrances.entrySet().removeIf(e -> e.getValue().equals(rift));
|
||||
getForDim(ModDimensions.getPrivateDim()).privatePocketEntrances.entrySet().removeIf(e -> e.getValue().equals(rift));
|
||||
getForDim(0).overworldRifts.entrySet().removeIf(e -> e.getValue().equals(rift));
|
||||
registry.markDirty();
|
||||
}
|
||||
|
|
|
@ -11,14 +11,12 @@ import org.dimdev.ddutils.Location;
|
|||
import org.dimdev.ddutils.math.MathUtils;
|
||||
import org.dimdev.ddutils.TeleportUtils;
|
||||
import org.dimdev.ddutils.WorldUtils;
|
||||
import org.dimdev.dimdoors.shared.world.DimDoorDimensions;
|
||||
import org.dimdev.dimdoors.shared.world.ModDimensions;
|
||||
import lombok.Getter;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -193,7 +191,7 @@ import java.util.*;
|
|||
public void unregister() {
|
||||
if (!isRegistered()) return;
|
||||
RiftRegistry.removeRift(new Location(world, pos)); // TODO: unregister destinations
|
||||
if (DimDoorDimensions.isPocketDimension(WorldUtils.getDim(world))) {
|
||||
if (ModDimensions.isDimDoorsPocketDimension(world)) {
|
||||
PocketRegistry pocketRegistry = PocketRegistry.getForDim(WorldUtils.getDim(world));
|
||||
Pocket pocket = pocketRegistry.getPocketAt(pos);
|
||||
if (pocket != null && pocket.getEntrance() != null && pocket.getEntrance().getPos().equals(pos)) {
|
||||
|
@ -259,8 +257,9 @@ import java.util.*;
|
|||
try {
|
||||
if (weightedDestination.getDestination().teleport(this, entity)) {
|
||||
// Set last used rift if necessary
|
||||
// TODO: What about player-owned entities? We should store their exit rift separately to avoid having problems if they enter different rifts
|
||||
// TODO: use entity UUID rather than player UUID!
|
||||
if (entity instanceof EntityPlayer && !DimDoorDimensions.isPocketDimension(WorldUtils.getDim(world))) { // TODO: What about player-owned entities? We should store their exit rift separately to avoid having problems if they enter different rifts
|
||||
if (entity instanceof EntityPlayer && !ModDimensions.isDimDoorsPocketDimension(WorldUtils.getDim(world))) {
|
||||
RiftRegistry.setOverworldRift(EntityUtils.getEntityOwnerUUID(entity), new Location(world, pos));
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
package org.dimdev.dimdoors.shared.world;
|
||||
|
||||
import org.dimdev.dimdoors.shared.DDConfig;
|
||||
import org.dimdev.dimdoors.shared.pockets.EnumPocketType;
|
||||
import org.dimdev.dimdoors.shared.world.limbodimension.WorldProviderLimbo;
|
||||
import org.dimdev.dimdoors.shared.world.pocketdimension.WorldProviderPersonalPocket;
|
||||
import org.dimdev.dimdoors.shared.world.pocketdimension.WorldProviderPublicPocket;
|
||||
import org.dimdev.dimdoors.shared.world.pocketdimension.WorldProviderDungeonPocket;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.minecraft.world.DimensionType;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
|
||||
public final class DimDoorDimensions {
|
||||
|
||||
public static DimensionType limbo = null;
|
||||
@Getter private static int minPocketDimID;
|
||||
@Getter private static int maxPocketDimID;
|
||||
private static final List<EnumPocketType> pocketTypes = new ArrayList<>();
|
||||
private static final Map<EnumPocketType, DimensionType> pocketDimensionTypes = new HashMap<>();
|
||||
|
||||
@Getter private static int limboDimID;
|
||||
@Getter private static int privateDimID;
|
||||
@Getter private static int publicDimID;
|
||||
@Getter private static int dungeonDimID;
|
||||
|
||||
public static void registerDimensions() { // TODO: new forge registry system?
|
||||
// Lowercase names because all minecraft dimensions are lowercase, _pockets suffix to make it clear what the world is
|
||||
minPocketDimID = DDConfig.getBaseDimID();
|
||||
int dimID = minPocketDimID;
|
||||
limbo = DimensionType.register("limbo", "_limbo", dimID, WorldProviderLimbo.class, false);
|
||||
limboDimID = dimID++;
|
||||
pocketTypes.add(EnumPocketType.PRIVATE);
|
||||
pocketDimensionTypes.put(EnumPocketType.PRIVATE, DimensionType.register("private_pockets", "_private", dimID, WorldProviderPersonalPocket.class, false));
|
||||
privateDimID = dimID++;
|
||||
pocketTypes.add(EnumPocketType.PUBLIC);
|
||||
pocketDimensionTypes.put(EnumPocketType.PUBLIC, DimensionType.register("public_pockets", "_public", dimID, WorldProviderPublicPocket.class, false));
|
||||
publicDimID = dimID++;
|
||||
maxPocketDimID = dimID;
|
||||
pocketTypes.add(EnumPocketType.DUNGEON);
|
||||
pocketDimensionTypes.put(EnumPocketType.DUNGEON, DimensionType.register("dungeon_pockets", "_dungeon", dimID, WorldProviderDungeonPocket.class, false));
|
||||
dungeonDimID = dimID;
|
||||
|
||||
registerDimension(limbo);
|
||||
for (EnumPocketType pocketType : pocketDimensionTypes.keySet()) {
|
||||
registerDimension(pocketDimensionTypes.get(pocketType));
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerDimension(DimensionType dimension) {
|
||||
DimensionManager.registerDimension(dimension.getId(), dimension);
|
||||
}
|
||||
|
||||
public static DimensionType getPocketDimensionType(EnumPocketType pocketType) {
|
||||
return pocketDimensionTypes.get(pocketType);
|
||||
}
|
||||
|
||||
public static boolean isPocketDimension(int id) { // TODO: convert some calls to world.provider instanceof (compatibility with other mods that will use PocketLib), and rename to isDimDoorsPoketDimension
|
||||
return id >= minPocketDimID && id <= maxPocketDimID;
|
||||
}
|
||||
|
||||
public static EnumPocketType getPocketType(int dimID) {
|
||||
int index = dimID - minPocketDimID;
|
||||
return pocketTypes.get(index);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package org.dimdev.dimdoors.shared.world;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.minecraft.world.DimensionType;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import org.dimdev.dimdoors.shared.DDConfig;
|
||||
import org.dimdev.dimdoors.shared.world.limbodimension.WorldProviderLimbo;
|
||||
import org.dimdev.dimdoors.shared.world.pocketdimension.WorldProviderDungeonPocket;
|
||||
import org.dimdev.dimdoors.shared.world.pocketdimension.WorldProviderPersonalPocket;
|
||||
import org.dimdev.dimdoors.shared.world.pocketdimension.WorldProviderPublicPocket;
|
||||
|
||||
public final class ModDimensions {
|
||||
|
||||
// These are ok to register on class load, the DimensionType.register method only adds an enum value to DimensionTypes
|
||||
// Lowercase names because all minecraft dimensions are lowercase, _pockets suffix to make it clear what the world is
|
||||
public static final DimensionType LIMBO = DimensionType.register("limbo", "_limbo", 684, WorldProviderLimbo.class, false);
|
||||
public static final DimensionType PRIVATE = DimensionType.register("private_pockets", "_private", 685, WorldProviderPersonalPocket.class, false);
|
||||
public static final DimensionType PUBLIC = DimensionType.register("public_pockets", "_public", 686, WorldProviderPublicPocket.class, false);
|
||||
public static final DimensionType DUNGEON = DimensionType.register("dungeon_pockets", "_dungeon", 687, WorldProviderDungeonPocket.class, false);
|
||||
|
||||
@Getter private static int limboDim;
|
||||
@Getter private static int privateDim;
|
||||
@Getter private static int publicDim;
|
||||
@Getter private static int dungeonDim;
|
||||
|
||||
public static void registerDimensions() {
|
||||
// TODO: more than 1 dimension/dimension type
|
||||
int dim = DDConfig.getBaseDim();
|
||||
limboDim = dim++;
|
||||
privateDim = dim++;
|
||||
publicDim = dim++;
|
||||
dungeonDim = dim++;
|
||||
DimensionManager.registerDimension(limboDim, LIMBO);
|
||||
DimensionManager.registerDimension(privateDim, PRIVATE);
|
||||
DimensionManager.registerDimension(publicDim, PUBLIC);
|
||||
DimensionManager.registerDimension(dungeonDim, DUNGEON);
|
||||
}
|
||||
|
||||
public static boolean isDimDoorsPocketDimension(int id) {
|
||||
return id == privateDim || id == publicDim || id == dungeonDim;
|
||||
}
|
||||
|
||||
public static boolean isDimDoorsPocketDimension(World world) {
|
||||
return world.provider instanceof WorldProviderPublicPocket
|
||||
|| world.provider instanceof WorldProviderPersonalPocket
|
||||
|| world.provider instanceof WorldProviderDungeonPocket;
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@ package org.dimdev.dimdoors.shared.world.limbodimension;
|
|||
|
||||
import org.dimdev.dimdoors.shared.blocks.BlockFabric;
|
||||
import org.dimdev.dimdoors.shared.blocks.ModBlocks;
|
||||
import org.dimdev.dimdoors.shared.world.DimDoorDimensions;
|
||||
import org.dimdev.dimdoors.shared.world.ModDimensions;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
|
@ -93,7 +93,7 @@ public final class LimboDecay {
|
|||
int x, y, z;
|
||||
int sectionY;
|
||||
int limboHeight;
|
||||
int[] limbo = DimensionManager.getDimensions(DimDoorDimensions.limbo);
|
||||
int[] limbo = DimensionManager.getDimensions(ModDimensions.LIMBO);
|
||||
|
||||
|
||||
for (Integer i : limbo){
|
||||
|
|
|
@ -5,10 +5,9 @@ import org.dimdev.ddutils.render.CloudRenderBlank;
|
|||
import org.dimdev.dimdoors.shared.blocks.BlockFabric;
|
||||
import org.dimdev.dimdoors.shared.blocks.ModBlocks;
|
||||
import org.dimdev.ddutils.Location;
|
||||
import org.dimdev.dimdoors.shared.world.DimDoorDimensions;
|
||||
import org.dimdev.dimdoors.shared.world.ModDimensions;
|
||||
import org.dimdev.dimdoors.shared.world.ModBiomes;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
@ -83,7 +82,7 @@ public class WorldProviderLimbo extends WorldProvider {
|
|||
public static Location getLimboSkySpawn(Entity entity) { // TODO: move this into projectToLimbo
|
||||
int x = (int) entity.posX + MathHelper.clamp(entity.world.rand.nextInt(), -100, 100); // TODO: -properties.LimboEntryRange, properties.LimboEntryRange);
|
||||
int z = (int) entity.posZ + MathHelper.clamp(entity.world.rand.nextInt(), -100, 100); // TODO: -properties.LimboEntryRange, properties.LimboEntryRange);
|
||||
return new Location(DimDoorDimensions.limbo.getId(), x, 700, z);
|
||||
return new Location(ModDimensions.LIMBO.getId(), x, 700, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -95,7 +94,7 @@ public class WorldProviderLimbo extends WorldProvider {
|
|||
|
||||
@Override
|
||||
public DimensionType getDimensionType() {
|
||||
return DimDoorDimensions.limbo;
|
||||
return ModDimensions.LIMBO;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package org.dimdev.dimdoors.shared.world.pocketdimension;
|
||||
|
||||
import net.minecraft.world.DimensionType;
|
||||
import org.dimdev.ddutils.render.CloudRenderBlank;
|
||||
import org.dimdev.dimdoors.shared.pockets.EnumPocketType;
|
||||
import org.dimdev.dimdoors.shared.world.DimDoorDimensions;
|
||||
import org.dimdev.dimdoors.shared.world.ModDimensions;
|
||||
import org.dimdev.dimdoors.shared.world.ModBiomes;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
|
@ -19,14 +19,9 @@ public class WorldProviderDungeonPocket extends WorldProviderPocket {
|
|||
biomeProvider = new BiomeProviderSingle(ModBiomes.DANGEROUS_BLACK_VOID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPocketType getPocketType() {
|
||||
return EnumPocketType.DUNGEON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRespawnDimension(EntityPlayerMP player) {
|
||||
return DimDoorDimensions.limbo.getId();
|
||||
return ModDimensions.LIMBO.getId();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
@ -36,6 +31,10 @@ public class WorldProviderDungeonPocket extends WorldProviderPocket {
|
|||
return Vec3d.ZERO;
|
||||
}
|
||||
|
||||
@Override public DimensionType getDimensionType() {
|
||||
return ModDimensions.DUNGEON;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Vec3d getFogColor(float celestialAngle, float partialTicks) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.dimdev.dimdoors.shared.world.pocketdimension;
|
||||
|
||||
import org.dimdev.dimdoors.shared.pockets.EnumPocketType;
|
||||
import net.minecraft.world.DimensionType;
|
||||
import org.dimdev.dimdoors.shared.world.ModDimensions;
|
||||
import org.dimdev.dimdoors.shared.world.ModBiomes;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
@ -16,11 +17,6 @@ public class WorldProviderPersonalPocket extends WorldProviderPocket {
|
|||
biomeProvider = new BiomeProviderSingle(ModBiomes.WHITE_VOID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPocketType getPocketType() {
|
||||
return EnumPocketType.PRIVATE;
|
||||
}
|
||||
|
||||
// TODO: disable this to allow dark places in public pockets
|
||||
@Override
|
||||
protected void generateLightBrightnessTable() {
|
||||
|
@ -29,6 +25,10 @@ public class WorldProviderPersonalPocket extends WorldProviderPocket {
|
|||
}
|
||||
}
|
||||
|
||||
@Override public DimensionType getDimensionType() {
|
||||
return ModDimensions.PRIVATE;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public Vec3d getSkyColor(Entity cameraEntity, float partialTicks) {
|
||||
|
|
|
@ -2,11 +2,8 @@ package org.dimdev.dimdoors.shared.world.pocketdimension;
|
|||
|
||||
import org.dimdev.dimdoors.DimDoors;
|
||||
import org.dimdev.ddutils.render.CloudRenderBlank;
|
||||
import org.dimdev.dimdoors.shared.pockets.EnumPocketType;
|
||||
import org.dimdev.dimdoors.shared.world.DimDoorDimensions;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.DimensionType;
|
||||
import net.minecraft.world.WorldProvider;
|
||||
import net.minecraft.world.gen.IChunkGenerator;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
@ -28,10 +25,12 @@ public abstract class WorldProviderPocket extends WorldProvider {
|
|||
return new ChunkGeneratorBlank(world, world.getSeed());
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public DimensionType getDimensionType() {
|
||||
return DimDoorDimensions.getPocketDimensionType(getPocketType());
|
||||
return ModDimensions.getPocketDimensionType(getPocketType());
|
||||
}
|
||||
*/
|
||||
|
||||
@Override public float calculateCelestialAngle(long worldTime, float partialTicks) { return 0.0F; }
|
||||
|
||||
|
@ -65,7 +64,4 @@ public abstract class WorldProviderPocket extends WorldProvider {
|
|||
public double getVoidFogYFactor() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public abstract EnumPocketType getPocketType();
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package org.dimdev.dimdoors.shared.world.pocketdimension;
|
||||
|
||||
import net.minecraft.world.DimensionType;
|
||||
import org.dimdev.ddutils.render.CloudRenderBlank;
|
||||
import org.dimdev.dimdoors.shared.pockets.EnumPocketType;
|
||||
import org.dimdev.dimdoors.shared.world.ModDimensions;
|
||||
import org.dimdev.dimdoors.shared.world.ModBiomes;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
|
@ -17,11 +18,6 @@ public class WorldProviderPublicPocket extends WorldProviderPocket {
|
|||
biomeProvider = new BiomeProviderSingle(ModBiomes.BLACK_VOID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPocketType getPocketType() {
|
||||
return EnumPocketType.PUBLIC;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public Vec3d getSkyColor(Entity cameraEntity, float partialTicks) {
|
||||
|
@ -29,6 +25,10 @@ public class WorldProviderPublicPocket extends WorldProviderPocket {
|
|||
return Vec3d.ZERO;
|
||||
}
|
||||
|
||||
@Override public DimensionType getDimensionType() {
|
||||
return ModDimensions.PUBLIC;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Vec3d getFogColor(float celestialAngle, float partialTicks) {
|
||||
|
|
Loading…
Reference in a new issue