Bug fixes and code improvements

This commit is contained in:
Runemoro 2018-01-05 20:33:19 -05:00
parent 5ad37b1992
commit 2b0fde9633
67 changed files with 313 additions and 340 deletions

View file

@ -4,15 +4,18 @@ import net.minecraft.client.resources.I18n;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.List;
public final class I18nUtils {
@SideOnly(Side.CLIENT)
public static void translateAndAdd(String key, List<String> list) {
public static List<String> translateMultiline(String key) {
List<String> list = new ArrayList<>();
int i = 0;
while (I18n.hasKey(key + Integer.toString(i))) {
list.add(I18n.format(key + Integer.toString(i)));
while (I18n.hasKey(key + i)) {
list.add(I18n.format(key + i));
i++;
}
return list;
}
}

View file

@ -1,8 +1,7 @@
package org.dimdev.dimdoors.shared;
package org.dimdev.ddutils;
import lombok.*;
import net.minecraft.nbt.NBTTagCompound;
import org.dimdev.ddutils.Location;
import org.dimdev.ddutils.nbt.INBTStorable;
import org.dimdev.ddutils.nbt.NBTUtils;
import org.dimdev.ddutils.nbt.SavedToNBT;
@ -11,6 +10,7 @@ import org.dimdev.ddutils.nbt.SavedToNBT;
@SavedToNBT public class RotatedLocation implements INBTStorable {
@Getter @SavedToNBT /*private*/ Location location;
@Getter @SavedToNBT /*private*/ float yaw;
@Getter @SavedToNBT /*private*/ float pitch;
@Override public NBTTagCompound writeToNBT(NBTTagCompound nbt) { return NBTUtils.writeToNBT(this, nbt); }
@Override public void readFromNBT(NBTTagCompound nbt) { NBTUtils.readFromNBT(this, nbt); }

View file

@ -5,6 +5,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumBlockRenderType;
@ -59,20 +60,21 @@ public abstract class BlockSpecialAir extends Block { // TODO: make water and pi
@Override
@SuppressWarnings("deprecation")
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) {
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess world, BlockPos pos) {
return null;
}
// Disable raytrace hitting this block unless the hitIfLiquid flag is true
// Disable raytrace hitting this block in survival unless the hitIfLiquid flag is true
@Override
public boolean canCollideCheck(IBlockState state, boolean hitIfLiquid) {
return hitIfLiquid;
//EntityPlayer player = DimDoors.proxy.getLocalPlayer();
return /*player != null && player.isCreative() ||*/ hitIfLiquid; // TODO: re-enable this later
}
// Disable dropping/picking item
@Override
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
return null;
return new ItemStack(Items.AIR);
}
@Override

View file

@ -2,8 +2,8 @@ package org.dimdev.dimdoors;
import org.dimdev.dimdoors.shared.commands.CommandPocket;
import org.dimdev.dimdoors.shared.commands.CommandDimTeleport;
import org.dimdev.dimdoors.shared.DDConfig;
import org.dimdev.dimdoors.shared.DDProxyCommon;
import org.dimdev.dimdoors.shared.Config;
import org.dimdev.dimdoors.shared.CommonProxy;
import org.dimdev.dimdoors.shared.items.ModItems;
import org.dimdev.dimdoors.shared.world.gateways.GatewayGenerator;
import lombok.Getter;
@ -21,7 +21,7 @@ import org.apache.logging.log4j.Logger;
@Mod(modid = DimDoors.MODID, name = "Dimensional Doors",
version = DimDoors.VERSION,
dependencies = "required-after:forge@[14.23.0.2517,)")
dependencies = "required-after:forge@[14.23.0.2517,)") // TODO
public class DimDoors {
public static final String MODID = "dimdoors";
@ -31,9 +31,9 @@ public class DimDoors {
public static DimDoors instance;
public static Logger log; // TODO: make non-static?
@SidedProxy(clientSide = "org.dimdev.dimdoors.client.DDProxyClient",
serverSide = "org.dimdev.dimdoors.server.DDProxyServer")
public static DDProxyCommon proxy;
@SidedProxy(clientSide = "org.dimdev.dimdoors.client.ClientProxy",
serverSide = "org.dimdev.dimdoors.server.ServerProxy")
public static CommonProxy proxy;
public static final CreativeTabs DIM_DOORS_CREATIVE_TAB = new CreativeTabs("dimensional_doors_creative_tab") {
@Override
@ -49,7 +49,7 @@ public class DimDoors {
public void onPreInitialization(FMLPreInitializationEvent event) {
log = event.getModLog();
proxy.onPreInitialization(event);
DDConfig.loadConfig(event);
Config.loadConfig(event);
}
@Mod.EventHandler

View file

@ -1,13 +1,12 @@
package org.dimdev.dimdoors.client;
import org.dimdev.dimdoors.shared.DDProxyCommon;
import org.dimdev.dimdoors.shared.CommonProxy;
import org.dimdev.dimdoors.shared.entities.EntityMonolith;
import org.dimdev.dimdoors.shared.tileentities.TileEntityEntranceRift;
import org.dimdev.dimdoors.shared.tileentities.TileEntityFloatingRift;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.WorldProvider;
import net.minecraft.world.WorldServer;
import net.minecraftforge.client.IRenderHandler;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
@ -17,7 +16,7 @@ import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class DDProxyClient extends DDProxyCommon {
public class ClientProxy extends CommonProxy {
@Override
public void onPreInitialization(FMLPreInitializationEvent event) {
@ -49,11 +48,6 @@ public class DDProxyClient extends DDProxyCommon {
return Minecraft.getMinecraft().player;
}
@Override
public WorldServer getWorldServer(int dim) {
return Minecraft.getMinecraft().getIntegratedServer().getWorld(dim);
}
@Override
public void setCloudRenderer(WorldProvider provider, IRenderHandler renderer) {
provider.setCloudRenderer(renderer);

View file

@ -1,9 +1,9 @@
package org.dimdev.dimdoors.client;
import net.minecraft.client.renderer.GlStateManager;
import org.dimdev.dimdoors.shared.entities.EntityMonolith;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
@ -23,11 +23,11 @@ public class ModelMonolith extends ModelBase {
}
@Override
public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
EntityMonolith monolith = (EntityMonolith) entityIn;
public void render(Entity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
EntityMonolith monolith = (EntityMonolith) entity;
setRotationAngles(0, 0, 0, 0, 0, 0, monolith);
GL11.glScalef(monolith.getRenderSizeModifier(), monolith.getRenderSizeModifier(), monolith.getRenderSizeModifier());
GlStateManager.scale(monolith.getRenderSizeModifier(), monolith.getRenderSizeModifier(), monolith.getRenderSizeModifier());
wholeMonolith.render(scale);
}
}

View file

@ -26,7 +26,7 @@ public class ParticleRiftEffect extends ParticleSimpleAnimated { // TODO: colors
}
@Override
public void renderParticle(BufferBuilder buffer, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
public void renderParticle(BufferBuilder buffer, Entity entity, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
if (particleAge < particleMaxAge / 3 || (particleAge + particleMaxAge) / 3 % 2 == 0) {
float oldRed = particleRed;
float oldGreen = particleGreen;
@ -34,7 +34,7 @@ public class ParticleRiftEffect extends ParticleSimpleAnimated { // TODO: colors
float oldAlpha = particleAlpha;
setRBGColorF(colorMultiplier * particleRed, colorMultiplier * particleGreen, colorMultiplier * particleBlue);
setAlphaF(0.7f);
super.renderParticle(buffer, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
super.renderParticle(buffer, entity, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
setRBGColorF(oldRed, oldGreen, oldBlue);
setAlphaF(oldAlpha);
}

View file

@ -1,5 +1,6 @@
package org.dimdev.dimdoors.client;
import net.minecraft.client.renderer.GlStateManager;
import org.dimdev.dimdoors.DimDoors;
import org.dimdev.dimdoors.shared.entities.EntityMonolith;
import net.minecraft.client.Minecraft;
@ -12,7 +13,6 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import java.util.Arrays;
import java.util.List;
@ -74,11 +74,11 @@ public class RenderMonolith extends RenderLiving<EntityMonolith> {
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);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.pushMatrix();
GlStateManager.disableCull();
GlStateManager.disableLighting();
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
mainModel.swingProgress = getSwingProgress(par1EntityLivingBase, par9);
try {
@ -92,32 +92,32 @@ public class RenderMonolith extends RenderLiving<EntityMonolith> {
applyRotations(par1EntityLivingBase, rotation, interpolatedYaw, par9);
float f6 = 0.0625F;
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GlStateManager.enableRescaleNormal();
GL11.glScalef(-1.0F, -1.0F, 1.0F);
GlStateManager.scale(-1.0F, -1.0F, 1.0F);
preRenderCallback(par1EntityLivingBase, par9);
GL11.glRotatef(par1EntityLivingBase.pitchLevel, 1.0F, 0.0F, 0.0F);
GL11.glTranslatef(0.0F, 24.0F * f6 - 0.0078125F, 0.0F);
GlStateManager.rotate(par1EntityLivingBase.pitchLevel, 1.0F, 0.0F, 0.0F);
GlStateManager.translate(0.0F, 24.0F * f6 - 0.0078125F, 0.0F);
renderModel(par1EntityLivingBase, 0, 0, rotation, interpolatedYaw, pitch, f6);
OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GlStateManager.disableTexture2D();
OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GlStateManager.disableRescaleNormal();
} catch (Exception e) {
DimDoors.log.error(e);
}
OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GlStateManager.enableTexture2D();
OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
GlStateManager.enableCull();
GlStateManager.enableLighting();
GlStateManager.disableBlend();
GlStateManager.popMatrix();
MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Post<>(par1EntityLivingBase, this, 1, x, y, z));
}

View file

@ -19,8 +19,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.util.ResourceLocation;
import static org.lwjgl.opengl.GL11.*;
@SideOnly(Side.CLIENT)
public class TileEntityEntranceRiftRenderer extends TileEntitySpecialRenderer<TileEntityEntranceRift> { // TODO: see TileEntityEndGatewayRenderer
@ -32,7 +30,7 @@ public class TileEntityEntranceRiftRenderer extends TileEntitySpecialRenderer<Ti
// TODO: allow any angle, make static and in a separate class
public void renderDimensionalWall(double x, double y, double z, RGBA[] colors, EnumFacing orientation, double extendUp, double extendDown, double extendLeft, double extendRight, double pushIn) {
GL11.glDisable(GL11.GL_LIGHTING);
GlStateManager.disableLighting();
for (int pass = 0; pass < 16; pass++) {
GlStateManager.pushMatrix();
@ -212,36 +210,36 @@ public class TileEntityEntranceRiftRenderer extends TileEntitySpecialRenderer<Ti
//z = ActiveRenderInfo.getPosition().zCoord;
GlStateManager.rotate(180.0F - 90 * rotation.getHorizontalIndex(), 0.0F, 1.0F, 0.0F);
//GL11.glRotatef((float)(-90 * rotation), 0.0F, 0.0F, 1.0F);
// GlStateManager.rotate((float)(-90 * rotation), 0.0F, 0.0F, 1.0F);
GlStateManager.translate(0.007F, .25F, 0F);
switch (rotation) {
case SOUTH:
GL11.glTranslatef(0.5F, 0F, -0.03F);
GlStateManager.translate(0.5F, 0F, -0.03F);
break;
case WEST:
GL11.glTranslatef(-0.5F, 0, -0.03F);
GlStateManager.translate(-0.5F, 0, -0.03F);
break;
case NORTH:
GL11.glTranslatef(-.5F, 0F, .97F);
GlStateManager.translate(-.5F, 0F, .97F);
break;
case EAST:
GL11.glTranslatef(.5F, 0F, .97F);
GlStateManager.translate(.5F, 0F, .97F);
break;
}
GL11.glDisable(GL_LIGHTING);
GlStateManager.disableLighting();
GL11.glEnable(GL11.GL_BLEND);
GlStateManager.enableBlend();
if (i == 1) {
bindTexture(keyholeLight);
GlStateManager.color(1, 1, 1, .7f);
GlStateManager.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_DST_COLOR);
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_DST_COLOR);
} else {
bindTexture(keyPath);
GlStateManager.blendFunc(GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);
GlStateManager.blendFunc(GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_SRC_ALPHA);
}
GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);

View file

@ -202,7 +202,6 @@ public class TileEntityFloatingRiftRenderer extends TileEntitySpecialRenderer<Ti
private void project(BufferBuilder buffer, Vector4f vector, int u, int v, RGBA color) {
double scalar = 1d/(vector.getW()+1d);
Vector3f center = Vector3f.from(0.5f);
Vector3f vector1 = vector.toVector3().mul(scalar);
buffer.pos(vector1.getX(), vector1.getY(), vector1.getZ()).tex(u,v).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).endVertex();

View file

@ -1,16 +1,14 @@
package org.dimdev.dimdoors.server;
import org.dimdev.dimdoors.shared.DDProxyCommon;
import org.dimdev.dimdoors.shared.CommonProxy;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.WorldProvider;
import net.minecraft.world.WorldServer;
import net.minecraftforge.client.IRenderHandler;
import net.minecraftforge.common.DimensionManager;
/**
* @author Robijnvogel
*/
public class DDProxyServer extends DDProxyCommon {
public class ServerProxy extends CommonProxy {
@Override
public boolean isClient() {
@ -22,11 +20,6 @@ public class DDProxyServer extends DDProxyCommon {
return null;
}
@Override
public WorldServer getWorldServer(int dim) {
return DimensionManager.getWorld(0).getMinecraftServer().getWorld(dim);
}
@Override
public void setCloudRenderer(WorldProvider provider, IRenderHandler renderer) {}

View file

@ -1,5 +1,8 @@
package org.dimdev.dimdoors.shared;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.WorldProvider;
import net.minecraftforge.client.IRenderHandler;
import org.dimdev.dimdoors.DimDoors;
import org.dimdev.dimdoors.shared.blocks.ModBlocks;
import org.dimdev.dimdoors.shared.entities.EntityMonolith;
@ -16,9 +19,8 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.registry.EntityRegistry;
import net.minecraftforge.fml.common.registry.GameRegistry;
public abstract class DDProxyCommon implements IDDProxy {
public abstract class CommonProxy {
@Override
public void onPreInitialization(FMLPreInitializationEvent event) {
MinecraftForge.EVENT_BUS.register(EventHandler.class);
MinecraftForge.EVENT_BUS.register(ModBlocks.class);
@ -49,7 +51,6 @@ public abstract class DDProxyCommon implements IDDProxy {
RiftDestination.destinationRegistry.put("relative", RelativeDestination.class);
}
@Override
public void onInitialization(FMLInitializationEvent event) {
SchematicHandler.INSTANCE.loadSchematics();
}
@ -58,4 +59,12 @@ public abstract class DDProxyCommon implements IDDProxy {
GameRegistry.registerTileEntity(TileEntityEntranceRift.class, "TileEntityEntranceRift");
GameRegistry.registerTileEntity(TileEntityFloatingRift.class, "TileEntityFloatingRift");
}
public abstract boolean isClient();
public abstract EntityPlayer getLocalPlayer();
public abstract void setCloudRenderer(WorldProvider provider, IRenderHandler renderer);
public abstract void setSkyRenderer(WorldProvider provider, IRenderHandler renderer);
}

View file

@ -13,7 +13,7 @@ import scala.actors.threadpool.Arrays;
/**
* @author Robijnvogel
*/
public final class DDConfig {
public final class Config {
public static File configurationFolder;
@Getter private static int pocketGridSize = 32;

View file

@ -1,29 +0,0 @@
package org.dimdev.dimdoors.shared;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.WorldProvider;
import net.minecraft.world.WorldServer;
import net.minecraftforge.client.IRenderHandler;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
/**
*
* @author Robijnvogel
*/
public interface IDDProxy {
public boolean isClient();
public void onPreInitialization(FMLPreInitializationEvent event);
public void onInitialization(FMLInitializationEvent event);
public EntityPlayer getLocalPlayer();
public WorldServer getWorldServer(int dim);
public void setCloudRenderer(WorldProvider provider, IRenderHandler renderer);
public void setSkyRenderer(WorldProvider provider, IRenderHandler renderer);
}

View file

@ -53,12 +53,12 @@ public class SchematicHandler { // TODO: make this more general (not dimdoors-re
}
// Load config jsons
File jsonFolder = new File(DDConfig.configurationFolder, "/jsons");
File jsonFolder = new File(Config.configurationFolder, "/jsons");
if (!jsonFolder.exists()) {
jsonFolder.mkdirs();
}
// Init schematics config folder
File schematicFolder = new File(DDConfig.configurationFolder, "/schematics");
File schematicFolder = new File(Config.configurationFolder, "/schematics");
if (!schematicFolder.exists()) {
schematicFolder.mkdirs();
}
@ -78,7 +78,7 @@ public class SchematicHandler { // TODO: make this more general (not dimdoors-re
private static List<PocketTemplate> loadTemplatesFromJson(String jsonString) {
String schematicJarDirectory = "/assets/dimdoors/pockets/schematic/";
File schematicFolder = new File(DDConfig.configurationFolder, "/schematics");
File schematicFolder = new File(Config.configurationFolder, "/schematics");
JsonParser parser = new JsonParser();
JsonElement jsonElement = parser.parse(jsonString);
@ -285,16 +285,16 @@ public class SchematicHandler { // TODO: make this more general (not dimdoors-re
}
public PocketTemplate getPersonalPocketTemplate() {
return getRandomTemplate("private", -1, DDConfig.getMaxPocketSize(), true); // TODO: config option for getLargest
return getRandomTemplate("private", -1, Config.getMaxPocketSize(), true); // TODO: config option for getLargest
}
public PocketTemplate getPublicPocketTemplate() {
return getRandomTemplate("public", -1, DDConfig.getMaxPocketSize(), true); // TODO: config option for getLargest
return getRandomTemplate("public", -1, Config.getMaxPocketSize(), true); // TODO: config option for getLargest
}
public void saveSchematic(Schematic schematic, String name) {
NBTTagCompound schematicNBT = Schematic.saveToNBT(schematic);
File saveFolder = new File(DDConfig.configurationFolder, "/Schematics/Saved");
File saveFolder = new File(Config.configurationFolder, "/Schematics/Saved");
if (!saveFolder.exists()) {
saveFolder.mkdirs();
}

View file

@ -43,7 +43,7 @@ public class VirtualLocation {
virtualLocation = new VirtualLocation(0, 0, 0, 0, 0); // TODO: door was placed in a pocket dim but outside of a pocket...
}
} else if (location.getWorld().provider instanceof WorldProviderLimbo) {
virtualLocation = new VirtualLocation(location, DDConfig.getMaxDungeonDepth());
virtualLocation = new VirtualLocation(location, Config.getMaxDungeonDepth());
}
if (virtualLocation == null) {
virtualLocation = new VirtualLocation(location, 0);
@ -55,8 +55,8 @@ public class VirtualLocation {
public VirtualLocation transformDepth(int depth) { // TODO: Config option for block ratio between depths (see video of removed features)
Random random = new Random();
int depthDiff = Math.abs(this.depth - depth);
int base = DDConfig.getOwCoordinateOffsetBase();
double power = DDConfig.getOwCoordinateOffsetPower();
int base = Config.getOwCoordinateOffsetBase();
double power = Config.getOwCoordinateOffsetPower();
int xOffset = random.nextInt((int) Math.pow(base * (depthDiff + 1), power)) * (random.nextBoolean() ? 1 : -1);
int zOffset = random.nextInt((int) Math.pow(base * (depthDiff + 1), power)) * (random.nextBoolean() ? 1 : -1);
return new VirtualLocation(getDim(), getPos().offset(EnumFacing.EAST, xOffset).offset(EnumFacing.SOUTH, zOffset), depth);

View file

@ -6,7 +6,6 @@ import net.minecraft.block.state.BlockFaceShape;
import org.dimdev.dimdoors.shared.rifts.RiftRegistry;
import org.dimdev.dimdoors.shared.tileentities.TileEntityEntranceRift;
import org.dimdev.dimdoors.shared.tileentities.TileEntityFloatingRift;
import org.dimdev.dimdoors.shared.rifts.TileEntityRift;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDoor;
import net.minecraft.block.material.Material;
@ -47,19 +46,19 @@ public abstract class BlockDimensionalDoor extends BlockDoor implements IRiftPro
}
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (!canOpen(worldIn, pos, playerIn)) return false;
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (!canOpen(world, pos, player)) return false;
BlockPos blockpos = state.getValue(HALF) == BlockDoor.EnumDoorHalf.LOWER ? pos : pos.down();
IBlockState iblockstate = pos.equals(blockpos) ? state : worldIn.getBlockState(blockpos);
IBlockState iblockstate = pos.equals(blockpos) ? state : world.getBlockState(blockpos);
if (iblockstate.getBlock() != this) {
return false;
} else {
state = iblockstate.cycleProperty(OPEN);
worldIn.setBlockState(blockpos, state, 10);
worldIn.markBlockRangeForRenderUpdate(blockpos, pos);
worldIn.playEvent(playerIn, state.getValue(OPEN) ? getOpenSound() : getCloseSound(), pos, 0);
world.setBlockState(blockpos, state, 10);
world.markBlockRangeForRenderUpdate(blockpos, pos);
world.playEvent(player, state.getValue(OPEN) ? getOpenSound() : getCloseSound(), pos, 0);
return true;
}
}
@ -73,9 +72,9 @@ public abstract class BlockDimensionalDoor extends BlockDoor implements IRiftPro
}
@Override
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) {
if (canOpen(worldIn, pos, null)) {
super.neighborChanged(state, worldIn, pos, blockIn, fromPos);
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block, BlockPos fromPos) {
if (canOpen(world, pos, null)) {
super.neighborChanged(state, world, pos, block, fromPos);
}
}
@ -101,7 +100,7 @@ public abstract class BlockDimensionalDoor extends BlockDoor implements IRiftPro
&& world.getBlockState(pos).getBlock().isReplaceable(world, pos.up());
}
} else {
return super.canPlaceBlockAt(world, pos.down());
return super.canPlaceBlockAt(world, pos);
}
}
@ -111,12 +110,12 @@ public abstract class BlockDimensionalDoor extends BlockDoor implements IRiftPro
}
@Override
public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) { // TODO: use BLOCK_ITEM map
public ItemStack getItem(World world, BlockPos pos, IBlockState state) { // TODO: use BLOCK_ITEM map
return new ItemStack(getItem());
}
@Override
public TileEntityEntranceRift createNewTileEntity(World worldIn, int meta) {
public TileEntityEntranceRift createNewTileEntity(World world, int meta) {
TileEntityEntranceRift rift = new TileEntityEntranceRift();
rift.orientation = getStateFromMeta(meta).getValue(BlockDoor.FACING).getOpposite();
rift.extendUp += 1;
@ -124,14 +123,14 @@ public abstract class BlockDimensionalDoor extends BlockDoor implements IRiftPro
}
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
public void breakBlock(World world, BlockPos pos, IBlockState state) {
if (!hasTileEntity(state)) return;
TileEntityEntranceRift rift = getRift(worldIn, pos, state);
super.breakBlock(worldIn, pos, state);
if (worldIn.isRemote) return;
TileEntityEntranceRift rift = getRift(world, pos, state);
super.breakBlock(world, pos, state);
if (world.isRemote) return;
if (rift.isPlaceRiftOnBreak() || rift.isRegistered() && RiftRegistry.getRiftInfo(rift.getLocation()).getSources().size() > 0 && !rift.isAlwaysDelete()) {
worldIn.setBlockState(pos, ModBlocks.RIFT.getDefaultState());
TileEntityFloatingRift newRift = (TileEntityFloatingRift) worldIn.getTileEntity(pos);
world.setBlockState(pos, ModBlocks.RIFT.getDefaultState());
TileEntityFloatingRift newRift = (TileEntityFloatingRift) world.getTileEntity(pos);
newRift.copyFrom(rift);
newRift.updateAvailableLinks();
} else {

View file

@ -35,19 +35,19 @@ public abstract class BlockDimensionalTrapdoor extends BlockTrapDoor implements
}
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (!canOpen(worldIn, pos, playerIn)) return false;
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (!canOpen(world, pos, player)) return false;
state = state.cycleProperty(OPEN);
worldIn.setBlockState(pos, state, 2);
playSound(playerIn, worldIn, pos, state.getValue(OPEN));
world.setBlockState(pos, state, 2);
playSound(player, world, pos, state.getValue(OPEN));
return true;
}
@Override
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) {
if (canOpen(worldIn, pos, null)) {
super.neighborChanged(state, worldIn, pos, blockIn, fromPos);
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block, BlockPos fromPos) {
if (canOpen(world, pos, null)) {
super.neighborChanged(state, world, pos, block, fromPos);
}
}
@ -56,7 +56,7 @@ public abstract class BlockDimensionalTrapdoor extends BlockTrapDoor implements
}
@Override
public TileEntityEntranceRift createNewTileEntity(World worldIn, int meta) {
public TileEntityEntranceRift createNewTileEntity(World world, int meta) {
TileEntityEntranceRift rift = new TileEntityEntranceRift();
rift.orientation = EnumFacing.UP;
return rift;

View file

@ -33,7 +33,7 @@ public class BlockDoorGold extends BlockDoor {
}
@Override
public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) {
public ItemStack getItem(World world, BlockPos pos, IBlockState state) {
return new ItemStack(ModItems.GOLD_DOOR);
}
}

View file

@ -33,7 +33,7 @@ public class BlockDoorQuartz extends BlockDoor {
}
@Override
public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) {
public ItemStack getItem(World world, BlockPos pos, IBlockState state) {
return new ItemStack(ModItems.QUARTZ_DOOR);
}
}

View file

@ -131,7 +131,7 @@ public class BlockFabric extends Block {
@Override
@SuppressWarnings("deprecation")
public MapColor getMapColor(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
public MapColor getMapColor(IBlockState state, IBlockAccess world, BlockPos pos) {
switch (state.getValue(TYPE)) {
case REALITY:
case ANCIENT:
@ -174,21 +174,21 @@ public class BlockFabric extends Block {
}
@Override
public void onEntityWalk(World world, BlockPos pos, Entity entityIn) {
public void onEntityWalk(World world, BlockPos pos, Entity entity) {
IBlockState state = world.getBlockState(pos);
if (state.getValue(TYPE) == EnumType.ETERNAL && world.provider instanceof WorldProviderLimbo && entityIn instanceof EntityPlayer) {
if (state.getValue(TYPE) == EnumType.ETERNAL && world.provider instanceof WorldProviderLimbo && entity instanceof EntityPlayer) {
Location loc = VirtualLocation.fromLocation(new Location(world, pos)).projectToWorld();
BlockPos correctedPos = loc.getWorld().getTopSolidOrLiquidBlock(loc.getPos());
Random random = new Random();
TeleportUtils.teleport(entityIn, new Location(loc.getDim(), correctedPos), random.nextFloat() * 360, random.nextFloat() * 360);
TeleportUtils.teleport(entity, new Location(loc.getDim(), correctedPos), random.nextFloat() * 360, random.nextFloat() * 360);
}
}
@Override
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) {
// Spread unravelled fabric decay in Limbo
if (state.getValue(TYPE) == EnumType.UNRAVELED && worldIn.provider instanceof WorldProviderLimbo) {
LimboDecay.applySpreadDecay(worldIn, pos);
if (state.getValue(TYPE) == EnumType.UNRAVELED && world.provider instanceof WorldProviderLimbo) {
LimboDecay.applySpreadDecay(world, pos);
}
}
}

View file

@ -37,22 +37,22 @@ public class BlockFloatingRift extends BlockSpecialAir implements ITileEntityPro
}
@Override
public TileEntityFloatingRift createNewTileEntity(World worldIn, int meta) {
public TileEntityFloatingRift createNewTileEntity(World world, int meta) {
return new TileEntityFloatingRift();
}
@Override
@SuppressWarnings("deprecation")
public MapColor getMapColor(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
public MapColor getMapColor(IBlockState state, IBlockAccess world, BlockPos pos) {
return MapColor.BLUE;
}
// Unregister the rift on break
@Override
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
TileEntityFloatingRift rift = (TileEntityFloatingRift) worldIn.getTileEntity(pos);
public void breakBlock(World world, BlockPos pos, IBlockState state) {
TileEntityFloatingRift rift = (TileEntityFloatingRift) world.getTileEntity(pos);
rift.unregister();
super.breakBlock(worldIn, pos, state);
super.breakBlock(world, pos, state);
}
@Override
@ -77,20 +77,20 @@ public class BlockFloatingRift extends BlockSpecialAir implements ITileEntityPro
// Render rift effects
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) { // TODO
//ArrayList<BlockPos> targets = findReachableBlocks(worldIn, pos, 2, false);
TileEntityFloatingRift rift = (TileEntityFloatingRift) worldIn.getTileEntity(pos);
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) { // TODO
//ArrayList<BlockPos> targets = findReachableBlocks(world, pos, 2, false);
TileEntityFloatingRift rift = (TileEntityFloatingRift) world.getTileEntity(pos);
if (0 > 0) {
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new ParticleRiftEffect.GogglesRiftEffect(
worldIn,
world,
pos.getX() + .5, pos.getY() + .5, pos.getZ() + .5,
rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D));
}
if (rift.shouldClose) { // Renders an opposite color effect if it is being closed by the rift remover
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new ParticleRiftEffect.ClosingRiftEffect(
worldIn,
world,
pos.getX() + .5, pos.getY() + .5, pos.getZ() + .5,
rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D));
}

View file

@ -1,7 +1,7 @@
package org.dimdev.dimdoors.shared.entities;
import org.dimdev.dimdoors.shared.sound.ModSounds;
import org.dimdev.dimdoors.shared.DDConfig;
import org.dimdev.dimdoors.shared.Config;
import org.dimdev.ddutils.Location;
import org.dimdev.ddutils.TeleportUtils;
import org.dimdev.dimdoors.shared.world.limbodimension.WorldProviderLimbo;
@ -54,7 +54,7 @@ public class EntityMonolith extends EntityFlying implements IMob {
}
public boolean isDangerous() {
return DDConfig.isMonolithTeleportationEnabled() && (world.provider instanceof WorldProviderLimbo || DDConfig.isDangerousLimboMonolithsEnabled());
return Config.isMonolithTeleportationEnabled() && (world.provider instanceof WorldProviderLimbo || Config.isDangerousLimboMonolithsEnabled());
}
@Override
@ -148,7 +148,7 @@ public class EntityMonolith extends EntityFlying implements IMob {
}
// Teleport the target player if various conditions are met
if (aggro >= MAX_AGGRO && !world.isRemote && DDConfig.isMonolithTeleportationEnabled() && !player.capabilities.isCreativeMode && isDangerous()) {
if (aggro >= MAX_AGGRO && !world.isRemote && Config.isMonolithTeleportationEnabled() && !player.isCreative() && isDangerous()) {
aggro = 0;
Location destination = WorldProviderLimbo.getLimboSkySpawn(player);
TeleportUtils.teleport(player, destination, 0, 0);
@ -214,7 +214,7 @@ public class EntityMonolith extends EntityFlying implements IMob {
playSound(ModSounds.MONK, 1F, 1F);
soundTime = 100;
}
if (aggroPercent > 0.70 && soundTime < 100) {
if (aggroPercent > 0.70 && soundTime < 100) { // TODO: null rather than player?
world.playSound(player, player.getPosition(), ModSounds.TEARING, SoundCategory.HOSTILE, 1F, (float) (1 + rand.nextGaussian()));
soundTime = 100 + rand.nextInt(75);
}
@ -277,7 +277,5 @@ public class EntityMonolith extends EntityFlying implements IMob {
}
return true;
// TODO: this would throw a null pointer exception if enabled (the bounding box is null)
//return world.checkNoEntityCollision(getCollisionBoundingBox()) && world.getCollisionBoxes(this, getEntityBoundingBox()).isEmpty() && !world.containsAnyLiquid(getCollisionBoundingBox());
}
}

View file

@ -25,7 +25,7 @@ public class ItemDimensionalDoorGold extends ItemDoor {
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
I18nUtils.translateAndAdd("info.gold_dimensional_door", tooltip);
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flagIn) {
tooltip.addAll(I18nUtils.translateMultiline("info.gold_dimensional_door"));
}
}

View file

@ -24,7 +24,7 @@ public class ItemDimensionalDoorIron extends ItemDimensionalDoor {
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
I18nUtils.translateAndAdd("info.dimensional_door", tooltip);
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flagIn) {
tooltip.addAll(I18nUtils.translateMultiline("info.dimensional_door"));
}
}

View file

@ -24,7 +24,7 @@ public class ItemDimensionalDoorPersonal extends ItemDimensionalDoor {
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
I18nUtils.translateAndAdd("info.quartz_dimensional_door", tooltip);
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flagIn) {
tooltip.addAll(I18nUtils.translateMultiline("info.quartz_dimensional_door"));
}
}

View file

@ -24,7 +24,7 @@ public class ItemDimensionalDoorUnstable extends ItemDimensionalDoor {
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
I18nUtils.translateAndAdd("info.unstable_dimensional_door", tooltip);
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flagIn) {
tooltip.addAll(I18nUtils.translateMultiline("info.unstable_dimensional_door"));
}
}

View file

@ -24,7 +24,7 @@ public class ItemDimensionalDoorWarp extends ItemDimensionalDoor {
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
I18nUtils.translateAndAdd("info.warp_dimensional_door", tooltip);
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flagIn) {
tooltip.addAll(I18nUtils.translateMultiline("info.warp_dimensional_door"));
}
}

View file

@ -25,7 +25,7 @@ public class ItemDimensionalTrapdoorWood extends ItemDimensionalTrapdoor {
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
I18nUtils.translateAndAdd("info.wood_dimensional_trapdoor", tooltip);
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flag) {
tooltip.addAll(I18nUtils.translateMultiline("info.wood_dimensional_trapdoor"));
}
}

View file

@ -50,24 +50,24 @@ public class ItemRiftBlade extends ItemSword {
}
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) {
ItemStack stack = playerIn.getHeldItem(handIn);
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
ItemStack stack = player.getHeldItem(hand);
if (worldIn.isRemote) {
if (world.isRemote) {
return new ActionResult<>(EnumActionResult.FAIL, stack);
}
//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.isFloatingRift(hit, worldIn)) {
TileEntityFloatingRift rift = (TileEntityFloatingRift) worldIn.getTileEntity(hit.getBlockPos());
rift.teleport(playerIn);
RayTraceResult hit = rayTrace(world, player, true);
if (RayTraceHelper.isFloatingRift(hit, world)) {
TileEntityFloatingRift rift = (TileEntityFloatingRift) world.getTileEntity(hit.getBlockPos());
rift.teleport(player);
stack.damageItem(1, playerIn);
stack.damageItem(1, player);
return new ActionResult<>(EnumActionResult.SUCCESS, stack);
} else if (RayTraceHelper.isLivingEntity(hit)) {
TeleportUtils.teleport(playerIn, new Location(worldIn, hit.getBlockPos()), playerIn.rotationYaw, playerIn.rotationPitch); //@todo teleport to a location 1 or 2 blocks distance from the entity
stack.damageItem(1, playerIn); // TODO: check if successful
TeleportUtils.teleport(player, new Location(world, hit.getBlockPos()), player.rotationYaw, player.rotationPitch); //@todo teleport to a location 1 or 2 blocks distance from the entity
stack.damageItem(1, player); // TODO: check if successful
return new ActionResult<>(EnumActionResult.SUCCESS, stack);
}
@ -75,7 +75,7 @@ public class ItemRiftBlade extends ItemSword {
}
@Override
public void addInformation(ItemStack stack, World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
I18nUtils.translateAndAdd("info.rift_blade", tooltip);
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flagIn) {
tooltip.addAll(I18nUtils.translateMultiline("info.rift_blade"));
}
}

View file

@ -10,11 +10,11 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import org.dimdev.dimdoors.DimDoors;
public class ItemRiftConnectionTool extends Item {
public class ItemRiftConfigurationTool extends Item {
public static final String ID = "rift_connection_tool";
public static final String ID = "rift_configuration_tool";
ItemRiftConnectionTool() {
ItemRiftConfigurationTool() {
setMaxStackSize(1);
setMaxDamage(16);
setCreativeTab(DimDoors.DIM_DOORS_CREATIVE_TAB);
@ -23,9 +23,9 @@ public class ItemRiftConnectionTool extends Item {
}
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) {
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand handIn) {
// TODO: reimplement this using the new registry system (open a GUI that allows configuring the rift)
ItemStack stack = playerIn.getHeldItem(handIn);
ItemStack stack = player.getHeldItem(handIn);
return new ActionResult<>(EnumActionResult.FAIL, stack);
}
}

View file

@ -1,7 +1,9 @@
package org.dimdev.dimdoors.shared.items;
import net.minecraft.util.*;
import org.dimdev.dimdoors.DimDoors;
import org.dimdev.dimdoors.shared.RayTraceHelper;
import org.dimdev.dimdoors.shared.sound.ModSounds;
import org.dimdev.dimdoors.shared.tileentities.TileEntityFloatingRift;
import org.dimdev.ddutils.I18nUtils;
import net.minecraft.client.util.ITooltipFlag;
@ -9,10 +11,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
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;
@ -30,24 +28,26 @@ public class ItemRiftRemover extends Item {
}
@Override
public void addInformation(ItemStack stack, World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
I18nUtils.translateAndAdd("info.rift_remover", tooltip);
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flagIn) {
tooltip.addAll(I18nUtils.translateMultiline("info.rift_remover"));
}
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer playerIn, EnumHand handIn) { // TODO: permissions
ItemStack stack = playerIn.getHeldItem(handIn);
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand handIn) { // TODO: permissions
ItemStack stack = player.getHeldItem(handIn);
if (world.isRemote) {
return new ActionResult<>(EnumActionResult.FAIL, stack);
}
RayTraceResult hit = rayTrace(world, playerIn, true);
RayTraceResult hit = rayTrace(world, player, true);
if (RayTraceHelper.isFloatingRift(hit, world)) {
TileEntityFloatingRift rift = (TileEntityFloatingRift) world.getTileEntity(hit.getBlockPos());
world.setBlockState(rift.getPos(), Blocks.AIR.getDefaultState());
world.playSound(null, player.getPosition(), ModSounds.RIFT_CLOSE, SoundCategory.BLOCKS, 0.6f, 1);
// TODO: render rift removing animation
stack.damageItem(10, playerIn);
stack.damageItem(10, player);
return new ActionResult<>(EnumActionResult.SUCCESS, stack);
}
return new ActionResult<>(EnumActionResult.FAIL, stack);

View file

@ -1,20 +1,21 @@
package org.dimdev.dimdoors.shared.items;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.translation.I18n;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.dimdev.ddutils.I18nUtils;
import org.dimdev.ddutils.Location;
import org.dimdev.dimdoors.DimDoors;
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.RotatedLocation;
import org.dimdev.ddutils.RotatedLocation;
import org.dimdev.dimdoors.shared.blocks.ModBlocks;
import org.dimdev.dimdoors.shared.rifts.GlobalDestination;
import org.dimdev.dimdoors.shared.rifts.TileEntityRift;
@ -22,8 +23,6 @@ import org.dimdev.dimdoors.shared.sound.ModSounds;
import java.util.List;
import static org.dimdev.ddutils.I18nUtils.translateAndAdd;
public class ItemRiftSignature extends Item {
public static final String ID = "rift_signature";
@ -59,7 +58,7 @@ public class ItemRiftSignature extends Item {
if (target != null) {
// Place a rift at the saved point TODO: check that the player still has permission
if (!target.getLocation().getBlockState().equals(ModBlocks.RIFT)) {
if (!target.getLocation().getBlockState().getBlock().equals(ModBlocks.RIFT)) {
if (!target.getLocation().getBlockState().getBlock().equals(Blocks.AIR)) {
return EnumActionResult.FAIL; // TODO: send a message
}
@ -82,12 +81,13 @@ public class ItemRiftSignature extends Item {
clearSource(stack);
DimDoors.chat(player, "Rift Created");
world.playSound(player, player.getPosition(), ModSounds.RIFT_END, SoundCategory.BLOCKS, 0.6f, 1);
// null = send sound to the player too, we have to do this because this code is not run client-side
world.playSound(null, player.getPosition(), ModSounds.RIFT_END, SoundCategory.BLOCKS, 0.6f, 1);
} else {
// The link signature has not been used. Store its current target as the first location.
setSource(stack, new RotatedLocation(new Location(world, pos), player.rotationYaw));
setSource(stack, new RotatedLocation(new Location(world, pos), player.rotationYaw, 0));
DimDoors.chat(player, "Location Stored in Rift Signature");
world.playSound(player, player.getPosition(), ModSounds.RIFT_START, SoundCategory.BLOCKS, 0.6f, 1);
world.playSound(null, player.getPosition(), ModSounds.RIFT_START, SoundCategory.BLOCKS, 0.6f, 1);
}
return EnumActionResult.SUCCESS;
@ -116,12 +116,12 @@ public class ItemRiftSignature extends Item {
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flagIn) {
RotatedLocation transform = getSource(stack);
if (transform != null) {
tooltip.add(I18n.translateToLocalFormatted("info.rift_signature.bound", transform.getLocation().getX(), transform.getLocation().getY(), transform.getLocation().getZ(), transform.getLocation().getDim()));
tooltip.add(I18n.format("info.rift_signature.bound", transform.getLocation().getX(), transform.getLocation().getY(), transform.getLocation().getZ(), transform.getLocation().getDim()));
} else {
translateAndAdd("info.rift_signature.unbound", tooltip);
tooltip.addAll(I18nUtils.translateMultiline("info.rift_signature.unbound"));
}
}
}

View file

@ -12,9 +12,10 @@ import net.minecraft.util.text.translation.I18n;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.dimdev.ddutils.I18nUtils;
import org.dimdev.ddutils.Location;
import org.dimdev.dimdoors.DimDoors;
import org.dimdev.dimdoors.shared.RotatedLocation;
import org.dimdev.ddutils.RotatedLocation;
import org.dimdev.dimdoors.shared.blocks.ModBlocks;
import org.dimdev.dimdoors.shared.rifts.GlobalDestination;
import org.dimdev.dimdoors.shared.rifts.TileEntityRift;
@ -22,8 +23,6 @@ import org.dimdev.dimdoors.shared.sound.ModSounds;
import java.util.List;
import static org.dimdev.ddutils.I18nUtils.translateAndAdd;
public class ItemStabilizedRiftSignature extends Item { // TODO: common superclass with rift signature
public static final String ID = "stabilized_rift_signature";
@ -80,12 +79,12 @@ public class ItemStabilizedRiftSignature extends Item { // TODO: common supercla
stack.damageItem(1, player);
DimDoors.chat(player, "Rift Created");
world.playSound(player, player.getPosition(), ModSounds.RIFT_END, SoundCategory.BLOCKS, 0.6f, 1);
world.playSound(null, player.getPosition(), ModSounds.RIFT_END, SoundCategory.BLOCKS, 0.6f, 1);
} else {
// The link signature has not been used. Store its current target as the first location.
setSource(stack, new RotatedLocation(new Location(world, pos), player.rotationYaw));
setSource(stack, new RotatedLocation(new Location(world, pos), player.rotationYaw, 0));
DimDoors.chat(player, "Location Stored in Rift Signature");
world.playSound(player, player.getPosition(), ModSounds.RIFT_START, SoundCategory.BLOCKS, 0.6f, 1);
world.playSound(null, player.getPosition(), ModSounds.RIFT_START, SoundCategory.BLOCKS, 0.6f, 1);
}
return EnumActionResult.SUCCESS;
@ -114,12 +113,12 @@ public class ItemStabilizedRiftSignature extends Item { // TODO: common supercla
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
public void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag flagIn) {
RotatedLocation transform = getTarget(stack);
if (transform != null) {
tooltip.add(I18n.translateToLocalFormatted("info.stabilized_rift_signature.bound", transform.getLocation().getX(), transform.getLocation().getY(), transform.getLocation().getZ(), transform.getLocation().getDim()));
} else {
translateAndAdd("info.stabilized_rift_signature.unbound", tooltip);
tooltip.addAll(I18nUtils.translateMultiline("info.stabilized_rift_signature.unbound"));
}
}
}

View file

@ -18,8 +18,8 @@ public class ItemWovenWorldThreadArmor extends ItemArmor {
1.0f)
.setRepairItem(new ItemStack(ModItems.WORLD_THREAD));
public ItemWovenWorldThreadArmor(String name, int renderIndexIn, EntityEquipmentSlot equipmentSlotIn) {
super(WOVEN_WORLD_THREAD, renderIndexIn, equipmentSlotIn);
public ItemWovenWorldThreadArmor(String name, int renderIndex, EntityEquipmentSlot equipmentSlotIn) {
super(WOVEN_WORLD_THREAD, renderIndex, equipmentSlotIn);
setUnlocalizedName(name);
setRegistryName(DimDoors.MODID, name);
setCreativeTab(DimDoors.DIM_DOORS_CREATIVE_TAB);

View file

@ -25,7 +25,7 @@ public final class ModItems {
public static final ItemStableFabric STABLE_FABRIC = new ItemStableFabric();
// Tools
public static final ItemRiftConnectionTool RIFT_CONNECTION_TOOL = new ItemRiftConnectionTool();
public static final ItemRiftConfigurationTool RIFT_CONNECTION_TOOL = new ItemRiftConfigurationTool();
public static final ItemRiftBlade RIFT_BLADE = new ItemRiftBlade();
public static final ItemRiftRemover RIFT_REMOVER = new ItemRiftRemover();
public static final ItemRiftSignature RIFT_SIGNATURE = new ItemRiftSignature();

View file

@ -39,7 +39,7 @@ public class PocketGenerator {
float netherProbability = virtualLocation.getDim() == -1 ? 1 : (float) depth / 50; // TODO: improve nether probability
Random random = new Random();
String group = random.nextFloat() < netherProbability ? "nether" : "ruins";
PocketTemplate pocketTemplate = SchematicHandler.INSTANCE.getRandomTemplate(group, depth, DDConfig.getMaxPocketSize(), false);
PocketTemplate pocketTemplate = SchematicHandler.INSTANCE.getRandomTemplate(group, depth, Config.getMaxPocketSize(), false);
return generatePocketFromTemplate(ModDimensions.getDungeonDim(), pocketTemplate, virtualLocation);
}

View file

@ -3,7 +3,7 @@ package org.dimdev.dimdoors.shared.pockets;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import org.dimdev.ddutils.nbt.SavedToNBT;
import org.dimdev.dimdoors.shared.DDConfig;
import org.dimdev.dimdoors.shared.Config;
import org.dimdev.ddutils.math.GridUtils;
import org.dimdev.dimdoors.DimDoors;
import org.dimdev.ddutils.nbt.NBTUtils;
@ -64,10 +64,10 @@ import net.minecraft.world.storage.WorldSavedData;
}
public void initNewRegistry() {
gridSize = DDConfig.getPocketGridSize();
maxPocketSize = DDConfig.getMaxPocketSize();
privatePocketSize = DDConfig.getPrivatePocketSize();
publicPocketSize = DDConfig.getPublicPocketSize();
gridSize = Config.getPocketGridSize();
maxPocketSize = Config.getMaxPocketSize();
privatePocketSize = Config.getPrivatePocketSize();
publicPocketSize = Config.getPublicPocketSize();
nextID = 0;
pockets = new HashMap<>();

View file

@ -1,5 +1,6 @@
package org.dimdev.dimdoors.shared.pockets;
import org.dimdev.ddutils.WorldUtils;
import org.dimdev.dimdoors.shared.rifts.TileEntityRift;
import org.dimdev.ddutils.Location;
import org.dimdev.ddutils.schem.Schematic;
@ -46,7 +47,7 @@ public class PocketTemplate {
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(dim);
WorldServer world = WorldUtils.getWorld(dim);
Schematic.place(schematic, world, xBase, yBase, zBase);
// Set pocket riftLocations

View file

@ -20,18 +20,18 @@ import java.util.UUID;
@Getter @AllArgsConstructor @Builder(toBuilder = true) @ToString
@SavedToNBT public class AvailableLinkDestination extends RiftDestination { // TODO
@SavedToNBT /*package-private*/ float newDungeonRiftProbability;
@SavedToNBT /*package-private*/ float depthPenalization; // TODO: these make the equation assymetric
@SavedToNBT /*package-private*/ float distancePenalization;
@SavedToNBT /*package-private*/ float closenessPenalization;
@SavedToNBT protected float newDungeonRiftProbability;
@SavedToNBT protected float depthPenalization; // TODO: these make the equation assymetric
@SavedToNBT protected float distancePenalization;
@SavedToNBT protected float closenessPenalization;
@SavedToNBT /*package-private*/ boolean dungeonRiftsOnly;
@SavedToNBT /*package-private*/ boolean overworldRifts;
@SavedToNBT /*package-private*/ boolean unstable;
@SavedToNBT /*package-private*/ float nonFloatingRiftWeight;
@SavedToNBT /*package-private*/ float floatingRiftWeight;
@SavedToNBT protected boolean dungeonRiftsOnly;
@SavedToNBT protected boolean overworldRifts;
@SavedToNBT protected boolean unstable;
@SavedToNBT protected float nonFloatingRiftWeight;
@SavedToNBT protected float floatingRiftWeight;
@SavedToNBT /*package-private*/ boolean noLinkBack;
@SavedToNBT protected boolean noLinkBack;
// private int maxLinks;
@Builder.Default private UUID uuid = UUID.randomUUID();

View file

@ -12,7 +12,7 @@ import org.dimdev.ddutils.nbt.SavedToNBT;
@Getter @AllArgsConstructor @Builder(toBuilder = true) @ToString
@SavedToNBT public class GlobalDestination extends RiftDestination { // TODO: location directly in nbt like minecraft?
@SavedToNBT @Getter /*package-private*/ Location loc;
@SavedToNBT @Getter protected Location loc;
public GlobalDestination() {}

View file

@ -13,7 +13,7 @@ import org.dimdev.ddutils.nbt.SavedToNBT;
@Getter @AllArgsConstructor @Builder(toBuilder = true) @ToString
@SavedToNBT public class LocalDestination extends RiftDestination { // TODO: use BlockPos
@SavedToNBT /*package-private*/ BlockPos pos;
@SavedToNBT protected BlockPos pos;
public LocalDestination() {}

View file

@ -1,5 +1,6 @@
package org.dimdev.dimdoors.shared.rifts;
import org.dimdev.dimdoors.shared.VirtualLocation;
import org.dimdev.dimdoors.shared.pockets.Pocket;
import org.dimdev.dimdoors.shared.pockets.PocketGenerator;
import lombok.AllArgsConstructor;
@ -26,7 +27,13 @@ public class NewPublicDestination extends RiftDestination { // TODO: more config
@Override
public boolean teleport(TileEntityRift rift, Entity entity) {
Pocket pocket = PocketGenerator.generatePublicPocket(rift.virtualLocation != null ? rift.virtualLocation.randomTransformDepth() : null); // TODO: random transform
VirtualLocation newVirtualLocation = null;
if (rift.virtualLocation != null) {
int depth = rift.virtualLocation.getDepth();
if (depth == 0) depth++;
newVirtualLocation = new VirtualLocation(rift.virtualLocation.getLocation(), depth);
}
Pocket pocket = PocketGenerator.generatePublicPocket(newVirtualLocation);
pocket.setup();
pocket.linkPocketTo(new GlobalDestination(rift.getLocation()));
rift.makeDestinationPermanent(weightedDestination, pocket.getEntrance());

View file

@ -16,9 +16,9 @@ import java.util.List;
@Getter @AllArgsConstructor @Builder(toBuilder = true) @ToString
@SavedToNBT public class PocketEntranceDestination extends RiftDestination {
@SavedToNBT /*package-private*/ float weight;
@SavedToNBT @SuppressWarnings({"UnusedAssignment", "RedundantSuppression"}) @Builder.Default /*package-private*/ List<WeightedRiftDestination> ifDestinations = new LinkedList<>(); // TODO addIfDestination method in builder
@SavedToNBT @SuppressWarnings({"UnusedAssignment", "RedundantSuppression"}) @Builder.Default /*package-private*/ List<WeightedRiftDestination> otherwiseDestinations = new LinkedList<>(); // TODO addOtherwiseDestination method in builder
@SavedToNBT protected float weight;
@SavedToNBT @SuppressWarnings({"UnusedAssignment", "RedundantSuppression"}) @Builder.Default protected List<WeightedRiftDestination> ifDestinations = new LinkedList<>(); // TODO addIfDestination method in builder
@SavedToNBT @SuppressWarnings({"UnusedAssignment", "RedundantSuppression"}) @Builder.Default protected List<WeightedRiftDestination> otherwiseDestinations = new LinkedList<>(); // TODO addOtherwiseDestination method in builder
public PocketEntranceDestination() {}

View file

@ -13,7 +13,7 @@ import org.dimdev.ddutils.nbt.SavedToNBT;
@Getter @AllArgsConstructor @Builder(toBuilder = true) @ToString
@SavedToNBT public class RelativeDestination extends RiftDestination { // TODO: use Vec3i
@SavedToNBT /*package-private*/ Vec3i offset;
@SavedToNBT protected Vec3i offset;
public RelativeDestination() {}

View file

@ -15,7 +15,7 @@ public abstract class RiftDestination implements INBTStorable {
/*private*/ public static final BiMap<String, Class<? extends RiftDestination>> destinationRegistry = HashBiMap.create(); // TODO: move to RiftDestinationRegistry
//private String type;
/*package-private*/ WeightedRiftDestination weightedDestination;
protected WeightedRiftDestination weightedDestination;
public RiftDestination() {
//type = destinationRegistry.inverse().get(getClass());

View file

@ -26,11 +26,11 @@ import java.util.*;
private static final String DATA_NAME = DimDoors.MODID + "_rifts";
@Getter private static final int DATA_VERSION = 0; // IMPORTANT: Update this and upgradeRegistry when making changes.
@SavedToNBT @Getter /*package-private*/ /*final*/ Map<Location, RiftInfo> rifts = new HashMap<>(); // TODO: convert to a static directed graph, but store links per-world
@SavedToNBT @Getter /*package-private*/ /*final*/ Map<String, Location> privatePocketEntrances = new HashMap<>(); // Player UUID -> last rift used to exit pocket TODO: split into PrivatePocketRiftRegistry subclass
@SavedToNBT @Getter /*package-private*/ /*final*/ Map<String, List<Location>> privatePocketEntranceLists = new HashMap<>(); // Player UUID -> private pocket entrances TODO: split into PrivatePocketRiftRegistry subclass
@SavedToNBT @Getter /*package-private*/ /*final*/ Map<String, Location> privatePocketExits = new HashMap<>(); // Player UUID -> last rift used to enter pocket
@SavedToNBT @Getter /*package-private*/ /*final*/ Map<String, Location> overworldRifts = new HashMap<>();
@SavedToNBT @Getter protected /*final*/ Map<Location, RiftInfo> rifts = new HashMap<>(); // TODO: convert to a static directed graph, but store links per-world
@SavedToNBT @Getter protected /*final*/ Map<String, Location> privatePocketEntrances = new HashMap<>(); // Player UUID -> last rift used to exit pocket TODO: split into PrivatePocketRiftRegistry subclass
@SavedToNBT @Getter protected /*final*/ Map<String, List<Location>> privatePocketEntranceLists = new HashMap<>(); // Player UUID -> private pocket entrances TODO: split into PrivatePocketRiftRegistry subclass
@SavedToNBT @Getter protected /*final*/ Map<String, Location> privatePocketExits = new HashMap<>(); // Player UUID -> last rift used to enter pocket
@SavedToNBT @Getter protected /*final*/ Map<String, Location> overworldRifts = new HashMap<>();
@Getter private int dim;
private World world;

View file

@ -2,7 +2,7 @@ package org.dimdev.dimdoors.shared.tools;
import net.minecraft.block.Block;
import org.dimdev.dimdoors.DimDoors;
import org.dimdev.dimdoors.server.DDProxyServer;
import org.dimdev.dimdoors.server.ServerProxy;
import org.dimdev.dimdoors.shared.blocks.BlockDimensionalDoor;
import org.dimdev.dimdoors.shared.blocks.BlockFabric;
import org.dimdev.dimdoors.shared.blocks.ModBlocks;
@ -48,8 +48,8 @@ public final class PocketSchematicGenerator {
Loader.instance().setupTestHarness(mc);
Loader.instance().setActiveModContainer(mc);
ModBlocks.registerBlocks(new RegistryEvent.Register<Block>(GameData.BLOCKS, RegistryManager.ACTIVE.getRegistry(GameData.BLOCKS)));
new DDProxyServer().registerTileEntities();
new DDProxyServer().registerRiftDestinations();
new ServerProxy().registerTileEntities();
new ServerProxy().registerRiftDestinations();
Loader.instance().setActiveModContainer(null);
// Parse arguments

View file

@ -35,17 +35,17 @@ public class CustomSkyProvider extends IRenderHandler {
starGLCallList = GLAllocation.generateDisplayLists(3);
glSkyList = starGLCallList + 1;
glSkyList2 = starGLCallList + 2;
GL11.glDisable(GL11.GL_FOG);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.disableFog();
GlStateManager.disableAlpha();
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
RenderHelper.disableStandardItemLighting();
GL11.glDepthMask(false);
GlStateManager.depthMask(false);
mc.renderEngine.bindTexture(locationEndSkyPng);
if (mc.world.provider.isSurfaceWorld()) {
GL11.glDisable(GL11.GL_TEXTURE_2D);
GlStateManager.disableTexture2D();
final Vec3d vec3 = world.getSkyColor(mc.getRenderViewEntity(), partialTicks);
float f1 = (float) vec3.x;
float f2 = (float) vec3.y;
@ -61,17 +61,17 @@ public class CustomSkyProvider extends IRenderHandler {
f3 = f4;
}
GL11.glColor3f(f1, f2, f3);
GlStateManager.color(f1, f2, f3);
final Tessellator tessellator = Tessellator.getInstance();
final BufferBuilder buffer = tessellator.getBuffer();
GL11.glDepthMask(false);
GL11.glEnable(GL11.GL_FOG);
GL11.glColor3f(f1, f2, f3);
GL11.glCallList(glSkyList);
GL11.glDisable(GL11.GL_FOG);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.depthMask(false);
GlStateManager.enableFog();
GlStateManager.color(f1, f2, f3);
GlStateManager.callList(glSkyList);
GlStateManager.disableFog();
GlStateManager.disableAlpha();
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
RenderHelper.disableStandardItemLighting();
float[] afloat = world.provider.calcSunriseSunsetColors(world.getCelestialAngle(partialTicks), partialTicks);
float f7;
@ -80,12 +80,12 @@ public class CustomSkyProvider extends IRenderHandler {
float f10;
if (afloat != null) {
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glPushMatrix();
GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(MathHelper.sin(world.getCelestialAngleRadians(partialTicks)) < 0.0F ? 180.0F : 0.0F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.disableTexture2D();
GlStateManager.shadeModel(GL11.GL_SMOOTH);
GlStateManager.pushMatrix();
GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(MathHelper.sin(world.getCelestialAngleRadians(partialTicks)) < 0.0F ? 180.0F : 0.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F);
f4 = afloat[0];
f7 = afloat[1];
f8 = afloat[2];
@ -112,21 +112,21 @@ public class CustomSkyProvider extends IRenderHandler {
}
tessellator.draw();
GL11.glPopMatrix();
GL11.glShadeModel(GL11.GL_FLAT);
GlStateManager.popMatrix();
GlStateManager.shadeModel(GL11.GL_FLAT);
}
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
GL11.glPushMatrix();
GlStateManager.enableTexture2D();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
GlStateManager.pushMatrix();
f4 = 1.0F - world.getRainStrength(partialTicks);
f7 = 0.0F;
f8 = 0.0F;
f9 = 0.0F;
GL11.glColor4f(1.0F, 1.0F, 1.0F, f4);
GL11.glTranslatef(f7, f8, f9);
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.color(1.0F, 1.0F, 1.0F, f4);
GlStateManager.translate(f7, f8, f9);
GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(world.getCelestialAngle(partialTicks) * 360.0F, 1.0F, 0.0F, 0.0F);
f10 = 30.0F;
mc.renderEngine.bindTexture(getSunRenderPath());
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
@ -149,28 +149,28 @@ public class CustomSkyProvider extends IRenderHandler {
buffer.pos(f10, -100, -f10).tex((float) i, (float) i1).endVertex();
buffer.pos(-f10, -100, -f10).tex(f16, (float) i1).endVertex();
tessellator.draw();
GL11.glDisable(GL11.GL_TEXTURE_2D);
GlStateManager.disableTexture2D();
float f18 = world.getStarBrightness(partialTicks) * f4;
if (f18 > 0.0F) {
GL11.glColor4f(f18, f18, f18, f18);
GL11.glCallList(starGLCallList);
GlStateManager.color(f18, f18, f18, f18);
GlStateManager.callList(starGLCallList);
}
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_FOG);
GL11.glPopMatrix();
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glColor3f(0.0F, 0.0F, 0.0F);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableBlend();
GlStateManager.enableAlpha();
GlStateManager.enableFog();
GlStateManager.popMatrix();
GlStateManager.disableTexture2D();
GlStateManager.color(0.0F, 0.0F, 0.0F);
double d0 = mc.player.getLook(partialTicks).y - world.getHorizon();
if (d0 < 0.0D) {
GL11.glPushMatrix();
GL11.glTranslatef(0.0F, 12.0F, 0.0F);
GL11.glCallList(glSkyList2);
GL11.glPopMatrix();
GlStateManager.pushMatrix();
GlStateManager.translate(0.0F, 12.0F, 0.0F);
GlStateManager.callList(glSkyList2);
GlStateManager.popMatrix();
f8 = 1.0F;
f9 = -((float) (d0 + 65.0D));
f10 = -f8;
@ -200,17 +200,17 @@ public class CustomSkyProvider extends IRenderHandler {
}
if (world.provider.isSkyColored()) {
GL11.glColor3f(f1 * 0.2F + 0.04F, f2 * 0.2F + 0.04F, f3 * 0.6F + 0.1F);
GlStateManager.color(f1 * 0.2F + 0.04F, f2 * 0.2F + 0.04F, f3 * 0.6F + 0.1F);
} else {
GL11.glColor3f(f1, f2, f3);
GlStateManager.color(f1, f2, f3);
}
GL11.glPushMatrix();
GL11.glTranslatef(0.0F, -((float) (d0 - 16.0D)), 0.0F);
GL11.glCallList(glSkyList2);
GL11.glPopMatrix();
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDepthMask(true);
GlStateManager.pushMatrix();
GlStateManager.translate(0.0F, -((float) (d0 - 16.0D)), 0.0F);
GlStateManager.callList(glSkyList2);
GlStateManager.popMatrix();
GlStateManager.enableTexture2D();
GlStateManager.depthMask(true);
}
}
}

View file

@ -4,7 +4,7 @@ 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.Config;
import org.dimdev.dimdoors.shared.world.limbodimension.WorldProviderLimbo;
import org.dimdev.dimdoors.shared.world.pocketdimension.WorldProviderDungeonPocket;
import org.dimdev.dimdoors.shared.world.pocketdimension.WorldProviderPersonalPocket;
@ -26,7 +26,7 @@ public final class ModDimensions {
public static void registerDimensions() {
// TODO: more than 1 dimension/dimension type
int dim = DDConfig.getBaseDim();
int dim = Config.getBaseDim();
limboDim = dim++;
privateDim = dim++;
publicDim = dim++;

View file

@ -1,6 +1,6 @@
package org.dimdev.dimdoors.shared.world.gateways;
import org.dimdev.dimdoors.shared.DDConfig;
import org.dimdev.dimdoors.shared.Config;
import org.dimdev.dimdoors.shared.blocks.ModBlocks;
import org.dimdev.dimdoors.shared.world.pocketdimension.WorldProviderPocket;
import net.minecraft.block.material.Material;
@ -61,7 +61,7 @@ public class GatewayGenerator implements IWorldGenerator
// Check if we're allowed to generate rift clusters in this dimension.
// If so, randomly decide whether to one.
if (DDConfig.getRiftClusterDimensions().isAccepted(dimensionID) && random.nextInt(MAX_CLUSTER_GENERATION_CHANCE) < DDConfig.getClusterGenerationChance()) {
if (Config.getRiftClusterDimensions().isAccepted(dimensionID) && random.nextInt(MAX_CLUSTER_GENERATION_CHANCE) < Config.getClusterGenerationChance()) {
do {
//Pick a random point on the surface of the chunk
x = chunkX * CHUNK_LENGTH + random.nextInt(CHUNK_LENGTH);
@ -84,7 +84,7 @@ public class GatewayGenerator implements IWorldGenerator
// Check if we can place a Rift Gateway in this dimension, then randomly decide whether to place one.
// This only happens if a rift cluster was NOT generated.
else if (DDConfig.getRiftGatewayDimensions().isAccepted(dimensionID) && random.nextInt(MAX_GATEWAY_GENERATION_CHANCE) < DDConfig.getGatewayGenerationChance()) {
else if (Config.getRiftGatewayDimensions().isAccepted(dimensionID) && random.nextInt(MAX_GATEWAY_GENERATION_CHANCE) < Config.getGatewayGenerationChance()) {
valid = false;
x = y = z = 0; //Stop the compiler from freaking out

View file

@ -35,9 +35,9 @@ public class BiomeLimbo extends Biome {
@Override public BiomeDecorator createBiomeDecorator() { return null; }
@Override public void decorate(World worldIn, Random rand, BlockPos pos) {}
@Override public void decorate(World world, Random rand, BlockPos pos) {}
@Override public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal) {}
@Override public void genTerrainBlocks(World world, Random rand, ChunkPrimer chunkPrimer, int x, int z, double noiseVal) {}
@Override
@SideOnly(Side.CLIENT)

View file

@ -86,7 +86,7 @@ public class LimboGenerator implements IChunkGenerator {
}
@Override
public boolean generateStructures(Chunk chunkIn, int x, int z) {
public boolean generateStructures(Chunk chunk, int x, int z) {
return false;
}
@ -289,17 +289,17 @@ public class LimboGenerator implements IChunkGenerator {
@Nullable
@Override
public BlockPos getNearestStructurePos(World worldIn, String structureName, BlockPos position, boolean findUnexplored) {
public BlockPos getNearestStructurePos(World world, String structureName, BlockPos position, boolean findUnexplored) {
return null;
}
@Override
public void recreateStructures(Chunk chunkIn, int x, int z) {
public void recreateStructures(Chunk chunk, int x, int z) {
}
@Override
public boolean isInsideStructure(World worldIn, String structureName, BlockPos pos) {
public boolean isInsideStructure(World world, String structureName, BlockPos pos) {
return false;
}
}

View file

@ -21,8 +21,8 @@ public class BiomeBlank extends Biome {
.setBaseHeight(0F)
.setHeightVariation(0F)
.setRainDisabled()
.setRainfall(0));
// TODO: set water color too?
.setRainfall(0)
.setWaterColor(white ? 0xFFFFFF : 0x111111));
this.white = white;
topBlock = Blocks.AIR.getDefaultState();
@ -39,14 +39,14 @@ public class BiomeBlank extends Biome {
@Override public BiomeDecorator createBiomeDecorator() { return null; } // For efficiency
@Override public void decorate(World worldIn, Random rand, BlockPos pos) {}
@Override public void decorate(World world, Random rand, BlockPos pos) {}
@Override public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal) {}
@Override public void genTerrainBlocks(World world, Random rand, ChunkPrimer chunkPrimer, int x, int z, double noiseVal) {}
@Override
@SideOnly(Side.CLIENT)
public int getSkyColorByTemp(float currentTemperature) {
return white ? 0xFFFFFF : 0x000000;
return white ? 0xFCFCFC : 0x000000; // https://bugs.mojang.com/projects/MC/issues/MC-123703
}
// TODO: check that black/white grass and foliage in getModdedBiomeGrassColor is compatible with other mods such as Quark's greener grass option

View file

@ -30,15 +30,15 @@ public class ChunkGeneratorBlank implements IChunkGenerator {
public void populate(int x, int z) {}
@Override
public boolean generateStructures(Chunk chunkIn, int x, int z) {
public boolean generateStructures(Chunk chunk, int x, int z) {
return false;
}
@Override @Nullable public BlockPos getNearestStructurePos(World worldIn, String structureName, BlockPos position, boolean findUnexplored) { return null; }
@Override @Nullable public BlockPos getNearestStructurePos(World world, String structureName, BlockPos position, boolean findUnexplored) { return null; }
@Override public void recreateStructures(Chunk chunkIn, int x, int z) {}
@Override public void recreateStructures(Chunk chunk, int x, int z) {}
@Override public boolean isInsideStructure(World worldIn, String structureName, BlockPos pos) { return false; }
@Override public boolean isInsideStructure(World world, String structureName, BlockPos pos) { return false; }
@Override
public List<Biome.SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos) {

View file

@ -32,12 +32,12 @@ public class WorldProviderPersonalPocket extends WorldProviderPocket {
@SideOnly(Side.CLIENT)
@Override
public Vec3d getSkyColor(Entity cameraEntity, float partialTicks) {
return new Vec3d(1, 1, 1);
return new Vec3d(0.99, 0.99, 0.99); // https://bugs.mojang.com/projects/MC/issues/MC-123703
}
@Override
@SideOnly(Side.CLIENT)
public Vec3d getFogColor(float celestialAngle, float partialTicks) {
return new Vec3d(1, 1, 1);
return new Vec3d(0.99, 0.99, 0.99); // https://bugs.mojang.com/projects/MC/issues/MC-123703
}
}

View file

@ -30,7 +30,7 @@ item.warp_dimensional_door.name=Warp-Tür
item.rift_key=Spaltschlüssel
item.rift_signature.name=Spaltsignatur
item.stabilized_rift_signature.name=Stabilisierte Spaltsignatur
item.rift_connection_tool.name=Below Average Rift Connection Tool
item.rift_configuration_tool.name=Rift Configuration Tool
item.rift_remover.name=Spaltentferner
item.rift_blade.name=Spaltklinge

View file

@ -31,7 +31,7 @@ item.warp_dimensional_door.name=Warp Door
item.rift_key=Rift Key
item.rift_signature.name=Rift Signature
item.stabilized_rift_signature.name=Stabilized Rift Signature
item.rift_connection_tool.name=Below Average Rift Connection Tool
item.rift_configuration_tool.name=Rift Configuration Tool
item.rift_remover.name=Rift Remover
item.rift_blade.name=Rift Blade

View file

@ -31,7 +31,7 @@ item.warp_dimensional_door.name=Porte-raccourci
item.rift_key=Clé de fissure
item.rift_signature.name=Signature de fissure
item.stabilized_rift_signature.name=Signature de fissure stabilisée
item.rift_connection_tool.name=Outil de connexion de fissures sous la moyenne
item.rift_configuration_tool.name=Outil de connexion de fissures sous la moyenne
item.rift_remover.name=Enleveur de fissure
item.rift_blade.name=Lame de fissure

View file

@ -30,7 +30,7 @@ item.warp_dimensional_door.name=Porta distorta
item.rift_key=Chiave per frattura
item.rift_signature.name=Segno di frattura
item.stabilized_rift_signature.name=Segno di frattura stabilizzato
item.rift_connection_tool.name=Below Average Rift Connection Tool
item.rift_configuration_tool.name=Rift Configuration Tool
item.rift_remover.name=Rimovitore di frattura
item.rift_blade.name=Lama dimensionale

View file

@ -30,7 +30,7 @@ item.warp_dimensional_door.name=Verdraaideur
item.rift_key=Scheur Sleutel
item.rift_signature.name=Scheurtekening
item.stabilized_rift_signature.name=Gestabiliseerde Scheurtekening
item.rift_connection_tool.name=Ondergemiddeld Scheurverbindingsgereedschap
item.rift_configuration_tool.name=Ondergemiddeld Scheurverbindingsgereedschap
item.rift_remover.name=Scheurverwijderaar
item.rift_blade.name=Scheurkling

View file

@ -31,7 +31,7 @@ item.warp_dimensional_door.name=Ușă de distorsiune
item.rift_key=Cheie de fisură
item.rift_signature.name=Semnătură de fisură
item.stabilized_rift_signature.name=Semnătură de fisură stabilizată
item.rift_connection_tool.name=Sculă pentru conectarea fisurilor sub medie
item.rift_configuration_tool.name=Sculă pentru configurarea fisurilor
item.rift_remover.name=Închizator de fisură
item.rift_blade.name=Lamă de fisură

View file

@ -30,7 +30,7 @@ item.warp_dimensional_door.name=Дверь искажения
item.rift_key=Ключ разлома
item.rift_signature.name=Подписыватель разлома
item.stabilized_rift_signature.name=Стабилизированный подписыватель разлома
item.rift_connection_tool.name=Below Average Rift Connection Tool
item.rift_configuration_tool.name=Rift Configuration Tool
item.rift_remover.name=Уничтожитель разломов
item.rift_blade.name=Клинок разлома

View file

@ -30,7 +30,7 @@ item.warp_dimensional_door.name=扭曲之门
item.rift_key=裂痕钥匙
item.rift_signature.name=裂痕印记
item.stabilized_rift_signature.name=裂痕印记(稳定)
item.rift_connection_tool.name=Below Average Rift Connection Tool
item.rift_configuration_tool.name=Rift Configuration Tool
item.rift_remover.name=裂痕移除器
item.rift_blade.name=裂痕之刃

View file

@ -1,7 +1,7 @@
{
"parent": "builtin/generated",
"textures": {
"layer0": "dimdoors:items/rift_connection_tool"
"layer0": "dimdoors:items/rift_configuration_tool"
},
"display": {
"thirdperson": {

View file

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB