Added models for the RS panel connector

Fixed every block dropping the meta=0 version
This commit is contained in:
malte0811 2017-04-24 17:26:42 +02:00
parent 3739fc127c
commit d02981e14d
8 changed files with 258 additions and 19 deletions

View file

@ -212,5 +212,9 @@ public abstract class BlockIWBase extends Block {
return false;
}
@Override
public int damageDropped(IBlockState state) {
return getMetaFromState(state);
}
protected abstract IProperty[] getProperties();
}

View file

@ -36,6 +36,7 @@ import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.property.ExtendedBlockState;
@ -84,7 +85,7 @@ public class BlockPanel extends BlockIWBase implements IMetaEnum {
@Override
protected IProperty<?>[] getProperties() {
return new IProperty[]{IEProperties.FACING_HORIZONTAL, type};
return new IProperty[]{IEProperties.FACING_ALL, type};
}
@Override
@ -183,4 +184,15 @@ public class BlockPanel extends BlockIWBase implements IMetaEnum {
}
return state.getValue(type)==BlockTypes_Panel.TOP;
}
@Override
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
if (state.getValue(type)==BlockTypes_Panel.TOP) {
TileEntity te = world.getTileEntity(pos);
if (te instanceof TileEntityPanel) {
return ((TileEntityPanel) te).getTileDrop(player, state);
}
}
return super.getPickBlock(state, target, world, pos, player);
}
}

View file

@ -25,13 +25,16 @@ import blusunrize.immersiveengineering.api.energy.wires.TileEntityImmersiveConne
import blusunrize.immersiveengineering.api.energy.wires.WireType;
import blusunrize.immersiveengineering.api.energy.wires.redstone.IRedstoneConnector;
import blusunrize.immersiveengineering.api.energy.wires.redstone.RedstoneWireNetwork;
import blusunrize.immersiveengineering.common.blocks.IEBlockInterfaces;
import malte0811.industrialWires.blocks.INetGUI;
import malte0811.industrialWires.controlpanel.PanelComponent;
import malte0811.industrialWires.util.MiscUtils;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ITickable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
@ -43,12 +46,13 @@ import java.util.*;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
public class TileEntityRSPanelConn extends TileEntityImmersiveConnectable implements IRedstoneConnector, ITickable, INetGUI {
public class TileEntityRSPanelConn extends TileEntityImmersiveConnectable implements IRedstoneConnector, ITickable, INetGUI, IEBlockInterfaces.IDirectionalTile {
private byte[] out = new byte[16];
private boolean dirty = true;
private byte[] oldInput = new byte[16];
private Set<Consumer<byte[]>> changeListeners = new HashSet<>();
private Set<TileEntityPanel> connectedPanels = new HashSet<>();
private EnumFacing facing = EnumFacing.NORTH;
@Nonnull
private RedstoneWireNetwork network = new RedstoneWireNetwork().add(this);
private boolean hasConn = false;
@ -87,6 +91,7 @@ public class TileEntityRSPanelConn extends TileEntityImmersiveConnectable implem
out.setByteArray("out", this.out);
out.setBoolean("hasConn", hasConn);
out.setInteger("rsId", id);
out.setInteger("facing", facing.getIndex());
}
@Override
@ -95,6 +100,7 @@ public class TileEntityRSPanelConn extends TileEntityImmersiveConnectable implem
out = in.getByteArray("out");
hasConn = in.getBoolean("hasConn");
id = in.getInteger("rsId");
facing = EnumFacing.VALUES[in.getInteger("facing")];
}
private BiConsumer<Integer, Byte> rsOut = (channel, value)->{
@ -201,12 +207,15 @@ public class TileEntityRSPanelConn extends TileEntityImmersiveConnectable implem
@Override
public Vec3d getRaytraceOffset(IImmersiveConnectable other) {
return new Vec3d(.5, .5, .5);//TODO better values
EnumFacing side = facing.getOpposite();
return new Vec3d(.5 + side.getFrontOffsetX() * .0625, .5 + side.getFrontOffsetY() * .0625, .5 + side.getFrontOffsetZ() * .0625);
}
@Override
public Vec3d getConnectionOffset(ImmersiveNetHandler.Connection connection) {
return new Vec3d(.5, .5, .5);//TODO better values
EnumFacing side = facing.getOpposite();
double conRadius = connection.cableType.getRenderDiameter() / 2;
return new Vec3d(.5 - conRadius * side.getFrontOffsetX(), .5 - conRadius * side.getFrontOffsetY(), .5 - conRadius * side.getFrontOffsetZ());
}
@Override
@ -257,4 +266,34 @@ public class TileEntityRSPanelConn extends TileEntityImmersiveConnectable implem
public int getRsId() {
return id;
}
@Override
public EnumFacing getFacing() {
return facing;
}
@Override
public void setFacing(EnumFacing facing) {
this.facing = facing;
}
@Override
public int getFacingLimitation() {
return 0;
}
@Override
public boolean mirrorFacingOnPlacement(EntityLivingBase placer) {
return true;
}
@Override
public boolean canHammerRotate(EnumFacing side, float hitX, float hitY, float hitZ, EntityLivingBase entity) {
return false;
}
@Override
public boolean canRotate(EnumFacing axis) {
return false;
}
}

View file

@ -103,6 +103,7 @@ public class ClientProxy extends CommonProxy {
ConnLoader.textureReplacements.put("ic2_relay_glass", ImmutableMap.of("#immersiveengineering:blocks/connector_relayHV",
IndustrialWires.MODID + ":blocks/ic2_relayGlass"));
ConnLoader.baseModels.put("rs_panel_conn", new ResourceLocation("industrialwires:block/rs_panel_conn.obj"));
for (int meta = 0; meta < ItemIC2Coil.subNames.length; meta++) {
ResourceLocation loc = new ResourceLocation(IndustrialWires.MODID, "ic2wireCoil/" + ItemIC2Coil.subNames[meta]);
ModelBakery.registerItemVariants(IndustrialWires.coil, loc);

View file

@ -11,24 +11,49 @@
}
},
"variants": {
"facing":
{
"north": { "transform": {
"rotation": {"y": 0 }
}},
"south": { "transform": {
"rotation": {"y": 180 }
}},
"west": { "transform": {
"rotation": {"y": 90 }
}},
"east": { "transform": {
"rotation": {"y": -90 }
}}
"facing": {
"down": {
},
"up": {
"transform": {
"rotation": {
"z": 180
}
}
},
"north": {
"transform": {
"rotation": {
"x": 90
}
}
},
"south": {
"transform": {
"rotation": {
"x": -90
}
}
},
"west": {
"transform": {
"rotation": {
"z": -90
}
}
},
"east": {
"transform": {
"rotation": {
"z": 90
}
}
}
},
"type": {
"rs_wire": {
"model": "immersiveengineering:smartmodel/conn_ic2_conn_gold"
"model": "immersiveengineering:smartmodel/conn_rs_panel_conn"
},
"top": {
"model": "industrialwires:smartmodel/panel_normal"

View file

@ -0,0 +1,2 @@
newmtl conn
map_Ka industrialwires:blocks/rs_panel_conn

View file

@ -0,0 +1,156 @@
mtllib rs_panel_conn.mtl
usemtl conn
o conn
v 0.000000 0.000000 1.000000
v 0.000000 0.125000 1.000000
v 0.000000 0.000000 0.000000
v 0.000000 0.125000 0.000000
v 1.000000 0.000000 1.000000
v 1.000000 0.125000 1.000000
v 1.000000 0.000000 0.000000
v 1.000000 0.125000 0.000000
v 0.625000 0.187500 0.375000
v 0.625000 0.187500 0.625000
v 0.625000 0.125000 0.625000
v 0.625000 0.125000 0.375000
v 0.375000 0.187500 0.625000
v 0.375000 0.187500 0.375000
v 0.375000 0.125000 0.375000
v 0.375000 0.125000 0.625000
v 0.375000 0.312500 0.375000
v 0.375000 0.312500 0.625000
v 0.375000 0.562500 0.625000
v 0.375000 0.562500 0.375000
v 0.625000 0.312500 0.375000
v 0.375000 0.562500 0.375000
v 0.625000 0.562500 0.375000
v 0.625000 0.312500 0.625000
v 0.625000 0.562500 0.375000
v 0.625000 0.562500 0.625000
v 0.625000 0.562500 0.625000
v 0.375000 0.562500 0.625000
v 0.375000 0.562500 0.375000
v 0.375000 0.562500 0.625000
v 0.625000 0.562500 0.625000
v 0.625000 0.562500 0.375000
v 0.312500 0.312500 0.687500
v 0.312500 0.312500 0.312500
v 0.312500 0.187500 0.312500
v 0.312500 0.187500 0.687500
v 0.687500 0.312500 0.312500
v 0.687500 0.187500 0.312500
v 0.687500 0.312500 0.687500
v 0.687500 0.187500 0.687500
v 0.687500 0.312500 0.687500
v 0.687500 0.312500 0.312500
v 0.312500 0.312500 0.312500
v 0.312500 0.312500 0.687500
v 0.687500 0.187500 0.312500
v 0.687500 0.187500 0.687500
v 0.312500 0.187500 0.687500
v 0.312500 0.187500 0.312500
vt 1.0000 0.0625
vt 0.5000 0.0625
vt 0.5000 0.0000
vt 1.0000 0.0000
vt 1.0000 0.0625
vt 0.5000 0.0625
vt 0.5000 0.0000
vt 1.0000 0.0000
vt 0.5000 0.0625
vt 1.0000 0.0000
vt 1.0000 0.0625
vt 0.5000 0.0625
vt 0.5000 0.0000
vt 1.0000 0.0000
vt 0.5000 0.5000
vt 0.5000 0.0000
vt 1.0000 0.0000
vt 1.0000 0.5000
vt 1.0000 0.0000
vt 1.0000 0.5000
vt 0.5000 0.5000
vt 0.3125 0.2812
vt 0.1875 0.2812
vt 0.1875 0.2500
vt 0.3125 0.2500
vt 0.1875 0.2500
vt 0.3125 0.2500
vt 0.3125 0.2812
vt 0.1875 0.2812
vt 0.3125 0.2812
vt 0.1875 0.2812
vt 0.1875 0.2500
vt 0.3125 0.2500
vt 0.1875 0.2500
vt 0.3125 0.2500
vt 0.3125 0.2812
vt 0.1875 0.2812
vt 0.1875 0.3438
vt 0.1875 0.4688
vt 0.3125 0.4688
vt 0.3125 0.3438
vt 0.3125 0.3438
vt 0.1875 0.4688
vt 0.3125 0.4688
vt 0.1875 0.3438
vt 0.3125 0.4688
vt 0.1875 0.4688
vt 0.3125 0.3438
vt 0.1875 0.4688
vt 0.3125 0.4688
vt 0.3125 0.4688
vt 0.3125 0.3438
vt 0.4375 0.3438
vt 0.4375 0.4688
vt 0.3438 0.3438
vt 0.1562 0.3438
vt 0.1562 0.2812
vt 0.3438 0.2812
vt 0.3438 0.3438
vt 0.1562 0.3438
vt 0.1562 0.2812
vt 0.3438 0.2812
vt 0.3438 0.3438
vt 0.1562 0.3438
vt 0.1562 0.2812
vt 0.3438 0.2812
vt 0.3438 0.3438
vt 0.1562 0.3438
vt 0.1562 0.2812
vt 0.3438 0.2812
vt 0.3438 0.0000
vt 0.3438 0.1875
vt 0.1562 0.1875
vt 0.1562 0.0000
vt 0.3438 0.0000
vt 0.3438 0.1875
vt 0.1562 0.1875
vt 0.1562 0.0000
vn -1.0000 0.0000 0.0000
vn 0.0000 0.0000 -1.0000
vn 1.0000 0.0000 0.0000
vn 0.0000 0.0000 1.0000
vn 0.0000 -1.0000 0.0000
vn 0.0000 1.0000 0.0000
f 1/1/1 2/2/1 4/3/1 3/4/1
f 3/5/2 4/6/2 8/7/2 7/8/2
f 7/9/3 8/7/3 6/10/3 5/11/3
f 5/12/4 6/13/4 2/14/4 1/1/4
f 3/15/5 7/16/5 5/17/5 1/18/5
f 8/19/6 4/20/6 2/21/6 6/13/6
f 9/22/3 10/23/3 11/24/3 12/25/3
f 13/26/1 14/27/1 15/28/1 16/29/1
f 10/30/4 13/31/4 16/32/4 11/33/4
f 14/34/2 9/35/2 12/36/2 15/37/2
f 17/38/1 18/39/1 19/40/1 20/41/1
f 21/42/2 17/38/2 22/43/2 23/44/2
f 24/45/3 21/42/3 25/46/3 26/47/3
f 18/48/4 24/45/4 27/49/4 28/50/4
f 29/51/6 30/52/6 31/53/6 32/54/6
f 33/55/1 34/56/1 35/57/1 36/58/1
f 34/59/2 37/60/2 38/61/2 35/62/2
f 37/63/3 39/64/3 40/65/3 38/66/3
f 39/67/4 33/68/4 36/69/4 40/70/4
f 41/71/6 42/72/6 43/73/6 44/74/6
f 45/75/5 46/76/5 47/77/5 48/78/5

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB