Update to 1.12: Everything except recipes done. Probably quite buggy
This commit is contained in:
parent
f97bec3d44
commit
d0472b45b9
10
build.gradle
10
build.gradle
|
@ -11,7 +11,7 @@ buildscript {
|
|||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
|
||||
}
|
||||
}
|
||||
apply plugin: 'net.minecraftforge.gradle.forge'
|
||||
|
@ -30,11 +30,11 @@ sourceCompatibility = 1.8
|
|||
targetCompatibility = 1.8
|
||||
|
||||
minecraft {
|
||||
version = "13.20.0.2282"
|
||||
version = "14.21.1.2404"
|
||||
runDir = "run"
|
||||
|
||||
replace '${version}', project.version
|
||||
mappings = "snapshot_20170612"
|
||||
mappings = "snapshot_20170628"
|
||||
}
|
||||
|
||||
repositories {
|
||||
|
@ -49,8 +49,8 @@ repositories {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
compile "net.industrial-craft:industrialcraft-2:2.7.+"
|
||||
deobfCompile "blusunrize:ImmersiveEngineering:0.11-+:deobf"
|
||||
compile "net.industrial-craft:industrialcraft-2:2.8.+"
|
||||
deobfCompile "blusunrize:ImmersiveEngineering:0.12-+:deobf"
|
||||
}
|
||||
|
||||
jar {
|
||||
|
|
|
@ -32,7 +32,9 @@ import net.minecraft.util.EnumHand;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.network.IGuiHandler;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
public class CommonProxy implements IGuiHandler {
|
||||
public void preInit() {
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
*/
|
||||
package malte0811.industrialWires;
|
||||
|
||||
import malte0811.industrialWires.blocks.BlockIWBase;
|
||||
import malte0811.industrialWires.blocks.BlockJacobsLadder;
|
||||
import malte0811.industrialWires.blocks.TileEntityJacobsLadder;
|
||||
import malte0811.industrialWires.blocks.controlpanel.*;
|
||||
|
@ -25,6 +26,7 @@ import malte0811.industrialWires.blocks.converter.TileEntityIEMotor;
|
|||
import malte0811.industrialWires.blocks.converter.TileEntityMechICtoIE;
|
||||
import malte0811.industrialWires.blocks.converter.TileEntityMechIEtoIC;
|
||||
import malte0811.industrialWires.blocks.wire.*;
|
||||
import malte0811.industrialWires.controlpanel.PanelUtils;
|
||||
import malte0811.industrialWires.items.ItemIC2Coil;
|
||||
import malte0811.industrialWires.items.ItemKey;
|
||||
import malte0811.industrialWires.items.ItemPanelComponent;
|
||||
|
@ -33,33 +35,49 @@ import malte0811.industrialWires.network.MessageItemSync;
|
|||
import malte0811.industrialWires.network.MessagePanelInteract;
|
||||
import malte0811.industrialWires.network.MessageTileSyncIW;
|
||||
import malte0811.industrialWires.wires.IC2Wiretype;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLMissingMappingsEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Mod(modid = IndustrialWires.MODID, version = IndustrialWires.VERSION, dependencies = "required-after:immersiveengineering@[0.10-58,);required-after:ic2")
|
||||
@Mod.EventBusSubscriber
|
||||
public class IndustrialWires {
|
||||
public static final String MODID = "industrialwires";
|
||||
public static final String VERSION = "${version}";
|
||||
|
||||
public static final List<BlockIWBase> blocks = new ArrayList<>();
|
||||
public static final List<Item> items = new ArrayList<>();
|
||||
|
||||
public static BlockIC2Connector ic2conn;
|
||||
public static BlockMechanicalConverter mechConv;
|
||||
public static BlockJacobsLadder jacobsLadder;
|
||||
public static BlockPanel panel;
|
||||
public static ItemIC2Coil coil;
|
||||
public static ItemPanelComponent panelComponent;
|
||||
public static ItemKey key;
|
||||
|
||||
|
||||
public static final ItemIC2Coil coil = new ItemIC2Coil();
|
||||
public static final ItemPanelComponent panelComponent = new ItemPanelComponent();
|
||||
public static final ItemKey key = new ItemKey();
|
||||
public static final SimpleNetworkWrapper packetHandler = NetworkRegistry.INSTANCE.newSimpleChannel(MODID);
|
||||
|
||||
public static Logger logger;
|
||||
@Mod.Instance(MODID)
|
||||
public static IndustrialWires instance = new IndustrialWires();
|
||||
public static CreativeTabs creativeTab = new CreativeTabs(MODID) {
|
||||
|
@ -74,17 +92,15 @@ public class IndustrialWires {
|
|||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent e) {
|
||||
logger = e.getModLog();
|
||||
new IWConfig();
|
||||
ic2conn = new BlockIC2Connector();
|
||||
if (IWConfig.enableConversion)
|
||||
if (IWConfig.enableConversion) {
|
||||
mechConv = new BlockMechanicalConverter();
|
||||
}
|
||||
ic2conn = new BlockIC2Connector();
|
||||
jacobsLadder = new BlockJacobsLadder();
|
||||
panel = new BlockPanel();
|
||||
|
||||
coil = new ItemIC2Coil();
|
||||
panelComponent = new ItemPanelComponent();
|
||||
key = new ItemKey();
|
||||
|
||||
GameRegistry.registerTileEntity(TileEntityIC2ConnectorTin.class, MODID + "ic2ConnectorTin");
|
||||
GameRegistry.registerTileEntity(TileEntityIC2ConnectorCopper.class, MODID + "ic2ConnectorCopper");
|
||||
GameRegistry.registerTileEntity(TileEntityIC2ConnectorGold.class, MODID + "ic2ConnectorGold");
|
||||
|
@ -95,17 +111,32 @@ public class IndustrialWires {
|
|||
GameRegistry.registerTileEntity(TileEntityRSPanelConn.class, MODID + ":control_panel_rs");
|
||||
GameRegistry.registerTileEntity(TileEntityPanelCreator.class, MODID + ":panel_creator");
|
||||
GameRegistry.registerTileEntity(TileEntityUnfinishedPanel.class, MODID + ":unfinished_panel");
|
||||
if (mechConv != null) {
|
||||
if (IWConfig.enableConversion) {
|
||||
GameRegistry.registerTileEntity(TileEntityIEMotor.class, MODID + ":ieMotor");
|
||||
GameRegistry.registerTileEntity(TileEntityMechICtoIE.class, MODID + ":mechIcToIe");
|
||||
GameRegistry.registerTileEntity(TileEntityMechIEtoIC.class, MODID + ":mechIeToIc");
|
||||
}
|
||||
if (IC2Wiretype.IC2_TYPES == null) {
|
||||
throw new IllegalStateException("No IC2 wires registered");
|
||||
}
|
||||
proxy.preInit();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerBlocks(RegistryEvent.Register<Block> event) {
|
||||
for (BlockIWBase b: blocks) {
|
||||
logger.info(b.getRegistryName());
|
||||
event.getRegistry().register(b);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerItems(RegistryEvent.Register<Item> event) {
|
||||
for (BlockIWBase b:blocks) {
|
||||
event.getRegistry().register(b.createItemBlock());
|
||||
}
|
||||
for (Item i:items) {
|
||||
event.getRegistry().register(i);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void init(FMLInitializationEvent e) {
|
||||
Recipes.addRecipes();
|
||||
|
@ -123,24 +154,6 @@ public class IndustrialWires {
|
|||
@EventHandler
|
||||
public void postInit(FMLPostInitializationEvent e) {
|
||||
proxy.postInit();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void remap(FMLMissingMappingsEvent ev) {
|
||||
for (FMLMissingMappingsEvent.MissingMapping miss : ev.get()) {
|
||||
String name = miss.resourceLocation.getResourcePath();
|
||||
switch (name) {
|
||||
case "ic2connector":
|
||||
if (miss.type == GameRegistry.Type.ITEM) {
|
||||
miss.remap(Item.getItemFromBlock(IndustrialWires.ic2conn));
|
||||
} else {
|
||||
miss.remap(IndustrialWires.ic2conn);
|
||||
}
|
||||
break;
|
||||
case "ic2wirecoil":
|
||||
miss.remap(IndustrialWires.coil);
|
||||
break;
|
||||
}
|
||||
}
|
||||
PanelUtils.PANEL_ITEM = Item.getItemFromBlock(panel);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,16 +45,16 @@ import static malte0811.industrialWires.IndustrialWires.*;
|
|||
|
||||
public class Recipes {
|
||||
public static void addRecipes() {
|
||||
addCustomRecipes();
|
||||
/*addCustomRecipes();
|
||||
addConnectors();
|
||||
if (mechConv != null) {
|
||||
addMechConverters();
|
||||
}
|
||||
addJacobs();
|
||||
registerPanels();
|
||||
registerPanels();*/
|
||||
}
|
||||
|
||||
private static void addConnectors() {
|
||||
/* private static void addConnectors() {
|
||||
ItemStack glassCable = IC2Items.getItem("cable", "type:glass,insulation:0");
|
||||
//CONNECTORS
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ic2conn, 4, 0), " t ", "rtr", "rtr", 't', "ingotTin", 'r', "itemRubber"));
|
||||
|
@ -176,5 +176,5 @@ public class Recipes {
|
|||
public AssemblerHandler.RecipeQuery[] getQueriedInputs(T arg0) {
|
||||
return new AssemblerHandler.RecipeQuery[0];
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
|
|
@ -37,13 +37,11 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Arrays;
|
||||
|
@ -56,13 +54,13 @@ public abstract class BlockIWBase extends Block {
|
|||
super(mat);
|
||||
setHardness(3.0F);
|
||||
setResistance(15.0F);
|
||||
GameRegistry.register(this, new ResourceLocation(IndustrialWires.MODID, name));
|
||||
GameRegistry.register(createItemBlock(), new ResourceLocation(IndustrialWires.MODID, name));
|
||||
setUnlocalizedName(IndustrialWires.MODID + "." + name);
|
||||
setRegistryName(IndustrialWires.MODID, name);
|
||||
setCreativeTab(IndustrialWires.creativeTab);
|
||||
IndustrialWires.blocks.add(this);
|
||||
}
|
||||
|
||||
protected ItemBlock createItemBlock() {
|
||||
public ItemBlock createItemBlock() {
|
||||
return new ItemBlockIW(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
package malte0811.industrialWires.blocks;
|
||||
|
||||
import blusunrize.immersiveengineering.api.IEProperties;
|
||||
import malte0811.industrialWires.IndustrialWires;
|
||||
import malte0811.industrialWires.blocks.TileEntityJacobsLadder.LadderSize;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
|
@ -79,9 +80,11 @@ public class BlockJacobsLadder extends BlockIWBase implements IMetaEnum, IPlacem
|
|||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(@Nonnull Item itemIn, CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
for (int i = 0; i < LadderSize.values().length; i++) {
|
||||
list.add(new ItemStack(this, 1, i));
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
if (tab== IndustrialWires.creativeTab) {
|
||||
for (int i = 0; i < LadderSize.values().length; i++) {
|
||||
list.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ public class ItemBlockIW extends ItemBlock {
|
|||
values = null;
|
||||
}
|
||||
hasSubtypes = true;
|
||||
setRegistryName(b.getRegistryName());
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
|
|
@ -32,7 +32,6 @@ import net.minecraft.block.state.BlockStateContainer;
|
|||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
@ -60,7 +59,7 @@ public class BlockPanel extends BlockIWBase implements IMetaEnum {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected ItemBlock createItemBlock() {
|
||||
public ItemBlock createItemBlock() {
|
||||
return new ItemBlockPanel(this);
|
||||
}
|
||||
|
||||
|
@ -143,6 +142,7 @@ public class BlockPanel extends BlockIWBase implements IMetaEnum {
|
|||
return state.getValue(type).ordinal();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return super.getStateFromMeta(meta).withProperty(type, BlockTypes_Panel.values()[meta]);
|
||||
|
@ -154,9 +154,11 @@ public class BlockPanel extends BlockIWBase implements IMetaEnum {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(@Nonnull Item itemIn, CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
for (int i = 0; i < BlockTypes_Panel.values().length; i++) {
|
||||
list.add(new ItemStack(itemIn, 1, i));
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
if (tab==IndustrialWires.creativeTab) {
|
||||
for (int i = 0; i < BlockTypes_Panel.values().length; i++) {
|
||||
list.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ public class TileEntityPanel extends TileEntityIWBase implements IDirectionalTil
|
|||
|
||||
{
|
||||
for (int i = 2; i < 14; i++) {
|
||||
int color = EnumDyeColor.byMetadata(i - 2).getMapColor().colorValue;
|
||||
int color = EnumDyeColor.byMetadata(i - 2).getColorValue();
|
||||
IndicatorLight ind = new IndicatorLight(0, (byte) (i - 2), color);
|
||||
LightedButton btn = new LightedButton(color, false, true, 1, i - 2);
|
||||
Label lbl = new Label("->", color);
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
package malte0811.industrialWires.blocks.converter;
|
||||
|
||||
import blusunrize.immersiveengineering.api.IEProperties;
|
||||
import malte0811.industrialWires.IndustrialWires;
|
||||
import malte0811.industrialWires.blocks.BlockIWBase;
|
||||
import malte0811.industrialWires.blocks.IMetaEnum;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
@ -47,9 +48,11 @@ public class BlockMechanicalConverter extends BlockIWBase implements IMetaEnum {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(@Nonnull Item itemIn, CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
list.add(new ItemStack(itemIn, 1, i));
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
if (tab== IndustrialWires.creativeTab) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
list.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ import net.minecraft.block.properties.PropertyEnum;
|
|||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
|
@ -43,6 +44,7 @@ import net.minecraftforge.common.property.ExtendedBlockState;
|
|||
import net.minecraftforge.common.property.IUnlistedProperty;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -54,7 +56,6 @@ public class BlockIC2Connector extends BlockIWBase implements IMetaEnum {
|
|||
setHardness(3.0F);
|
||||
setResistance(15.0F);
|
||||
lightOpacity = 0;
|
||||
this.setCreativeTab(IndustrialWires.creativeTab);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -70,9 +71,11 @@ public class BlockIC2Connector extends BlockIWBase implements IMetaEnum {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(@Nonnull Item itemIn, CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
for (int i = 0; i < type.getAllowedValues().size(); i++) {
|
||||
list.add(new ItemStack(itemIn, 1, i));
|
||||
public void getSubBlocks(CreativeTabs tab, NonNullList<ItemStack> list) {
|
||||
if (tab==IndustrialWires.creativeTab) {
|
||||
for (int i = 0; i < type.getAllowedValues().size(); i++) {
|
||||
list.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -146,8 +149,8 @@ public class BlockIC2Connector extends BlockIWBase implements IMetaEnum {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced) {
|
||||
super.addInformation(stack, player, tooltip, advanced);
|
||||
public void addInformation(ItemStack stack, @Nullable World world, List<String> tooltip, ITooltipFlag advanced) {
|
||||
super.addInformation(stack, world, tooltip, advanced);
|
||||
if (!stack.isEmpty() && stack.getMetadata() % 2 == 0) {
|
||||
int type = stack.getMetadata() / 2;
|
||||
tooltip.add(I18n.format(IndustrialWires.MODID + ".tooltip.power_tier", type + 1));
|
||||
|
|
|
@ -21,30 +21,44 @@ import blusunrize.immersiveengineering.api.Lib;
|
|||
import blusunrize.immersiveengineering.client.ClientUtils;
|
||||
import blusunrize.immersiveengineering.common.util.ItemNBTHelper;
|
||||
import malte0811.industrialWires.IndustrialWires;
|
||||
import malte0811.industrialWires.blocks.IMetaEnum;
|
||||
import malte0811.industrialWires.blocks.controlpanel.TileEntityPanel;
|
||||
import malte0811.industrialWires.client.panelmodel.PanelModel;
|
||||
import malte0811.industrialWires.controlpanel.PanelComponent;
|
||||
import malte0811.industrialWires.items.ItemIC2Coil;
|
||||
import malte0811.industrialWires.items.ItemKey;
|
||||
import malte0811.industrialWires.items.ItemPanelComponent;
|
||||
import malte0811.industrialWires.wires.IC2Wiretype;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.block.model.ModelBakery;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraftforge.client.GuiIngameForge;
|
||||
import net.minecraftforge.client.event.DrawBlockHighlightEvent;
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = IndustrialWires.MODID, value = Side.CLIENT)
|
||||
public class ClientEventHandler {
|
||||
@SubscribeEvent
|
||||
public void renderOverlayPost(RenderGameOverlayEvent.Post e) {
|
||||
public static void renderOverlayPost(RenderGameOverlayEvent.Post e) {
|
||||
if (ClientUtils.mc().player != null && e.getType() == RenderGameOverlayEvent.ElementType.TEXT) {
|
||||
EntityPlayer player = ClientUtils.mc().player;
|
||||
|
||||
|
@ -81,7 +95,7 @@ public class ClientEventHandler {
|
|||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void renderBoundingBoxes(DrawBlockHighlightEvent event) {
|
||||
public static void renderBoundingBoxes(DrawBlockHighlightEvent event) {
|
||||
if (!event.isCanceled() && event.getSubID() == 0 && event.getTarget().typeOfHit == RayTraceResult.Type.BLOCK) {
|
||||
TileEntity tile = event.getPlayer().world.getTileEntity(event.getTarget().getBlockPos());
|
||||
if (tile instanceof TileEntityPanel) {
|
||||
|
@ -96,8 +110,46 @@ public class ClientEventHandler {
|
|||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void bakeModel(ModelBakeEvent event) {
|
||||
public static void bakeModel(ModelBakeEvent event) {
|
||||
event.getModelRegistry().putObject(new ModelResourceLocation(IndustrialWires.MODID + ":control_panel", "inventory,type=top"), new PanelModel());
|
||||
event.getModelRegistry().putObject(new ModelResourceLocation(IndustrialWires.MODID + ":control_panel", "inventory,type=unfinished"), new PanelModel());
|
||||
}
|
||||
@SubscribeEvent
|
||||
public static void registerModels(ModelRegistryEvent evt) {
|
||||
for (int meta = 0; meta < ItemIC2Coil.subNames.length; meta++) {
|
||||
ResourceLocation loc = new ResourceLocation(IndustrialWires.MODID, "ic2_wire_coil/" + ItemIC2Coil.subNames[meta]);
|
||||
ModelBakery.registerItemVariants(IndustrialWires.coil, loc);
|
||||
ModelLoader.setCustomModelResourceLocation(IndustrialWires.coil, meta, new ModelResourceLocation(loc, "inventory"));
|
||||
}
|
||||
for (int meta = 0; meta < ItemPanelComponent.types.length; meta++) {
|
||||
ResourceLocation loc = new ResourceLocation(IndustrialWires.MODID, "panel_component/" + ItemPanelComponent.types[meta]);
|
||||
ModelBakery.registerItemVariants(IndustrialWires.panelComponent, loc);
|
||||
ModelLoader.setCustomModelResourceLocation(IndustrialWires.panelComponent, meta, new ModelResourceLocation(loc, "inventory"));
|
||||
}
|
||||
for (int meta = 0; meta < ItemKey.types.length; meta++) {
|
||||
ResourceLocation loc = new ResourceLocation(IndustrialWires.MODID, "key/" + ItemKey.types[meta]);
|
||||
ModelBakery.registerItemVariants(IndustrialWires.key, loc);
|
||||
ModelLoader.setCustomModelResourceLocation(IndustrialWires.key, meta, new ModelResourceLocation(loc, "inventory"));
|
||||
}
|
||||
|
||||
Block[] blocks = {IndustrialWires.ic2conn, IndustrialWires.mechConv, IndustrialWires.jacobsLadder, IndustrialWires.panel};
|
||||
for (Block b : blocks) {
|
||||
if (b != null) {
|
||||
Item blockItem = Item.getItemFromBlock(b);
|
||||
final ResourceLocation loc = b.getRegistryName();
|
||||
assert loc != null;
|
||||
ModelLoader.setCustomMeshDefinition(blockItem, stack -> new ModelResourceLocation(loc, "inventory"));
|
||||
Object[] v = ((IMetaEnum) b).getValues();
|
||||
for (int meta = 0; meta < v.length; meta++) {
|
||||
String location = loc.toString();
|
||||
String prop = "inventory,type=" + v[meta].toString().toLowerCase(Locale.US);
|
||||
try {
|
||||
ModelLoader.setCustomModelResourceLocation(blockItem, meta, new ModelResourceLocation(location, prop));
|
||||
} catch (NullPointerException npe) {
|
||||
throw new RuntimeException(b + " lacks an item!", npe);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,6 +66,8 @@ import net.minecraftforge.client.model.ModelLoaderRegistry;
|
|||
import net.minecraftforge.client.model.obj.OBJLoader;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
|
@ -109,44 +111,8 @@ public class ClientProxy extends CommonProxy {
|
|||
IndustrialWires.MODID + ":blocks/ic2_relay_glass"));
|
||||
|
||||
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, "ic2_wire_coil/" + ItemIC2Coil.subNames[meta]);
|
||||
ModelBakery.registerItemVariants(IndustrialWires.coil, loc);
|
||||
ModelLoader.setCustomModelResourceLocation(IndustrialWires.coil, meta, new ModelResourceLocation(loc, "inventory"));
|
||||
}
|
||||
for (int meta = 0; meta < ItemPanelComponent.types.length; meta++) {
|
||||
ResourceLocation loc = new ResourceLocation(IndustrialWires.MODID, "panel_component/" + ItemPanelComponent.types[meta]);
|
||||
ModelBakery.registerItemVariants(IndustrialWires.panelComponent, loc);
|
||||
ModelLoader.setCustomModelResourceLocation(IndustrialWires.panelComponent, meta, new ModelResourceLocation(loc, "inventory"));
|
||||
}
|
||||
for (int meta = 0; meta < ItemKey.types.length; meta++) {
|
||||
ResourceLocation loc = new ResourceLocation(IndustrialWires.MODID, "key/" + ItemKey.types[meta]);
|
||||
ModelBakery.registerItemVariants(IndustrialWires.key, loc);
|
||||
ModelLoader.setCustomModelResourceLocation(IndustrialWires.key, meta, new ModelResourceLocation(loc, "inventory"));
|
||||
}
|
||||
|
||||
Block[] blocks = {IndustrialWires.ic2conn, IndustrialWires.mechConv, IndustrialWires.jacobsLadder, IndustrialWires.panel};
|
||||
for (Block b : blocks) {
|
||||
if (b != null) {
|
||||
Item blockItem = Item.getItemFromBlock(b);
|
||||
final ResourceLocation loc = b.getRegistryName();
|
||||
assert loc != null;
|
||||
ModelLoader.setCustomMeshDefinition(blockItem, stack -> new ModelResourceLocation(loc, "inventory"));
|
||||
Object[] v = ((IMetaEnum) b).getValues();
|
||||
for (int meta = 0; meta < v.length; meta++) {
|
||||
String location = loc.toString();
|
||||
String prop = "inventory,type=" + v[meta].toString().toLowerCase(Locale.US);
|
||||
try {
|
||||
ModelLoader.setCustomModelResourceLocation(blockItem, meta, new ModelResourceLocation(location, prop));
|
||||
} catch (NullPointerException npe) {
|
||||
throw new RuntimeException(b + " lacks an item!", npe);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
OBJLoader.INSTANCE.addDomain(IndustrialWires.MODID);
|
||||
ModelLoaderRegistry.registerLoader(new PanelModelLoader());
|
||||
MinecraftForge.EVENT_BUS.register(new ClientEventHandler());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityJacobsLadder.class, new TileRenderJacobsLadder());
|
||||
}
|
||||
|
||||
|
|
|
@ -191,10 +191,10 @@ public class GuiPanelComponent extends GuiContainer {
|
|||
GlStateManager.color(1, 1, 1, 1);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
for (GuiChannelPicker pick : rsChannelChoosers) {
|
||||
pick.drawButton(mc, mouseX, mouseY);
|
||||
pick.drawButton(mc, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
for (GuiButtonCheckbox box : boolButtons) {
|
||||
box.drawButton(mc, mouseX, mouseY);
|
||||
box.drawButton(mc, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
for (GuiTextField field : stringTexts) {
|
||||
field.drawTextBox();
|
||||
|
@ -203,7 +203,7 @@ public class GuiPanelComponent extends GuiContainer {
|
|||
choose.drawChooser();
|
||||
}
|
||||
for (GuiSliderIE choose : floatSliders) {
|
||||
choose.drawButton(mc, mouseX, mouseY);
|
||||
choose.drawButton(mc, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
//TOOLTIPS
|
||||
for (int i = 0; i < rsChannelChoosers.size(); i++) {
|
||||
|
|
|
@ -17,7 +17,7 @@ public class GuiChannelPicker extends GuiButton {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(@Nonnull Minecraft mc, int mouseX, int mouseY) {
|
||||
public void drawButton(@Nonnull Minecraft mc, int mouseX, int mouseY, float patrtialTicks) {
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
|
||||
|
@ -31,7 +31,7 @@ public class GuiChannelPicker extends GuiButton {
|
|||
int xMax = xMin + width / 4;
|
||||
int yMax = yMin + height / 4;
|
||||
EnumDyeColor color = EnumDyeColor.byMetadata(i);
|
||||
int colorVal = color.getMapColor().colorValue | 0xff000000;
|
||||
int colorVal = color.getColorValue() | 0xff000000;
|
||||
if (mouseX >= xMin && mouseX < xMax && mouseY >= yMin && mouseY < yMax) {
|
||||
currHovered = i;
|
||||
}
|
||||
|
|
|
@ -36,16 +36,16 @@ public class GuiChannelPickerSmall extends GuiChannelPicker {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(@Nonnull Minecraft mc, int mouseX, int mouseY) {
|
||||
public void drawButton(@Nonnull Minecraft mc, int mouseX, int mouseY, float partialTicks) {
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
|
||||
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||
if (open) {
|
||||
super.drawButton(mc, mouseX, mouseY);
|
||||
super.drawButton(mc, mouseX, mouseY, partialTicks);
|
||||
} else {
|
||||
EnumDyeColor color = EnumDyeColor.byMetadata(selected);
|
||||
int colorVal = color.getMapColor().colorValue | 0xff000000;
|
||||
int colorVal = color.getColorValue() | 0xff000000;
|
||||
drawRect(x, y, x + width, y + height, colorVal);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ import blusunrize.immersiveengineering.api.IEApi;
|
|||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import malte0811.industrialWires.IndustrialWires;
|
||||
import malte0811.industrialWires.blocks.controlpanel.BlockTypes_Panel;
|
||||
import malte0811.industrialWires.blocks.controlpanel.TileEntityPanel;
|
||||
import malte0811.industrialWires.blocks.controlpanel.TileEntityUnfinishedPanel;
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
package malte0811.industrialWires.client.panelmodel;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import malte0811.industrialWires.IndustrialWires;
|
||||
import malte0811.industrialWires.controlpanel.PanelUtils;
|
||||
|
@ -37,6 +36,7 @@ import java.io.IOException;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class PanelModelLoader implements ICustomModelLoader {
|
||||
public static final String RESOURCE_BASE = "models/block/";
|
||||
|
@ -49,12 +49,13 @@ public class PanelModelLoader implements ICustomModelLoader {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean accepts(ResourceLocation modelLocation) {
|
||||
public boolean accepts(@Nonnull ResourceLocation modelLocation) {
|
||||
return modelLocation.getResourcePath().contains(RESOURCE_BASE + RESOURCE_LOCATION);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IModel loadModel(ResourceLocation modelLocation) throws IOException {
|
||||
public IModel loadModel(@Nonnull ResourceLocation modelLocation) throws IOException {
|
||||
String resourcePath = modelLocation.getResourcePath();
|
||||
int pos = resourcePath.indexOf(RESOURCE_LOCATION);
|
||||
if (pos >= 0) {
|
||||
|
@ -65,11 +66,13 @@ public class PanelModelLoader implements ICustomModelLoader {
|
|||
|
||||
private class PanelModelBase implements IModel {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Collection<ResourceLocation> getDependencies() {
|
||||
return ImmutableList.of();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Collection<ResourceLocation> getTextures() {
|
||||
try {
|
||||
|
@ -82,8 +85,9 @@ public class PanelModelLoader implements ICustomModelLoader {
|
|||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBakedModel bake(IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
|
||||
public IBakedModel bake(@Nonnull IModelState state, @Nonnull VertexFormat format, @Nonnull Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
|
||||
try {
|
||||
return new PanelModel();
|
||||
} catch (Exception e) {
|
||||
|
@ -91,10 +95,5 @@ public class PanelModelLoader implements ICustomModelLoader {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IModelState getDefaultState() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -21,10 +21,10 @@ package malte0811.industrialWires.client.render;
|
|||
import malte0811.industrialWires.blocks.TileEntityJacobsLadder;
|
||||
import malte0811.industrialWires.blocks.TileEntityJacobsLadder.LadderSize;
|
||||
import malte0811.industrialWires.util.Beziers;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
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.util.math.Vec3d;
|
||||
|
@ -32,8 +32,8 @@ import org.lwjgl.opengl.GL11;
|
|||
|
||||
public class TileRenderJacobsLadder extends TileEntitySpecialRenderer<TileEntityJacobsLadder> {
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntityJacobsLadder tile, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
super.renderTileEntityAt(tile, x, y, z, partialTicks, destroyStage);
|
||||
public void render(TileEntityJacobsLadder tile, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
|
||||
super.render(tile, x, y, z, partialTicks, destroyStage, alpha);
|
||||
if (!tile.isDummy() && tile.timeTillActive == 0 && tile.controls[0] != null) {
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
@ -48,7 +48,7 @@ public class TileRenderJacobsLadder extends TileEntitySpecialRenderer<TileEntity
|
|||
float oldBX = OpenGlHelper.lastBrightnessX;
|
||||
float oldBY = OpenGlHelper.lastBrightnessY;
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 238, 238);
|
||||
GlStateManager.color(1, .85F, 1, 1);
|
||||
GlStateManager.color(1, .85F, 1, alpha);
|
||||
Vec3d[] controls = new Vec3d[tile.size.arcPoints];
|
||||
for (int i = 0; i < tile.size.arcPoints; i++) {
|
||||
Vec3d speed = tile.controlMovement[i];
|
||||
|
@ -86,7 +86,7 @@ public class TileRenderJacobsLadder extends TileEntitySpecialRenderer<TileEntity
|
|||
Vec3d radY = new Vec3d(0, diameter / 2, 0);
|
||||
Vec3d radZ = new Vec3d(0, 0, diameter / 2);
|
||||
Tessellator tes = Tessellator.getInstance();
|
||||
VertexBuffer vertBuffer = tes.getBuffer();
|
||||
BufferBuilder vertBuffer = tes.getBuffer();
|
||||
float[][] colors = new float[steps + 1][];
|
||||
vertBuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
|
||||
Vec3d last = Beziers.getPoint(0, controls);
|
||||
|
@ -135,7 +135,7 @@ public class TileRenderJacobsLadder extends TileEntitySpecialRenderer<TileEntity
|
|||
return ret;
|
||||
}
|
||||
|
||||
private void drawQuad(Vec3d v0, Vec3d v1, Vec3d rad, float[] color0, float[] color1, VertexBuffer vertexBuffer) {
|
||||
private void drawQuad(Vec3d v0, Vec3d v1, Vec3d rad, float[] color0, float[] color1, BufferBuilder vertexBuffer) {
|
||||
color(color1, vertexBuffer.pos(v1.x - rad.x, v1.y - rad.y, v1.z - rad.z)).endVertex();
|
||||
color(color0, vertexBuffer.pos(v0.x - rad.x, v0.y - rad.y, v0.z - rad.z)).endVertex();
|
||||
color(color0, vertexBuffer.pos(v0.x + rad.x, v0.y + rad.y, v0.z + rad.z)).endVertex();
|
||||
|
@ -147,7 +147,7 @@ public class TileRenderJacobsLadder extends TileEntitySpecialRenderer<TileEntity
|
|||
color(color1, vertexBuffer.pos(v1.x - rad.x, v1.y - rad.y, v1.z - rad.z)).endVertex();
|
||||
}
|
||||
|
||||
private VertexBuffer color(float[] color, VertexBuffer vb) {
|
||||
private BufferBuilder color(float[] color, BufferBuilder vb) {
|
||||
vb.color(color[0], color[1], color[2], 1);
|
||||
return vb;
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ import static malte0811.industrialWires.util.MiscUtils.discoverLocal;
|
|||
|
||||
public final class PanelUtils {
|
||||
public static TextureAtlasSprite PANEL_TEXTURE;
|
||||
public static final Item PANEL_ITEM = new ItemStack(IndustrialWires.panel).getItem();
|
||||
public static Item PANEL_ITEM;
|
||||
private static ItemStack panelBase;
|
||||
|
||||
private PanelUtils() {
|
||||
|
@ -320,7 +320,7 @@ public final class PanelUtils {
|
|||
}
|
||||
if (rs && data.hasKey(RS_CHANNEL)) {
|
||||
EnumDyeColor channColor = EnumDyeColor.byMetadata(data.getInteger(RS_CHANNEL));
|
||||
String hexCol = Integer.toHexString(channColor.getMapColor().colorValue);
|
||||
String hexCol = Integer.toHexString(channColor.getColorValue());
|
||||
list.add(I18n.format("desc.immersiveengineering.info.redstoneChannel", "<hexcol=" + hexCol + ":" + channColor.getUnlocalizedName() + ">"));
|
||||
}
|
||||
if (rs && data.hasKey(RS_ID)) {
|
||||
|
|
|
@ -25,10 +25,11 @@ import net.minecraft.item.crafting.IRecipe;
|
|||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class RecipeCoilLength implements IRecipe {
|
||||
public class RecipeCoilLength extends IForgeRegistryEntry.Impl<IRecipe> implements IRecipe {
|
||||
public final ItemStack coil;
|
||||
public final ItemStack cable;
|
||||
private final int maxLength;
|
||||
|
@ -54,8 +55,8 @@ public class RecipeCoilLength implements IRecipe {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeSize() {
|
||||
return 1;
|
||||
public boolean canFit(int width, int height) {
|
||||
return width>0 && height>0;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
|
|
@ -26,11 +26,12 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class RecipeComponentCopy implements IRecipe {
|
||||
public class RecipeComponentCopy extends IForgeRegistryEntry.Impl<IRecipe> implements IRecipe {
|
||||
|
||||
@Override
|
||||
public boolean matches(@Nonnull InventoryCrafting inv, @Nonnull World worldIn) {
|
||||
|
@ -78,8 +79,8 @@ public class RecipeComponentCopy implements IRecipe {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeSize() {
|
||||
return 2;
|
||||
public boolean canFit(int width, int height) {
|
||||
return width>0&&height>1;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
|
|
@ -22,6 +22,7 @@ import malte0811.industrialWires.IndustrialWires;
|
|||
import malte0811.industrialWires.items.ItemPanelComponent;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
|
||||
|
@ -29,8 +30,8 @@ import javax.annotation.Nonnull;
|
|||
|
||||
public class RecipeInitPC extends ShapedOreRecipe {
|
||||
|
||||
public RecipeInitPC(ItemStack result, Object... recipe) {
|
||||
super(result, recipe);
|
||||
public RecipeInitPC(ResourceLocation group, ItemStack result, Object... recipe) {
|
||||
super(group, result, recipe);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
|
|
@ -28,10 +28,11 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class RecipeKeyLock implements IRecipe {
|
||||
public class RecipeKeyLock extends IForgeRegistryEntry.Impl<IRecipe> implements IRecipe {
|
||||
|
||||
@Override
|
||||
public boolean matches(@Nonnull InventoryCrafting inv, @Nonnull World worldIn) {
|
||||
|
@ -47,8 +48,8 @@ public class RecipeKeyLock implements IRecipe {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeSize() {
|
||||
return 2;
|
||||
public boolean canFit(int width, int height) {
|
||||
return width*height>=2;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
|
|
@ -26,13 +26,14 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static malte0811.industrialWires.items.ItemKey.*;
|
||||
|
||||
public class RecipeKeyRing implements IRecipe {
|
||||
public class RecipeKeyRing extends IForgeRegistryEntry.Impl<IRecipe> implements IRecipe {
|
||||
|
||||
@Override
|
||||
public boolean matches(@Nonnull InventoryCrafting inv, @Nonnull World worldIn) {
|
||||
|
@ -82,10 +83,11 @@ public class RecipeKeyRing implements IRecipe {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeSize() {
|
||||
return 2;
|
||||
public boolean canFit(int width, int height) {
|
||||
return width>0&&height>0;
|
||||
}
|
||||
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
|
|
|
@ -25,7 +25,6 @@ import blusunrize.immersiveengineering.api.energy.wires.ImmersiveNetHandler;
|
|||
import blusunrize.immersiveengineering.api.energy.wires.ImmersiveNetHandler.Connection;
|
||||
import blusunrize.immersiveengineering.api.energy.wires.WireType;
|
||||
import blusunrize.immersiveengineering.common.IESaveData;
|
||||
import blusunrize.immersiveengineering.common.util.IEAchievements;
|
||||
import blusunrize.immersiveengineering.common.util.ItemNBTHelper;
|
||||
import blusunrize.immersiveengineering.common.util.Utils;
|
||||
import ic2.api.item.IC2Items;
|
||||
|
@ -34,6 +33,7 @@ import malte0811.industrialWires.IndustrialWires;
|
|||
import malte0811.industrialWires.wires.IC2Wiretype;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
|
@ -45,9 +45,9 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
@ -62,15 +62,18 @@ public class ItemIC2Coil extends Item implements IWireCoil {
|
|||
this.setCreativeTab(IndustrialWires.creativeTab);
|
||||
setMaxStackSize(64);
|
||||
setRegistryName(new ResourceLocation(IndustrialWires.MODID, "ic2_wire_coil"));
|
||||
GameRegistry.register(this);
|
||||
IndustrialWires.items.add(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void getSubItems(@Nonnull Item itemIn, CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
||||
for (int i = 0; i < subNames.length; i++) {
|
||||
ItemStack tmp = new ItemStack(this, 1, i);
|
||||
setLength(tmp, getMaxWireLength(tmp));
|
||||
subItems.add(tmp);
|
||||
public void getSubItems(@Nonnull CreativeTabs tab, @Nonnull NonNullList<ItemStack> subItems) {
|
||||
if (tab==IndustrialWires.creativeTab) {
|
||||
for (int i = 0; i < subNames.length; i++) {
|
||||
ItemStack tmp = new ItemStack(this, 1, i);
|
||||
setLength(tmp, getMaxWireLength(tmp));
|
||||
subItems.add(tmp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,18 +89,19 @@ public class ItemIC2Coil extends Item implements IWireCoil {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List<String> list, boolean adv) {
|
||||
list.add(I18n.format(IndustrialWires.MODID + ".desc.wireLength", getLength(stack)));
|
||||
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
|
||||
|
||||
tooltip.add(I18n.format(IndustrialWires.MODID + ".desc.wireLength", getLength(stack)));
|
||||
int transferRate = IC2Wiretype.IC2_TYPES[stack.getMetadata()].getTransferRate();
|
||||
list.add(I18n.format(IndustrialWires.MODID + ".tooltip.transfer_rate", transferRate));
|
||||
list.add(I18n.format(IndustrialWires.MODID + ".tooltip.input_rate", transferRate / 8));
|
||||
tooltip.add(I18n.format(IndustrialWires.MODID + ".tooltip.transfer_rate", transferRate));
|
||||
tooltip.add(I18n.format(IndustrialWires.MODID + ".tooltip.input_rate", transferRate / 8));
|
||||
if (stack.getTagCompound() != null && stack.getTagCompound().hasKey("linkingPos")) {
|
||||
int[] link = stack.getTagCompound().getIntArray("linkingPos");
|
||||
if (link.length > 3) {
|
||||
list.add(I18n.format(Lib.DESC_INFO + "attachedToDim", link[1], link[2], link[3], link[0]));
|
||||
tooltip.add(I18n.format(Lib.DESC_INFO + "attachedToDim", link[1], link[2], link[3], link[0]));
|
||||
}
|
||||
}
|
||||
list.add(I18n.format(IndustrialWires.MODID + ".desc.recipe"));
|
||||
tooltip.add(I18n.format(IndustrialWires.MODID + ".desc.recipe"));
|
||||
}
|
||||
|
||||
//mostly copied from IE
|
||||
|
@ -173,7 +177,7 @@ public class ItemIC2Coil extends Item implements IWireCoil {
|
|||
nodeHere.connectCable(type, target, nodeLink);
|
||||
nodeLink.connectCable(type, targetLink, nodeHere);
|
||||
IESaveData.setDirty(world.provider.getDimension());
|
||||
player.addStat(IEAchievements.connectWire);
|
||||
Utils.unlockIEAdvancement(player, "main/connect_wire");
|
||||
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
if (length < lengthOnStack) {
|
||||
|
|
|
@ -46,7 +46,7 @@ public class ItemKey extends Item implements INetGUIItem {
|
|||
this.setCreativeTab(IndustrialWires.creativeTab);
|
||||
setMaxStackSize(64);
|
||||
setRegistryName(new ResourceLocation(IndustrialWires.MODID, "key"));
|
||||
GameRegistry.register(this);
|
||||
IndustrialWires.items.add(this);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
@ -60,15 +60,16 @@ public class ItemKey extends Item implements INetGUIItem {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(Item itemIn, CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
||||
subItems.add(new ItemStack(this, 1, 0));
|
||||
subItems.add(new ItemStack(this, 1, 2));
|
||||
public void getSubItems(@Nonnull CreativeTabs tab, @Nonnull NonNullList<ItemStack> subItems) {
|
||||
if (tab==IndustrialWires.creativeTab) {
|
||||
subItems.add(new ItemStack(this, 1, 0));
|
||||
subItems.add(new ItemStack(this, 1, 2));
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
NBTTagCompound nbt = stack.getTagCompound();
|
||||
return "item."+IndustrialWires.MODID+".key."+types[stack.getMetadata()];
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ import malte0811.industrialWires.controlpanel.PanelUtils;
|
|||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
|
@ -35,7 +36,6 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -58,11 +58,11 @@ public class ItemPanelComponent extends Item implements INetGUIItem {
|
|||
this.setCreativeTab(IndustrialWires.creativeTab);
|
||||
setMaxStackSize(64);
|
||||
setRegistryName(new ResourceLocation(IndustrialWires.MODID, "panel_component"));
|
||||
GameRegistry.register(this);
|
||||
IndustrialWires.items.add(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List<String> list, boolean adv) {
|
||||
public void addInformation(ItemStack stack, World world, List<String> list, ITooltipFlag flag) {
|
||||
if (GuiScreen.isShiftKeyDown()) {
|
||||
NBTTagCompound nbt = getTagCompound(stack);
|
||||
NBTTagCompound data = nbt.getCompoundTag("data");
|
||||
|
@ -86,9 +86,11 @@ public class ItemPanelComponent extends Item implements INetGUIItem {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems(@Nonnull Item itemIn, CreativeTabs tab, NonNullList<ItemStack> subItems) {
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
subItems.add(new ItemStack(itemIn, 1, i));
|
||||
public void getSubItems(@Nonnull CreativeTabs tab, @Nonnull NonNullList<ItemStack> subItems) {
|
||||
if (tab==IndustrialWires.creativeTab) {
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
subItems.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue