Fix render and register default targets

This commit is contained in:
Runemoro 2018-04-17 21:02:49 -04:00
parent 4702b913c9
commit ca5bd0e540
7 changed files with 14 additions and 10 deletions

View file

@ -27,7 +27,6 @@ import org.dimdev.dimdoors.shared.commands.CommandSaveSchem;
import org.dimdev.dimdoors.shared.entities.EntityMonolith; import org.dimdev.dimdoors.shared.entities.EntityMonolith;
import org.dimdev.dimdoors.shared.items.ModItems; import org.dimdev.dimdoors.shared.items.ModItems;
import org.dimdev.dimdoors.shared.pockets.SchematicHandler; import org.dimdev.dimdoors.shared.pockets.SchematicHandler;
import org.dimdev.dimdoors.shared.rifts.targets.VirtualTarget;
import org.dimdev.dimdoors.shared.rifts.targets.*; import org.dimdev.dimdoors.shared.rifts.targets.*;
import org.dimdev.dimdoors.shared.sound.ModSounds; import org.dimdev.dimdoors.shared.sound.ModSounds;
import org.dimdev.dimdoors.shared.tileentities.TileEntityEntranceRift; import org.dimdev.dimdoors.shared.tileentities.TileEntityEntranceRift;
@ -98,6 +97,9 @@ public class DimDoors {
// Register dimensions // Register dimensions
ModDimensions.registerDimensions(); ModDimensions.registerDimensions();
// Register default targets
Targets.registerDefaultTargets();
// Make config folder and check if config needs to be regenerated TODO // Make config folder and check if config needs to be regenerated TODO
configurationFolder = new File(event.getModConfigurationDirectory(), "/DimDoors"); configurationFolder = new File(event.getModConfigurationDirectory(), "/DimDoors");
configurationFolder.mkdirs(); configurationFolder.mkdirs();

View file

@ -46,7 +46,7 @@ public final class RiftCrackRenderer {
// Set color (nearly black, but inverts background) // Set color (nearly black, but inverts background)
GlStateManager.color(0.08f, 0.08f, 0.08f, .3F); GlStateManager.color(0.08f, 0.08f, 0.08f, .3F);
glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO); GlStateManager.blendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO);
// Draw the rift // Draw the rift
GlStateManager.glBegin(GL11.GL_TRIANGLES); GlStateManager.glBegin(GL11.GL_TRIANGLES);

View file

@ -42,7 +42,7 @@ public class TileEntityFloatingRiftRenderer extends TileEntitySpecialRenderer<Ti
GlStateManager.disableTexture2D(); GlStateManager.disableTexture2D();
GlStateManager.enableBlend(); GlStateManager.enableBlend();
RiftCrackRenderer.drawCrack(rift.riftYaw, rift.getCurve(), ModConfig.graphics.riftSize * rift.size / 120, x + 0.5, y + 1.5, z + 0.5); RiftCrackRenderer.drawCrack(rift.riftYaw, rift.getCurve(), ModConfig.graphics.riftSize * rift.size / 150, x + 0.5, y + 1.5, z + 0.5);
GlStateManager.disableBlend(); GlStateManager.disableBlend();
GlStateManager.enableTexture2D(); GlStateManager.enableTexture2D();
@ -60,7 +60,6 @@ public class TileEntityFloatingRiftRenderer extends TileEntitySpecialRenderer<Ti
GlStateManager.disableLighting(); GlStateManager.disableLighting();
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
GlStateManager.disableCull(); GlStateManager.disableCull();
GlStateManager.enableBlend();
bindTexture(tesseract_path); bindTexture(tesseract_path);
@ -69,7 +68,6 @@ public class TileEntityFloatingRiftRenderer extends TileEntitySpecialRenderer<Ti
tesseract.draw(color, radian); tesseract.draw(color, radian);
GlStateManager.disableBlend();
GlStateManager.enableCull(); GlStateManager.enableCull();
GlStateManager.popMatrix(); GlStateManager.popMatrix();
GlStateManager.enableLighting(); GlStateManager.enableLighting();

View file

@ -71,6 +71,6 @@ public abstract class RiftReference extends VirtualTarget {
Set<Location> otherRiftTargets = RiftRegistry.instance().getTargets(target); Set<Location> otherRiftTargets = RiftRegistry.instance().getTargets(target);
if (otherRiftTargets.size() == 1 && otherRiftTargets.contains(location)) return new RGBA(0, 1, 0, 1); if (otherRiftTargets.size() == 1 && otherRiftTargets.contains(location)) return new RGBA(0, 1, 0, 1);
} }
return new RGBA(1, 1, 1, 1); return new RGBA(1, 0, 0, 1);
} }
} }

View file

@ -2,6 +2,7 @@ package org.dimdev.dimdoors.shared.rifts.targets;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.Fluid;
import org.dimdev.dimdoors.DimDoors;
// A list of the default targets provided by dimcore. Add your own in ModTargets // A list of the default targets provided by dimcore. Add your own in ModTargets
public final class Targets { public final class Targets {
@ -11,7 +12,10 @@ public final class Targets {
public static final Class<IRedstoneTarget> REDSTONE = IRedstoneTarget.class; public static final Class<IRedstoneTarget> REDSTONE = IRedstoneTarget.class;
public static void registerDefaultTargets() { public static void registerDefaultTargets() {
DefaultTargets.registerDefaultTarget(ENTITY, (entity, relativeYaw, relativePitch) -> false); DefaultTargets.registerDefaultTarget(ENTITY, (entity, relativeYaw, relativePitch) -> {
DimDoors.sendTranslatedMessage(entity, "rifts.unlinked");
return false;
});
DefaultTargets.registerDefaultTarget(ITEM, stack -> false); DefaultTargets.registerDefaultTarget(ITEM, stack -> false);
DefaultTargets.registerDefaultTarget(FLUID, new IFluidTarget() { DefaultTargets.registerDefaultTarget(FLUID, new IFluidTarget() {

View file

@ -183,10 +183,10 @@ import javax.annotation.Nonnull;
public boolean teleport(Entity entity) { public boolean teleport(Entity entity) {
riftStateChanged = false; riftStateChanged = false;
IEntityTarget target = getTarget().as(Targets.ENTITY);
// Attempt a teleport // Attempt a teleport
try { try {
IEntityTarget target = getTarget().as(Targets.ENTITY);
if (target.receiveEntity(entity, getSourceYaw(entity.rotationYaw), getSourcePitch(entity.rotationPitch))) { if (target.receiveEntity(entity, getSourceYaw(entity.rotationYaw), getSourcePitch(entity.rotationPitch))) {
VirtualLocation vloc = VirtualLocation.fromLocation(new Location(entity.world, entity.getPosition())); VirtualLocation vloc = VirtualLocation.fromLocation(new Location(entity.world, entity.getPosition()));
DimDoors.sendTranslatedMessage(entity, "You are at x = " + vloc.getX() + ", y = ?, z = " + vloc.getZ() + ", w = " + vloc.getDepth()); DimDoors.sendTranslatedMessage(entity, "You are at x = " + vloc.getX() + ", y = ?, z = " + vloc.getZ() + ", w = " + vloc.getDepth());

View file

@ -118,7 +118,7 @@ commands.saveschem.success=Pocket %s has been successfully saved
commands.generic.dimdoors.not_in_pocket_dim=You must be in a pocket dimension to use this command. commands.generic.dimdoors.not_in_pocket_dim=You must be in a pocket dimension to use this command.
commands.generic.dimdoors.not_in_pocket=You must be in a pocket to use this command. commands.generic.dimdoors.not_in_pocket=You must be in a pocket to use this command.
rifts.unlinked=This rift leads nowhere rifts.unlinked=This rift doesn't lead anywhere
rifts.destinations.escape.cannot_escape_limbo=Nice try, but you'll need to either die or find some eternal fabric to get out of Limbo. rifts.destinations.escape.cannot_escape_limbo=Nice try, but you'll need to either die or find some eternal fabric to get out of Limbo.
rifts.destinations.escape.not_in_pocket_dim=You can only use this to escape from a pocket dimension! rifts.destinations.escape.not_in_pocket_dim=You can only use this to escape from a pocket dimension!
rifts.destinations.escape.did_not_use_rift=You didn't use a rift to enter the pocket dimension, so you ended up in Limbo! rifts.destinations.escape.did_not_use_rift=You didn't use a rift to enter the pocket dimension, so you ended up in Limbo!