fixed the Jacob's Ladders breaking when trying to rotate them
fixed sharp rendering edges inside "salted" arcs
This commit is contained in:
malte0811 2017-03-06 16:36:02 +01:00
parent 59177870f1
commit c3d871aa37
5 changed files with 73 additions and 4 deletions

View file

@ -1,5 +1,23 @@
def mainVersion = "1.2"
def buildNumber = "6"
def mainVersion = "1.3"
def buildNumber = "7"
/*
* This file is part of Industrial Wires.
* Copyright (C) 2016-2017 malte0811
*
* Industrial Wires is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Industrial Wires is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Industrial Wires. If not, see <http://www.gnu.org/licenses/>.
*/
// For those who want the bleeding edge
buildscript {

View file

@ -1,3 +1,7 @@
#####Version 1.3-7
- added Jacob's Ladders/High voltage travelling arcs
- they don't have a particular purpose aside from looking nice
#####Version 1.2-6
- reduced the discrepancies between IC2 cables and Industrial Wires
- machines don't explode when they shouldn't except in some corner cases

View file

@ -205,7 +205,7 @@ public class BlockJacobsLadder extends Block implements IMetaEnum, IPlacementChe
min = new Vec3d(distZ, 0, distX);
max = new Vec3d(1 - distZ, h, 1 - distX);
}
return new AxisAlignedBB(min, max);
return new AxisAlignedBB(min.xCoord, min.yCoord, min.zCoord, max.xCoord, max.yCoord, max.zCoord);
}
}
@ -256,4 +256,21 @@ public class BlockJacobsLadder extends Block implements IMetaEnum, IPlacementChe
}
return true;
}
@Override
public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) {
TileEntity te = world.getTileEntity(pos);
return te instanceof TileEntityJacobsLadder && ((TileEntityJacobsLadder) te).rotate(world, pos, axis);
}
@Override
public boolean eventReceived(IBlockState state, World worldIn, BlockPos pos, int id, int param) {
boolean def = super.eventReceived(state, worldIn, pos, id, param);
if ((id&255)==255) {
IBlockState s = worldIn.getBlockState(pos);
worldIn.notifyBlockUpdate(pos, s, s, 3);
return true;
}
return def;
}
}

View file

@ -41,6 +41,7 @@ import net.minecraft.util.*;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.energy.CapabilityEnergy;
@ -304,6 +305,10 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl
}
public boolean isActive() {
if (isDummy()) {
TileEntity master = worldObj.getTileEntity(pos.down(dummy));
return master instanceof TileEntityJacobsLadder&&((TileEntityJacobsLadder) master).isActive();
}
return timeTillActive == 0 && t < 1;
}
@ -356,6 +361,30 @@ public class TileEntityJacobsLadder extends TileEntityIEBase implements ITickabl
return false;
}
public boolean rotate(World world, BlockPos pos, EnumFacing axis) {
if (isActive()) {
return false;
}
if (!worldObj.isRemote) {
EnumFacing targetDir = facing.rotateAround(EnumFacing.Axis.Y);
for (int i = -dummy;i<size.dummyCount-dummy+1;i++) {
BlockPos currPos = pos.up(i);
TileEntity te = world.getTileEntity(currPos);
if (te instanceof TileEntityJacobsLadder) {
TileEntityJacobsLadder teJacobs = (TileEntityJacobsLadder) te;
teJacobs.facing = targetDir;
teJacobs.markDirty();
IBlockState state = world.getBlockState(currPos).getActualState(world, currPos);
world.notifyBlockUpdate(currPos,state,state,3);
world.addBlockEvent(currPos, state.getBlock(), 255, 0);
world.notifyBlockOfStateChange(currPos, state.getBlock());
}
}
}
return true;
}
//ENERGY
@Override
public double getDemandedEnergy() {

View file

@ -45,6 +45,7 @@ public class TileRenderJacobsLadder extends TileEntitySpecialRenderer<TileEntity
GlStateManager.disableTexture2D();
GlStateManager.disableLighting();
GlStateManager.shadeModel(GL11.GL_SMOOTH);
float oldBX = OpenGlHelper.lastBrightnessX;
float oldBY = OpenGlHelper.lastBrightnessY;
@ -75,6 +76,7 @@ public class TileRenderJacobsLadder extends TileEntitySpecialRenderer<TileEntity
GlStateManager.enableTexture2D();
GlStateManager.enableLighting();
GlStateManager.shadeModel(GL11.GL_FLAT);
GlStateManager.popMatrix();
}
@ -99,7 +101,6 @@ public class TileRenderJacobsLadder extends TileEntitySpecialRenderer<TileEntity
drawQuad(last, pos, radZ, colors[i-1], colors[i], vertBuffer);
last = pos;
}
tes.draw();
}
private final float[] saltColor = {1, 190/255F, 50/255F};