Graphics improvements and bug fixes
* Fix hand not swinging for all items * Fix dimensional trapdoor being registered client-side * Make rift blade teleport near the entity rather than on it * Rift jitter adjustment and config option * Remove "In" suffixes and "par" prefixes from remaining parameters
This commit is contained in:
parent
3cb768bdd2
commit
225b5954c0
16 changed files with 82 additions and 52 deletions
src/main
|
@ -49,10 +49,4 @@ public class ParticleRiftEffect extends ParticleSimpleAnimated { // TODO: colors
|
|||
super(world, x, y, z, motionX, motionY, motionZ, 0.8f, 0.4f, 0.55f, 38, 16);
|
||||
}
|
||||
}
|
||||
|
||||
public static class GogglesRiftEffect extends ParticleRiftEffect {
|
||||
public GogglesRiftEffect(World world, double x, double y, double z, double motionX, double motionY, double motionZ) {
|
||||
super(world, x, y, z, motionX, motionY, motionZ, 0.0f, 0.7f, 0.55f, 38, 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,33 +72,33 @@ 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) {
|
||||
if (MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Pre<>(par1EntityLivingBase, this, 1, x, y, z))) return;
|
||||
public void render(EntityMonolith monolith, double x, double y, double z, float par8, float partialTickTime) {
|
||||
if (MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Pre<>(monolith, this, 1, x, y, z))) return;
|
||||
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);
|
||||
mainModel.swingProgress = getSwingProgress(monolith, partialTickTime);
|
||||
|
||||
try {
|
||||
float interpolatedYaw = interpolateRotation(par1EntityLivingBase.prevRenderYawOffset, par1EntityLivingBase.renderYawOffset, par9);
|
||||
float interpolatedYaw = interpolateRotation(monolith.prevRenderYawOffset, monolith.renderYawOffset, partialTickTime);
|
||||
float rotation;
|
||||
float pitch = par1EntityLivingBase.prevRotationPitch + (par1EntityLivingBase.rotationPitch - par1EntityLivingBase.prevRotationPitch) * par9;
|
||||
renderLivingAt(par1EntityLivingBase, x, y, z);
|
||||
float pitch = monolith.prevRotationPitch + (monolith.rotationPitch - monolith.prevRotationPitch) * partialTickTime;
|
||||
renderLivingAt(monolith, x, y, z);
|
||||
|
||||
rotation = handleRotationFloat(par1EntityLivingBase, par9);
|
||||
applyRotations(par1EntityLivingBase, rotation, interpolatedYaw, par9);
|
||||
rotation = handleRotationFloat(monolith, partialTickTime);
|
||||
applyRotations(monolith, rotation, interpolatedYaw, partialTickTime);
|
||||
|
||||
float f6 = 0.0625F;
|
||||
GlStateManager.enableRescaleNormal();
|
||||
|
||||
GlStateManager.scale(-1.0F, -1.0F, 1.0F);
|
||||
preRenderCallback(par1EntityLivingBase, par9);
|
||||
GlStateManager.rotate(par1EntityLivingBase.pitchLevel, 1.0F, 0.0F, 0.0F);
|
||||
preRenderCallback(monolith, partialTickTime);
|
||||
GlStateManager.rotate(monolith.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);
|
||||
renderModel(monolith, 0, 0, rotation, interpolatedYaw, pitch, f6);
|
||||
|
||||
OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
|
||||
GlStateManager.disableTexture2D();
|
||||
|
@ -116,7 +116,7 @@ public class RenderMonolith extends RenderLiving<EntityMonolith> {
|
|||
GlStateManager.enableLighting();
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.popMatrix();
|
||||
MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Post<>(par1EntityLivingBase, this, 1, x, y, z));
|
||||
MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Post<>(monolith, this, 1, x, y, z));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.dimdev.dimdoors.client;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import org.dimdev.ddutils.lsystem.LSystem;
|
||||
import org.dimdev.dimdoors.shared.ModConfig;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import java.awt.Point; // TODO: wrong point class!
|
||||
|
@ -38,7 +39,7 @@ public final class RiftCrackRenderer {
|
|||
float time = ((Minecraft.getSystemTime() + riftRandom) % 2000000) * motionSpeed;
|
||||
double[] jitters = new double[jCount];
|
||||
|
||||
double jitterScale = size * size / 1100f;
|
||||
double jitterScale = ModConfig.graphics.riftJitter * size * size * size / 2000f;
|
||||
// We use random constants here on purpose just to get different wave forms
|
||||
double xJitter = jitterScale * Math.sin(1.1f * time*size) * Math.sin(0.8f * time);
|
||||
double yJitter = jitterScale * Math.sin(1.2f * time*size) * Math.sin(0.9f * time);
|
||||
|
|
|
@ -142,6 +142,11 @@ public final class ModConfig {
|
|||
@LangKey("dimdoors.graphics.riftSize")
|
||||
@RangeDouble(min = 0)
|
||||
public double riftSize = 1;
|
||||
|
||||
@Name("riftJitter")
|
||||
@LangKey("dimdoors.graphics.riftJitter")
|
||||
@RangeDouble(min=0)
|
||||
public double riftJitter = 1;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ public abstract class BlockDimensionalDoor extends BlockDoor implements IRiftPro
|
|||
}
|
||||
|
||||
// Let vanilla handle breaking the block. If we break it here, the rift we place will later be broken.
|
||||
@Override public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) {}
|
||||
@Override public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player) {}
|
||||
|
||||
@Override
|
||||
public EnumPushReaction getMobilityFlag(IBlockState state) {
|
||||
|
|
|
@ -84,24 +84,18 @@ public class BlockFloatingRift extends BlockSpecialAir implements ITileEntityPro
|
|||
@SideOnly(Side.CLIENT)
|
||||
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
|
||||
TileEntity tileEntity = world.getTileEntity(pos);
|
||||
// Workaround minecraft/forge bug where this is called even before the TileEntity is created in multiplayer
|
||||
// randomDisplayTick can be called before the tile entity is created in multiplayer
|
||||
if (!(tileEntity instanceof TileEntityFloatingRift)) return;
|
||||
TileEntityFloatingRift rift = (TileEntityFloatingRift) tileEntity;
|
||||
if (0 > 0) {
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new ParticleRiftEffect.GogglesRiftEffect(
|
||||
world,
|
||||
pos.getX() + .5, pos.getY() + .5, pos.getZ() + .5,
|
||||
rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D));
|
||||
}
|
||||
|
||||
if (rift.closing) { // Renders an opposite color effect if it is being closed by the rift remover
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new ParticleRiftEffect.ClosingRiftEffect(
|
||||
world,
|
||||
pos.getX() + .5, pos.getY() + .5, pos.getZ() + .5,
|
||||
pos.getX() + .5, pos.getY() + 1.5, pos.getZ() + .5,
|
||||
rand.nextGaussian() * 0.1D, rand.nextGaussian() * 0.1D, rand.nextGaussian() * 0.1D));
|
||||
}
|
||||
|
||||
// TODO: depend on size, direction of particles should be rift orientation
|
||||
// TODO: depend on size, stabilization status, direction of particles should be rift orientation
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new ParticleRiftEffect.Rift(
|
||||
world,
|
||||
pos.getX() + .5, pos.getY() + 1.5, pos.getZ() + .5,
|
||||
|
|
|
@ -74,7 +74,7 @@ public class EntityMonolith extends EntityFlying implements IMob {
|
|||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBox(Entity entityIn) {
|
||||
public AxisAlignedBB getCollisionBox(Entity entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,10 @@ public abstract class ItemDimensionalTrapdoor extends ItemBlock {
|
|||
// TODO: placing trapdoors on rifts, merge this code with the dimdoor code/common interface
|
||||
@Override
|
||||
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
if (world.isRemote) {
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
|
||||
boolean replaceable = world.getBlockState(pos).getBlock().isReplaceable(world, pos); // Check this before calling super, since that changes the block
|
||||
EnumActionResult result = super.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ);
|
||||
if (result == EnumActionResult.SUCCESS) {
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
package org.dimdev.dimdoors.shared.items;
|
||||
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import org.dimdev.dimdoors.DimDoors;
|
||||
import org.dimdev.dimdoors.client.TileEntityFloatingRiftRenderer;
|
||||
import org.dimdev.dimdoors.shared.ModConfig;
|
||||
import org.dimdev.dimdoors.shared.tileentities.TileEntityFloatingRift;
|
||||
import org.dimdev.ddutils.Location;
|
||||
import org.dimdev.dimdoors.shared.RayTraceHelper;
|
||||
|
@ -41,9 +44,6 @@ public class ItemRiftBlade extends ItemSword {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether this item is repairable in an anvil.
|
||||
*/
|
||||
@Override
|
||||
public boolean getIsRepairable(ItemStack toRepair, ItemStack repair) {
|
||||
return ModItems.STABLE_FABRIC == repair.getItem();
|
||||
|
@ -52,12 +52,18 @@ public class ItemRiftBlade extends ItemSword {
|
|||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
RayTraceResult hit = rayTrace(world, player, true);
|
||||
|
||||
if (world.isRemote) {
|
||||
return new ActionResult<>(EnumActionResult.FAIL, stack);
|
||||
if (RayTraceHelper.isFloatingRift(hit, world) || RayTraceHelper.isLivingEntity(hit)) {
|
||||
return new ActionResult<>(EnumActionResult.SUCCESS, stack);
|
||||
} else {
|
||||
player.sendStatusMessage(new TextComponentTranslation(getUnlocalizedName() + ".rift_miss"), true);
|
||||
TileEntityFloatingRiftRenderer.showRiftCoreUntil = System.currentTimeMillis() + ModConfig.graphics.highlightRiftCoreFor;
|
||||
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(world, player, true);
|
||||
|
||||
if (RayTraceHelper.isFloatingRift(hit, world)) {
|
||||
TileEntityFloatingRift rift = (TileEntityFloatingRift) world.getTileEntity(hit.getBlockPos());
|
||||
rift.teleport(player);
|
||||
|
@ -66,7 +72,13 @@ public class ItemRiftBlade extends ItemSword {
|
|||
return new ActionResult<>(EnumActionResult.SUCCESS, stack);
|
||||
|
||||
} else if (RayTraceHelper.isLivingEntity(hit)) {
|
||||
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
|
||||
BlockPos hitPos = hit.getBlockPos();
|
||||
// TODO: gaussian, and depend on rift blade's wear
|
||||
int xDiff = (int) (5 * (Math.random() - 0.5));
|
||||
int zDiff = (int) (5 * (Math.random() - 0.5));
|
||||
BlockPos tpPos = new BlockPos(hitPos.getX() + xDiff, hitPos.getY(), hitPos.getZ() + zDiff);
|
||||
while (world.getBlockState(tpPos).getMaterial().blocksMovement()) tpPos = tpPos.up(); // TODO: move to ddutils
|
||||
TeleportUtils.teleport(player, new Location(world, tpPos), player.rotationYaw, player.rotationPitch);
|
||||
stack.damageItem(1, player); // TODO: check if successful
|
||||
return new ActionResult<>(EnumActionResult.SUCCESS, stack);
|
||||
}
|
||||
|
|
|
@ -9,10 +9,15 @@ 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.util.text.TextComponentTranslation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import org.dimdev.dimdoors.DimDoors;
|
||||
import org.dimdev.dimdoors.client.TileEntityFloatingRiftRenderer;
|
||||
import org.dimdev.dimdoors.shared.ModConfig;
|
||||
import org.dimdev.dimdoors.shared.RayTraceHelper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -29,9 +34,18 @@ public class ItemRiftConfigurationTool extends Item {
|
|||
}
|
||||
|
||||
@Override
|
||||
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 = player.getHeldItem(handIn);
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
RayTraceResult hit = rayTrace(world, player, true);
|
||||
|
||||
if (world.isRemote) {
|
||||
if (!RayTraceHelper.isFloatingRift(hit, world)) {
|
||||
player.sendStatusMessage(new TextComponentTranslation("tools.rift_miss"), true);
|
||||
TileEntityFloatingRiftRenderer.showRiftCoreUntil = System.currentTimeMillis() + ModConfig.graphics.highlightRiftCoreFor;
|
||||
}
|
||||
return new ActionResult<>(EnumActionResult.FAIL, stack);
|
||||
}
|
||||
|
||||
return new ActionResult<>(EnumActionResult.FAIL, stack);
|
||||
}
|
||||
|
||||
|
|
|
@ -40,8 +40,8 @@ public class ItemRiftRemover extends Item {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand handIn) { // TODO: permissions
|
||||
ItemStack stack = player.getHeldItem(handIn);
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) { // TODO: permissions
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
RayTraceResult hit = rayTrace(world, player, true);
|
||||
|
||||
if (world.isRemote) {
|
||||
|
|
|
@ -43,6 +43,7 @@ public class ItemRiftSignature extends Item {
|
|||
@Override
|
||||
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
pos = world.getBlockState(pos).getBlock().isReplaceable(world, pos) ? pos : pos.offset(side);
|
||||
// Return false on the client side to pass this request to the server
|
||||
if (world.isRemote) {
|
||||
return EnumActionResult.FAIL;
|
||||
|
@ -52,7 +53,6 @@ public class ItemRiftSignature extends Item {
|
|||
if (!player.canPlayerEdit(pos, side.getOpposite(), stack)) {
|
||||
return EnumActionResult.PASS;
|
||||
}
|
||||
pos = pos.offset(side);
|
||||
|
||||
RotatedLocation target = getSource(stack);
|
||||
|
||||
|
|
|
@ -32,16 +32,19 @@ public class ItemRiftStabilizer extends Item {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand handIn) { // TODO: permissions
|
||||
ItemStack stack = player.getHeldItem(handIn);
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) { // TODO: permissions
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
RayTraceResult hit = rayTrace(world, player, true);
|
||||
|
||||
if (world.isRemote) {
|
||||
if (!RayTraceHelper.isFloatingRift(hit, world)) {
|
||||
if (RayTraceHelper.isFloatingRift(hit, world)) {
|
||||
// TODO: not necessarily success, fix this and all other similar cases to make arm swing correct
|
||||
return new ActionResult<>(EnumActionResult.SUCCESS, stack);
|
||||
} else {
|
||||
player.sendStatusMessage(new TextComponentTranslation("tools.rift_miss"), true);
|
||||
TileEntityFloatingRiftRenderer.showRiftCoreUntil = System.currentTimeMillis() + ModConfig.graphics.highlightRiftCoreFor;
|
||||
return new ActionResult<>(EnumActionResult.FAIL, stack);
|
||||
}
|
||||
return new ActionResult<>(EnumActionResult.FAIL, stack);
|
||||
}
|
||||
|
||||
if (RayTraceHelper.isFloatingRift(hit, world)) {
|
||||
|
|
|
@ -43,6 +43,7 @@ public class ItemStabilizedRiftSignature extends Item { // TODO: common supercla
|
|||
@Override
|
||||
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
pos = world.getBlockState(pos).getBlock().isReplaceable(world, pos) ? pos : pos.offset(side);
|
||||
// Return false on the client side to pass this request to the server
|
||||
if (world.isRemote) {
|
||||
return EnumActionResult.FAIL;
|
||||
|
@ -50,9 +51,8 @@ public class ItemStabilizedRiftSignature extends Item { // TODO: common supercla
|
|||
|
||||
// Fail if the player can't place a block there TODO: spawn protection, other plugin support
|
||||
if (!player.canPlayerEdit(pos, side.getOpposite(), stack)) {
|
||||
return EnumActionResult.PASS;
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
pos = pos.offset(side);
|
||||
|
||||
RotatedLocation target = getTarget(stack);
|
||||
|
||||
|
|
|
@ -18,8 +18,8 @@ public class ItemWovenWorldThreadArmor extends ItemArmor {
|
|||
1.0f)
|
||||
.setRepairItem(new ItemStack(ModItems.WORLD_THREAD));
|
||||
|
||||
public ItemWovenWorldThreadArmor(String name, int renderIndex, EntityEquipmentSlot equipmentSlotIn) {
|
||||
super(WOVEN_WORLD_THREAD, renderIndex, equipmentSlotIn);
|
||||
public ItemWovenWorldThreadArmor(String name, int renderIndex, EntityEquipmentSlot equipmentSlot) {
|
||||
super(WOVEN_WORLD_THREAD, renderIndex, equipmentSlot);
|
||||
setUnlocalizedName(name);
|
||||
setRegistryName(DimDoors.MODID, name);
|
||||
setCreativeTab(DimDoors.DIM_DOORS_CREATIVE_TAB);
|
||||
|
|
|
@ -78,6 +78,7 @@ item.rift_stabilizer.info=Use on a rift's core to stop its growth.
|
|||
item.rift_stabilizer.stabilized=The rift has been stabilized and will stop growing
|
||||
item.rift_stabilizer.already_stabilized=This rift is already stable
|
||||
item.rift_blade.name=Rift Blade
|
||||
item.rift_blade.rift_miss=You can only use this item on a rift's core
|
||||
|
||||
item.world_thread.name=World Thread
|
||||
item.stable_fabric.name=Stable Fabric
|
||||
|
@ -125,7 +126,7 @@ rifts.destinations.private_pocket_exit.rift_has_closed=The rift you used to ente
|
|||
rifts.entrances.rift_too_close=Placing a door this close to a tear in the world would be dangerous. Shift-right-click to place anyway, or place it on the rift's core (tesseract) to bind it to the rift.
|
||||
rifts.entrances.cannot_be_placed_on_rift=This type of door can't be placed on a rift.
|
||||
|
||||
tools.rift_miss=You can only use this item on a rift's core (tesseract)
|
||||
tools.rift_miss=You can only use this item on a rift's core
|
||||
|
||||
dimdoors.general=General Settings
|
||||
dimdoors.general.tooltip=General configuration settings for the mod
|
||||
|
@ -196,3 +197,5 @@ dimdoors.graphics.showRiftCore=Always Show Rift Cores
|
|||
dimdoors.graphics.showRiftCore.tooltip=Set this to true to always show rifts' cores (tesseract animation).
|
||||
dimdoors.graphics.riftSize=Rift Size
|
||||
dimdoors.graphics.riftSize.tooltip=Multiplier affecting how large rifts should be rendered, 1 being the default size.
|
||||
dimdoors.graphics.riftJitter=Rift Jitter
|
||||
dimdoors.graphics.riftSize.tooltip=Multiplier affecting how much rifts should jitter, 1 being the default size.
|
||||
|
|
Loading…
Add table
Reference in a new issue