Fixed some potential CME's

IC2 feedthrough connectors properly disassemble now
This commit is contained in:
malte0811 2018-04-06 18:25:46 +02:00
parent 12510ecc5b
commit 1959b93f5b
4 changed files with 32 additions and 19 deletions

View file

@ -165,7 +165,7 @@ public class IndustrialWires {
GameRegistry.registerTileEntity(TileEntityMechIEtoIC.class, MODID + ":mechIeToIc");
}
}
GameRegistry.registerTileEntity(TileEntityMultiblockConverter.class, MODID + ":mechMB");//TODO respect enableConversion!
GameRegistry.registerTileEntity(TileEntityMultiblockConverter.class, MODID + ":mechMB");
GameRegistry.registerTileEntity(TileEntityJacobsLadder.class, MODID + ":jacobsLadder");
GameRegistry.registerTileEntity(TileEntityMarx.class, MODID + ":marx_generator");
GameRegistry.registerTileEntity(TileEntityPanel.class, MODID + ":control_panel");
@ -235,31 +235,31 @@ public class IndustrialWires {
WireApi.registerFeedthroughForWiretype(TIN, new ResourceLocation("immersiveengineering:block/connector/connector_lv.obj"),
ImmutableMap.of("#immersiveengineering:blocks/connector_connector_lv",
IndustrialWires.MODID + ":blocks/ic2_conn_tin"), tex, uvs, .5, .5,
(state) -> state.getBlock() == ic2conn && state.getValue(BlockIC2Connector.TYPE) == TIN_CONN,
ic2conn.getDefaultState().withProperty(BlockIC2Connector.TYPE, TIN_CONN),
1/64F, TIN.getTransferRate(), f->(float)Math.ceil(f));
WireApi.registerFeedthroughForWiretype(COPPER_IC2, new ResourceLocation("immersiveengineering:block/connector/connector_lv.obj"),
ImmutableMap.of("#immersiveengineering:blocks/connector_connector_lv",
IndustrialWires.MODID + ":blocks/ic2_conn_copper"), tex, uvs, .5, .5,
(state) -> state.getBlock() == ic2conn && state.getValue(BlockIC2Connector.TYPE) == COPPER_CONN,
ic2conn.getDefaultState().withProperty(BlockIC2Connector.TYPE, COPPER_CONN),
1/64F, COPPER_IC2.getTransferRate(), f->(float)Math.ceil(f));
WireApi.registerFeedthroughForWiretype(GOLD, new ResourceLocation("immersiveengineering:block/connector/connector_mv.obj"),
ImmutableMap.of("#immersiveengineering:blocks/connector_connector_mv",
IndustrialWires.MODID + ":blocks/ic2_conn_gold"), tex, uvs, .5625, .5625,
(state) -> state.getBlock() == ic2conn && state.getValue(BlockIC2Connector.TYPE) == GOLD_CONN,
ic2conn.getDefaultState().withProperty(BlockIC2Connector.TYPE, GOLD_CONN),
1/64F, GOLD.getTransferRate(), f->(float)Math.ceil(f));
WireApi.registerFeedthroughForWiretype(HV, new ResourceLocation("immersiveengineering:block/connector/connector_hv.obj"),
ImmutableMap.of("#immersiveengineering:blocks/connector_connector_hv",
IndustrialWires.MODID + ":blocks/ic2_conn_hv"), tex, uvs, .75, .75,
(state) -> state.getBlock() == ic2conn && state.getValue(BlockIC2Connector.TYPE) == HV_CONN,
ic2conn.getDefaultState().withProperty(BlockIC2Connector.TYPE, HV_CONN),
1/64F, HV.getTransferRate(), f->(float)Math.ceil(f));
WireApi.registerFeedthroughForWiretype(GLASS, new ResourceLocation("immersiveengineering:block/connector/connector_hv.obj"),
ImmutableMap.of("#immersiveengineering:blocks/connector_connector_hv",
IndustrialWires.MODID + ":blocks/ic2_conn_glass"), tex, uvs, .75, .75,
(state) -> state.getBlock() == ic2conn && state.getValue(BlockIC2Connector.TYPE) == GLASS_CONN,
ic2conn.getDefaultState().withProperty(BlockIC2Connector.TYPE, GLASS_CONN),
1/64F, GLASS.getTransferRate(), f->(float)Math.ceil(f));
}
NetworkRegistry.INSTANCE.registerGuiHandler(instance, proxy);

View file

@ -117,7 +117,14 @@ public class BlockIC2Connector extends BlockIWBase implements IMetaEnum {
@Override
public TileEntity createTileEntity(@Nonnull World world, @Nonnull IBlockState state) {
switch (state.getValue(TYPE)) {
TileEntityIC2ConnectorTin base = getBaseTE(state.getValue(TYPE));
if (base!=null) {
base.facing = state.getValue(IEProperties.FACING_ALL);
}
return base;
}
private TileEntityIC2ConnectorTin getBaseTE(BlockTypes_IC2_Connector type) {
switch (type) {
case TIN_CONN:
return new TileEntityIC2ConnectorTin(false);
case TIN_RELAY:

View file

@ -17,6 +17,7 @@ package malte0811.industrialWires.network;
import io.netty.buffer.ByteBuf;
import malte0811.industrialWires.items.INetGUIItem;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -53,12 +54,14 @@ public class MessageItemSync implements IMessage {
public static class HandlerServer implements IMessageHandler<MessageItemSync, IMessage> {
@Override
public IMessage onMessage(MessageItemSync message, MessageContext ctx) {
EntityPlayer player = ctx.getServerHandler().player;
ItemStack held = player.getHeldItem(message.hand);
if (held.getItem() instanceof INetGUIItem) {
ctx.getServerHandler().player.getServerWorld().addScheduledTask(() ->
((INetGUIItem)held.getItem()).onChange(message.data, player, message.hand));
}
Minecraft.getMinecraft().addScheduledTask(()-> {
EntityPlayer player = ctx.getServerHandler().player;
ItemStack held = player.getHeldItem(message.hand);
if (held.getItem() instanceof INetGUIItem) {
ctx.getServerHandler().player.getServerWorld().addScheduledTask(() ->
((INetGUIItem) held.getItem()).onChange(message.data, player, message.hand));
}
});
return null;
}
}

View file

@ -18,6 +18,7 @@ package malte0811.industrialWires.network;
import io.netty.buffer.ByteBuf;
import malte0811.industrialWires.IndustrialWires;
import malte0811.industrialWires.blocks.ISyncReceiver;
import net.minecraft.client.Minecraft;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
@ -57,13 +58,15 @@ public class MessageTileSyncIW implements IMessage {
public static class HandlerClient implements IMessageHandler<MessageTileSyncIW, IMessage> {
@Override
public IMessage onMessage(MessageTileSyncIW message, MessageContext ctx) {
World world = IndustrialWires.proxy.getClientWorld();
if (world != null) {
TileEntity tile = world.getTileEntity(message.pos);
if (tile instanceof ISyncReceiver) {
((ISyncReceiver) tile).onSync(message.nbt);
Minecraft.getMinecraft().addScheduledTask(()-> {
World world = IndustrialWires.proxy.getClientWorld();
if (world != null) {
TileEntity tile = world.getTileEntity(message.pos);
if (tile instanceof ISyncReceiver) {
((ISyncReceiver) tile).onSync(message.nbt);
}
}
}
});
return null;
}
}