I did a update thing. :D
This commit is contained in:
parent
632ba41f32
commit
eb851c9eb5
23 changed files with 112 additions and 93 deletions
src/main/java/com/zixiken/dimdoors
|
@ -11,6 +11,7 @@ import com.zixiken.dimdoors.shared.SchematicHandler;
|
|||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.TextComponentString;
|
||||
import net.minecraft.util.text.translation.I18n;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -39,8 +40,8 @@ public class DimDoors {
|
|||
public static CreativeTabs dimDoorsCreativeTab = new CreativeTabs("dimDoorsCreativeTab") {
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Item getTabIconItem() {
|
||||
return ModItems.itemDimDoor;
|
||||
public ItemStack getTabIconItem() {
|
||||
return new ItemStack(ModItems.itemDimDoor);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.zixiken.dimdoors.client;
|
||||
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
@ -29,7 +29,7 @@ public class ClosingRiftFX extends Particle {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle(VertexBuffer worldRenderer, Entity entityIn, float partialTicks, float p_180434_4_,
|
||||
public void renderParticle(BufferBuilder worldRenderer, Entity entityIn, float partialTicks, float p_180434_4_,
|
||||
float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) {
|
||||
if (!this.twinkle
|
||||
|| this.particleAge < this.particleMaxAge / 3
|
||||
|
@ -39,8 +39,8 @@ public class ClosingRiftFX extends Particle {
|
|||
}
|
||||
}
|
||||
|
||||
public void doRenderParticle(VertexBuffer worldRenderer, float par2, float par3, float par4,
|
||||
float par5, float par6, float par7) {
|
||||
public void doRenderParticle(BufferBuilder worldRenderer, float par2, float par3, float par4,
|
||||
float par5, float par6, float par7) {
|
||||
float var8 = super.particleTextureIndexX % 16 / 16.0F;
|
||||
float var9 = var8 + 0.0624375F;
|
||||
float var10 = this.particleTextureIndexX / 16 / 16.0F;
|
||||
|
|
|
@ -68,6 +68,6 @@ public class DDProxyClient extends DDProxyCommon {
|
|||
|
||||
@Override
|
||||
public WorldServer getWorldServer(int dimId) {
|
||||
return Minecraft.getMinecraft().getIntegratedServer().worldServerForDimension(dimId);
|
||||
return Minecraft.getMinecraft().getIntegratedServer().getWorld(dimId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import com.zixiken.dimdoors.DimDoors;
|
|||
import com.zixiken.dimdoors.shared.blocks.BlockDimDoorBase;
|
||||
import com.zixiken.dimdoors.shared.tileentities.TileEntityDimDoor;
|
||||
import net.minecraft.client.renderer.*;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.vertex.*;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
@ -115,7 +114,7 @@ public class RenderDimDoor extends TileEntitySpecialRenderer<TileEntityDimDoor>
|
|||
GlStateManager.translate(0.5F, 0.5F, 0.5F);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer worldRenderer = tessellator.getBuffer();
|
||||
BufferBuilder worldRenderer = tessellator.getBuffer();
|
||||
worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION);
|
||||
|
||||
float[] color = tile.getRenderColor(rand);
|
||||
|
@ -199,9 +198,9 @@ public class RenderDimDoor extends TileEntitySpecialRenderer<TileEntityDimDoor>
|
|||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(x, y, z);
|
||||
|
||||
x = ActiveRenderInfo.getPosition().xCoord;
|
||||
y = ActiveRenderInfo.getPosition().yCoord;
|
||||
z = ActiveRenderInfo.getPosition().zCoord;
|
||||
//x = ActiveRenderInfo.getPosition().xCoord;
|
||||
//y = ActiveRenderInfo.getPosition().yCoord;
|
||||
//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);
|
||||
|
@ -241,7 +240,7 @@ public class RenderDimDoor extends TileEntitySpecialRenderer<TileEntityDimDoor>
|
|||
GlStateManager.translate(-65.0F, -107.0F, -3.0F);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer worldRenderer = tessellator.getBuffer();
|
||||
BufferBuilder worldRenderer = tessellator.getBuffer();
|
||||
worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_NORMAL);
|
||||
byte b0 = 7;
|
||||
|
||||
|
|
|
@ -7,9 +7,9 @@ import com.zixiken.dimdoors.DimDoors;
|
|||
import com.zixiken.dimdoors.shared.items.ModItems;
|
||||
import com.zixiken.dimdoors.shared.tileentities.TileEntityRift;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
|
@ -163,7 +163,7 @@ public class RenderRift extends TileEntitySpecialRenderer<TileEntityRift> {
|
|||
GlStateManager.scale(0.25,0.25,0.25);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer worldRenderer = tessellator.getBuffer();
|
||||
BufferBuilder worldRenderer = tessellator.getBuffer();
|
||||
|
||||
for (int i = 0; i < tesseract.length; i+=4) {
|
||||
worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
|
||||
|
@ -196,7 +196,7 @@ public class RenderRift extends TileEntitySpecialRenderer<TileEntityRift> {
|
|||
z * TrigMath.sin(angle) + w * TrigMath.cos(angle));
|
||||
}
|
||||
|
||||
private void project(VertexBuffer buffer, Vector4f vector, int u, int v) {
|
||||
private void project(BufferBuilder buffer, Vector4f vector, int u, int v) {
|
||||
double scalar = 1d/(vector.getW()+1d);
|
||||
Vector3f center = Vector3f.from(0.5f);
|
||||
Vector3f vector1 = vector.toVector3().mul(scalar);
|
||||
|
|
|
@ -9,12 +9,13 @@ import com.zixiken.dimdoors.shared.tileentities.TileEntityTransTrapdoor;
|
|||
import net.minecraft.block.BlockTrapDoor;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GLAllocation;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.renderer.vertex.VertexBuffer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
@ -100,7 +101,7 @@ public class RenderTransTrapdoor extends TileEntitySpecialRenderer<TileEntityTra
|
|||
}
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer worldrenderer = tessellator.getBuffer();
|
||||
BufferBuilder worldrenderer = tessellator.getBuffer();
|
||||
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
|
||||
|
||||
if (BlockTransTrapdoor.isTrapdoorSetLow(state)) {
|
||||
|
|
|
@ -7,7 +7,7 @@ package com.zixiken.dimdoors.shared;
|
|||
|
||||
import java.io.File;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldSavedData;
|
||||
import net.minecraft.world.storage.WorldSavedData;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -16,7 +16,6 @@ import net.minecraft.network.play.server.SPacketPlayerPosLook;
|
|||
import net.minecraft.network.play.server.SPacketRespawn;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.server.management.PlayerList;
|
||||
import net.minecraft.stats.AchievementList;
|
||||
|
||||
//ref: https://github.com/WayofTime/BloodMagic/blob/1.11/src/main/java/WayofTime/bloodmagic/ritual/portal/Teleports.java
|
||||
public class TeleporterDimDoors extends Teleporter {
|
||||
|
@ -99,11 +98,11 @@ public class TeleporterDimDoors extends Teleporter {
|
|||
player.isDead = false;
|
||||
|
||||
//Placing the player in the new world
|
||||
oldWorldserver.theProfiler.startSection("moving");
|
||||
oldWorldserver.profiler.startSection("moving");
|
||||
player.setLocationAndAngles(pos.getX() + 0.5, pos.getY() + 0.05, pos.getZ() + 0.5, playerRotationYaw, player.rotationPitch);
|
||||
oldWorldserver.theProfiler.endSection();
|
||||
oldWorldserver.profiler.endSection();
|
||||
|
||||
oldWorldserver.theProfiler.startSection("placing");
|
||||
oldWorldserver.profiler.startSection("placing");
|
||||
if (player.isEntityAlive()) {
|
||||
DimDoors.log(this.getClass(), "Placing the player entity at " + pos.toString());
|
||||
player.setLocationAndAngles(pos.getX() + 0.5, pos.getY() + 0.05, pos.getZ() + 0.5, playerRotationYaw, player.rotationPitch);
|
||||
|
@ -112,7 +111,7 @@ public class TeleporterDimDoors extends Teleporter {
|
|||
newWorldserver.spawnEntity(player);
|
||||
newWorldserver.updateEntityWithOptionalForce(player, false);
|
||||
}
|
||||
oldWorldserver.theProfiler.endSection();
|
||||
oldWorldserver.profiler.endSection();
|
||||
|
||||
player.setWorld(newWorldserver);
|
||||
|
||||
|
@ -148,12 +147,12 @@ public class TeleporterDimDoors extends Teleporter {
|
|||
PlayerList playerList = player.mcServer.getPlayerList();
|
||||
|
||||
player.dismountRidingEntity();
|
||||
worldserver.theProfiler.startSection("moving");
|
||||
worldserver.profiler.startSection("moving");
|
||||
player.setLocationAndAngles(pos.getX() + 0.5, pos.getY() + 0.05, pos.getZ() + 0.5, playerRotationYaw, player.rotationPitch);
|
||||
//playerList.preparePlayer(player, worldserver); //This makes the player stutter heavily on teleport
|
||||
player.connection.setPlayerLocation(pos.getX() + 0.5, pos.getY() + 0.05, pos.getZ() + 0.5, playerRotationYaw, player.rotationPitch, EnumSet.<SPacketPlayerPosLook.EnumFlags>noneOf(SPacketPlayerPosLook.EnumFlags.class
|
||||
));
|
||||
worldserver.theProfiler.endSection();
|
||||
worldserver.profiler.endSection();
|
||||
player.connection.sendPacket(new SPacketPlayerAbilities(player.capabilities));
|
||||
|
||||
} else {
|
||||
|
@ -166,7 +165,7 @@ public class TeleporterDimDoors extends Teleporter {
|
|||
}
|
||||
|
||||
private void processAchievements(EntityPlayerMP player, int dimID) {
|
||||
if (player.dimension == 1 && dimID == 1) {
|
||||
/*if (player.dimension == 1 && dimID == 1) {
|
||||
player.world.removeEntity(player);
|
||||
|
||||
if (!player.playerConqueredTheEnd) {
|
||||
|
@ -183,6 +182,6 @@ public class TeleporterDimDoors extends Teleporter {
|
|||
player.addStat(AchievementList.THE_END);
|
||||
} else if (dimID == -1) {
|
||||
player.addStat(AchievementList.PORTAL);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,11 +47,10 @@ public abstract class BlockDimDoorBase extends BlockDoor implements IDimDoor, IT
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
if (!checkCanOpen(world, pos, player)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (state.getValue(BlockDoor.HALF) == EnumDoorHalf.UPPER) {
|
||||
pos = pos.down();
|
||||
state = world.getBlockState(pos);
|
||||
|
|
|
@ -25,6 +25,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.Explosion;
|
||||
|
@ -106,9 +107,9 @@ public class BlockFabric extends Block {
|
|||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> subItems) {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
subItems.add(new ItemStack(itemIn, 1, i));
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
||||
for(BlockFabric.EnumType type : EnumType.values()) {
|
||||
subItems.add(new ItemStack(this, 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,7 +137,6 @@ public class BlockFabric extends Block {
|
|||
* @param state the state this block is in
|
||||
* @param player the player right-clicking the block
|
||||
* @param hand the hand the player is using
|
||||
* @param heldItem the item the player is holding in that hand
|
||||
* @param side the side of the block that is being clicked
|
||||
* @param hitX the x coordinate of the exact place the player is clicking on
|
||||
* the block
|
||||
|
@ -146,7 +146,9 @@ public class BlockFabric extends Block {
|
|||
* not?
|
||||
*/
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
ItemStack heldItem = player.getHeldItem(hand);
|
||||
|
||||
if (heldItem != null && heldItem.getItem() instanceof ItemBlock
|
||||
&& (state.getValue(TYPE).equals(EnumType.REALITY) || state.getValue(TYPE).equals(EnumType.ALTERED))) {
|
||||
Block block = Block.getBlockFromItem(heldItem.getItem());
|
||||
|
@ -157,9 +159,9 @@ public class BlockFabric extends Block {
|
|||
}
|
||||
if (!world.isRemote) { //@todo on a server, returning false or true determines where the block gets placed?
|
||||
if (!player.isCreative()) {
|
||||
heldItem.stackSize--;
|
||||
heldItem.setCount(heldItem.getCount()-1);
|
||||
}
|
||||
world.setBlockState(pos, block.getStateForPlacement(world, pos, side, hitX, hitY, hitZ, heldItem.getMetadata(), player, heldItem)); //choosing getStateForPlacement over getDefaultState, because it will cause directional blocks, like logs to rotate correctly
|
||||
world.setBlockState(pos, block.getStateForPlacement(world, pos, side, hitX, hitY, hitZ, heldItem.getMetadata(), player)); //choosing getStateForPlacement over getDefaultState, because it will cause directional blocks, like logs to rotate correctly
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -52,9 +52,9 @@ public class BlockTransTrapdoor extends BlockTrapDoor implements IDimDoor, ITile
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
return checkCanOpen(worldIn, pos, playerIn)
|
||||
&& super.onBlockActivated(worldIn, pos, state, playerIn, hand, heldItem, side, hitX, hitY, hitZ);
|
||||
&& super.onBlockActivated(worldIn, pos, state, playerIn, hand, side, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -66,7 +66,7 @@ public class MobMonolith extends EntityFlying implements IMob
|
|||
|
||||
@Override
|
||||
public boolean attackEntityFrom(DamageSource damageSource, float par2) {
|
||||
if (damageSource != DamageSource.inWall) {
|
||||
if (damageSource != DamageSource.IN_WALL) {
|
||||
this.aggro = MAX_AGGRO;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -9,6 +9,7 @@ import com.zixiken.dimdoors.shared.RayTraceHelper;
|
|||
import com.zixiken.dimdoors.shared.tileentities.TileEntityDimDoor;
|
||||
import com.zixiken.dimdoors.shared.tileentities.TileEntityRift;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemDoor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -44,7 +45,7 @@ public abstract class ItemDoorBase extends ItemDoor {
|
|||
}
|
||||
|
||||
@Override
|
||||
public abstract void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced);
|
||||
public abstract void addInformation(ItemStack stack, World world, List<String> tooltip, ITooltipFlag advanced);
|
||||
|
||||
/**
|
||||
* Overridden in subclasses to specify which door block that door item will
|
||||
|
@ -56,24 +57,26 @@ public abstract class ItemDoorBase extends ItemDoor {
|
|||
|
||||
//onItemUse gets fired before onItemRightClick and if it returns "success", onItemRightClick gets skipped.
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World worldIn, EntityPlayer playerIn, EnumHand hand) {
|
||||
if (worldIn.isRemote) {
|
||||
return new ActionResult(EnumActionResult.FAIL, stack);
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
|
||||
if (world.isRemote) {
|
||||
return new ActionResult<>(EnumActionResult.FAIL, stack);
|
||||
}
|
||||
RayTraceResult hit = rayTrace(worldIn, playerIn, true);
|
||||
if (RayTraceHelper.isRift(hit, worldIn)) {
|
||||
RayTraceResult hit = rayTrace(world, player, true);
|
||||
if (RayTraceHelper.isRift(hit, world)) {
|
||||
EnumActionResult canDoorBePlacedOnGroundBelowRift
|
||||
= tryPlaceDoorOnTopOfBlock(stack, playerIn, worldIn, hit.getBlockPos().down(2), hand,
|
||||
(float) hit.hitVec.xCoord, (float) hit.hitVec.yCoord, (float) hit.hitVec.zCoord); //stack may be changed by this method
|
||||
return new ActionResult(canDoorBePlacedOnGroundBelowRift, stack);
|
||||
= tryPlaceDoorOnTopOfBlock(stack, player, world, hit.getBlockPos().down(2), hand,
|
||||
(float) hit.hitVec.x, (float) hit.hitVec.y, (float) hit.hitVec.z); //stack may be changed by this method
|
||||
return new ActionResult<>(canDoorBePlacedOnGroundBelowRift, stack);
|
||||
}
|
||||
return new ActionResult(EnumActionResult.FAIL, stack); //@todo, should return onItemUse(params) here? will door placement on block not work otherwise?
|
||||
return new ActionResult<>(EnumActionResult.FAIL, stack); //@todo, should return onItemUse(params) here? will door placement on block not work otherwise?
|
||||
|
||||
//@todo personal and chaos doors can be placed on top of a rift? Should not be possible
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (world.isRemote) {
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
|
@ -87,7 +90,7 @@ public abstract class ItemDoorBase extends ItemDoor {
|
|||
pos = pos.offset(EnumFacing.DOWN); //the bottom part of the door can replace this block, so we will try to place it on the block under it
|
||||
}
|
||||
|
||||
return tryPlaceDoorOnTopOfBlock(stack, playerIn, world, pos, hand, hitX, hitY, hitZ);
|
||||
return tryPlaceDoorOnTopOfBlock(player.getHeldItem(hand), player, world, pos, hand, hitX, hitY, hitZ);
|
||||
}
|
||||
//pos = position of block, the door gets placed on
|
||||
|
||||
|
@ -121,7 +124,7 @@ public abstract class ItemDoorBase extends ItemDoor {
|
|||
SoundType soundtype = world.getBlockState(pos).getBlock().getSoundType(world.getBlockState(pos), world, pos, playerIn);
|
||||
world.playSound(playerIn, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F);
|
||||
if (!playerIn.isCreative()) {
|
||||
--stack.stackSize;
|
||||
stack.setCount(stack.getCount()-1);
|
||||
}
|
||||
|
||||
//fetch the TileEntityDimDoor at the top block of where the door has just been placed
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package com.zixiken.dimdoors.shared.items;
|
||||
|
||||
import com.zixiken.dimdoors.DimDoors;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -20,7 +22,7 @@ public class ItemLinkSignature extends Item {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List<String> list, boolean advanced) {
|
||||
public void addInformation(ItemStack stack, World world, List<String> list, ITooltipFlag advanced) {
|
||||
translateAndAdd("info.riftSignature.unbound", list);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.zixiken.dimdoors.shared.util.Location;
|
|||
import com.zixiken.dimdoors.shared.RayTraceHelper;
|
||||
import com.zixiken.dimdoors.shared.TeleporterDimDoors;
|
||||
import com.zixiken.dimdoors.shared.tileentities.TileEntityRift;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemSword;
|
||||
|
@ -47,9 +48,11 @@ public class ItemRiftBlade extends ItemSword {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) {
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
|
||||
if (world.isRemote) {
|
||||
return new ActionResult(EnumActionResult.FAIL, stack);
|
||||
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);
|
||||
|
@ -59,21 +62,21 @@ public class ItemRiftBlade extends ItemSword {
|
|||
rift.teleportingEntity = player;
|
||||
|
||||
stack.damageItem(1, player);
|
||||
return new ActionResult(EnumActionResult.SUCCESS, stack);
|
||||
return new ActionResult<>(EnumActionResult.SUCCESS, stack);
|
||||
|
||||
} else if (RayTraceHelper.isLivingEntity(hit)) {
|
||||
EnumActionResult teleportResult = TeleporterDimDoors.instance().teleport(player, new Location(world, hit.getBlockPos())) ? EnumActionResult.SUCCESS : EnumActionResult.FAIL; //@todo teleport to a location 1 or 2 blocks distance from the entity
|
||||
if (teleportResult == EnumActionResult.SUCCESS) {
|
||||
stack.damageItem(1, player);
|
||||
}
|
||||
return new ActionResult(teleportResult, stack);
|
||||
return new ActionResult<>(teleportResult, stack);
|
||||
}
|
||||
|
||||
return new ActionResult(EnumActionResult.FAIL, stack);
|
||||
return new ActionResult<>(EnumActionResult.FAIL, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List<String> list, boolean advanced) {
|
||||
public void addInformation(ItemStack stack, World world, List<String> list, ITooltipFlag advanced) {
|
||||
DimDoors.translateAndAdd("info.riftblade", list);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,9 +38,11 @@ public class ItemRiftConnectionTool extends ItemTool {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World worldIn, EntityPlayer playerIn, EnumHand hand) {
|
||||
if (worldIn.isRemote) {
|
||||
return new ActionResult(EnumActionResult.FAIL, stack);
|
||||
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
|
||||
if (world.isRemote) {
|
||||
return new ActionResult<>(EnumActionResult.FAIL, stack);
|
||||
}
|
||||
if (!stack.hasTagCompound()) {
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
|
@ -48,17 +50,17 @@ public class ItemRiftConnectionTool extends ItemTool {
|
|||
stack.setTagCompound(compound);
|
||||
}
|
||||
|
||||
RayTraceResult hit = rayTrace(worldIn, playerIn, true);
|
||||
if (RayTraceHelper.isAbstractRift(hit, worldIn)) {
|
||||
DDTileEntityBase rift = (DDTileEntityBase) worldIn.getTileEntity(hit.getBlockPos());
|
||||
if (playerIn.isSneaking()) {
|
||||
return selectRift(stack, worldIn, rift, playerIn); //new ActionResult(EnumActionResult.PASS, stack));
|
||||
RayTraceResult hit = rayTrace(world, player, true);
|
||||
if (RayTraceHelper.isAbstractRift(hit, world)) {
|
||||
DDTileEntityBase rift = (DDTileEntityBase) world.getTileEntity(hit.getBlockPos());
|
||||
if (player.isSneaking()) {
|
||||
return selectRift(stack, world, rift, player); //new ActionResult(EnumActionResult.PASS, stack));
|
||||
}
|
||||
} else {
|
||||
return changeMode(stack, playerIn);
|
||||
return changeMode(stack, player);
|
||||
}
|
||||
|
||||
return new ActionResult(EnumActionResult.FAIL, stack);
|
||||
return new ActionResult<>(EnumActionResult.FAIL, stack);
|
||||
}
|
||||
|
||||
private ActionResult<ItemStack> selectRift(ItemStack stack, World worldIn, DDTileEntityBase rift, EntityPlayer playerIn) {
|
||||
|
@ -100,6 +102,6 @@ public class ItemRiftConnectionTool extends ItemTool {
|
|||
}
|
||||
DimDoors.chat(player, "Connection tool mode set to: "
|
||||
+ (compound.getBoolean("isInConnectMode") ? "Connect" : "Disconnect"));
|
||||
return new ActionResult(EnumActionResult.SUCCESS, stack);
|
||||
return new ActionResult<>(EnumActionResult.SUCCESS, stack);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.zixiken.dimdoors.shared.world;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
import net.minecraft.client.renderer.*;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.vertex.*;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
@ -48,9 +47,9 @@ public class CustomSkyProvider extends IRenderHandler {
|
|||
if (mc.world.provider.isSurfaceWorld()) {
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
final Vec3d vec3 = world.getSkyColor(mc.getRenderViewEntity(), par1);
|
||||
float f1 = (float) vec3.xCoord;
|
||||
float f2 = (float) vec3.yCoord;
|
||||
float f3 = (float) vec3.zCoord;
|
||||
float f1 = (float) vec3.x;
|
||||
float f2 = (float) vec3.y;
|
||||
float f3 = (float) vec3.z;
|
||||
float f4;
|
||||
|
||||
if (mc.gameSettings.anaglyph) {
|
||||
|
@ -64,7 +63,7 @@ public class CustomSkyProvider extends IRenderHandler {
|
|||
|
||||
GL11.glColor3f(f1, f2, f3);
|
||||
final Tessellator tessellator = Tessellator.getInstance();
|
||||
final VertexBuffer buffer = tessellator.getBuffer();
|
||||
final BufferBuilder buffer = tessellator.getBuffer();
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glEnable(GL11.GL_FOG);
|
||||
GL11.glColor3f(f1, f2, f3);
|
||||
|
@ -167,7 +166,7 @@ public class CustomSkyProvider extends IRenderHandler {
|
|||
GL11.glPopMatrix();
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glColor3f(0.0F, 0.0F, 0.0F);
|
||||
double d0 = mc.player.getLook(par1).yCoord - world.getHorizon();
|
||||
double d0 = mc.player.getLook(par1).y - world.getHorizon();
|
||||
|
||||
if (d0 < 0.0D) {
|
||||
GL11.glPushMatrix();
|
||||
|
|
|
@ -9,9 +9,9 @@ public class DimDoorsBiome extends Biome
|
|||
{
|
||||
public DimDoorsBiome(String name) {
|
||||
super(new BiomeProperties(name));
|
||||
this.theBiomeDecorator.treesPerChunk = 0;
|
||||
this.theBiomeDecorator.flowersPerChunk = 0;
|
||||
this.theBiomeDecorator.grassPerChunk = 0;
|
||||
this.decorator.treesPerChunk = 0;
|
||||
this.decorator.flowersPerChunk = 0;
|
||||
this.decorator.grassPerChunk = 0;
|
||||
|
||||
this.spawnableMonsterList.clear();
|
||||
this.spawnableCreatureList.clear();
|
||||
|
|
|
@ -105,8 +105,8 @@ public class LimboDecay {
|
|||
//Loop through each chunk section and fast-decay a random block
|
||||
//Apply the changes using the world object instead of directly to the chunk so that clients are always notified.
|
||||
for (sectionY = 0; sectionY < limboHeight; sectionY += SECTION_HEIGHT) {
|
||||
BlockPos pos = new BlockPos(chunkPos.chunkXPos * CHUNK_SIZE + random.nextInt(CHUNK_SIZE),
|
||||
chunkPos.chunkZPos * CHUNK_SIZE + random.nextInt(CHUNK_SIZE),
|
||||
BlockPos pos = new BlockPos(chunkPos.x * CHUNK_SIZE + random.nextInt(CHUNK_SIZE),
|
||||
chunkPos.z * CHUNK_SIZE + random.nextInt(CHUNK_SIZE),
|
||||
sectionY + random.nextInt(SECTION_HEIGHT));
|
||||
decayBlockFast(world, pos);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import net.minecraft.world.World;
|
|||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.chunk.ChunkPrimer;
|
||||
import net.minecraft.world.chunk.IChunkGenerator;
|
||||
import net.minecraft.world.gen.IChunkGenerator;
|
||||
import net.minecraft.world.gen.NoiseGeneratorOctaves;
|
||||
import net.minecraft.world.gen.structure.MapGenScatteredFeature;
|
||||
|
||||
|
@ -107,8 +107,7 @@ public class LimboGenerator implements IChunkGenerator
|
|||
}
|
||||
|
||||
@Override
|
||||
public Chunk provideChunk(int chunkX, int chunkZ)
|
||||
{
|
||||
public Chunk generateChunk(int chunkX, int chunkZ) {
|
||||
//TODO: Wtf? Why do you reinitialize the seed when we already initialized it in the constructor?! ~SenseiKiwi
|
||||
LimboGenerator.rand.setSeed(chunkX * 341873128712L + chunkZ * 132897987541L);
|
||||
ChunkPrimer primer = new ChunkPrimer();
|
||||
|
@ -335,7 +334,7 @@ public class LimboGenerator implements IChunkGenerator
|
|||
|
||||
@Nullable
|
||||
@Override
|
||||
public BlockPos getStrongholdGen(World worldIn, String structureName, BlockPos position) {
|
||||
public BlockPos getNearestStructurePos(World worldIn, String structureName, BlockPos position, boolean findUnexplored) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -343,4 +342,9 @@ public class LimboGenerator implements IChunkGenerator
|
|||
public void recreateStructures(Chunk chunkIn, int x, int z) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInsideStructure(World worldIn, String structureName, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -15,7 +15,7 @@ import net.minecraft.world.DimensionType;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldProvider;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.chunk.IChunkGenerator;
|
||||
import net.minecraft.world.gen.IChunkGenerator;
|
||||
import net.minecraftforge.client.IRenderHandler;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
@ -25,7 +25,7 @@ public class WorldProviderLimbo extends WorldProvider {
|
|||
//private CustomLimboPopulator spawner;
|
||||
|
||||
public WorldProviderLimbo() {
|
||||
this.hasNoSky = false;
|
||||
this.hasSkyLight = false;
|
||||
this.skyRenderer = new LimboSkyProvider();
|
||||
//this.spawner
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import net.minecraft.world.World;
|
|||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.chunk.ChunkPrimer;
|
||||
import net.minecraft.world.chunk.IChunkGenerator;
|
||||
import net.minecraft.world.gen.IChunkGenerator;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
|
@ -24,7 +24,7 @@ public class PocketChunkGenerator implements IChunkGenerator {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Chunk provideChunk(int chunkX, int chunkZ) {
|
||||
public Chunk generateChunk(int chunkX, int chunkZ) {
|
||||
ChunkPrimer primer = new ChunkPrimer();
|
||||
Chunk chunk = new Chunk(worldObj, primer, chunkX, chunkZ);
|
||||
|
||||
|
@ -52,7 +52,7 @@ public class PocketChunkGenerator implements IChunkGenerator {
|
|||
|
||||
@Nullable
|
||||
@Override
|
||||
public BlockPos getStrongholdGen(World worldIn, String structureName, BlockPos position) {
|
||||
public BlockPos getNearestStructurePos(World worldIn, String structureName, BlockPos position, boolean findUnexplored) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -60,4 +60,9 @@ public class PocketChunkGenerator implements IChunkGenerator {
|
|||
public void recreateStructures(Chunk chunkIn, int x, int z) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInsideStructure(World worldIn, String structureName, BlockPos pos) {
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.DimensionType;
|
||||
import net.minecraft.world.WorldProvider;
|
||||
import net.minecraft.world.chunk.IChunkGenerator;
|
||||
import net.minecraft.world.gen.IChunkGenerator;
|
||||
import net.minecraftforge.client.IRenderHandler;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
@ -20,7 +20,7 @@ public class WorldProviderPublicPocket extends WorldProvider {//@todo, we might
|
|||
protected IRenderHandler skyRenderer;
|
||||
|
||||
public WorldProviderPublicPocket() {
|
||||
this.hasNoSky = true;
|
||||
this.hasSkyLight = true;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
|
Loading…
Add table
Reference in a new issue