diff --git a/src/main/scala/resonantinduction/atomic/gate/ItemQuantumGlyph.scala b/src/main/scala/resonantinduction/atomic/gate/ItemQuantumGlyph.scala index 7034b46fb..e6147b79b 100644 --- a/src/main/scala/resonantinduction/atomic/gate/ItemQuantumGlyph.scala +++ b/src/main/scala/resonantinduction/atomic/gate/ItemQuantumGlyph.scala @@ -8,16 +8,13 @@ import codechicken.multipart._ import net.minecraft.creativetab.CreativeTabs import net.minecraft.entity.player.EntityPlayer import net.minecraft.item.{Item, ItemStack} -import net.minecraft.tileentity.TileEntity import net.minecraft.world.World import resonant.lib.wrapper.WrapList._ +import resonantinduction.core.ResonantPartFactory import resonantinduction.core.prefab.part.IHighlight -import scala.util.control.Breaks._ - class ItemQuantumGlyph extends Item with TItemMultiPart with IHighlight { - setHasSubtypes(true) override def getUnlocalizedName(itemStack: ItemStack): String = @@ -27,9 +24,10 @@ class ItemQuantumGlyph extends Item with TItemMultiPart with IHighlight def newPart(itemStack: ItemStack, player: EntityPlayer, world: World, pos: BlockCoord, side: Int, hit: Vector3): TMultiPart = { - val part: PartQuantumGlyph = MultiPartRegistry.createPart("resonant_induction_quantum_glyph", false).asInstanceOf[PartQuantumGlyph] - var slot: Int = CornerPlacementGrid.getHitSlot(hit, side) - val tile: TileEntity = world.getTileEntity(pos.x, pos.y, pos.z) + val part = ResonantPartFactory.create(classOf[PartQuantumGlyph]) + var slot = CornerPlacementGrid.getHitSlot(hit, side) + val tile = world.getTileEntity(pos.x, pos.y, pos.z) + if (tile.isInstanceOf[TileMultipart]) { val checkPart: TMultiPart = (tile.asInstanceOf[TileMultipart]).partMap(slot) @@ -37,47 +35,28 @@ class ItemQuantumGlyph extends Item with TItemMultiPart with IHighlight { side match { - case 0 => - slot -= 1 - break //todo: break is not supported - case 1 => - slot += 1 - break //todo: break is not supported - case 2 => - slot -= 2 - break //todo: break is not supported - case 3 => - slot += 2 - break //todo: break is not supported - case 4 => - slot -= 4 - break //todo: break is not supported - case 5 => - slot += 4 - break //todo: break is not supported + case 0 => slot -= 1 + case 1 => slot += 1 + case 2 => slot -= 2 + case 3 => slot += 2 + case 4 => slot -= 4 + case 5 => slot += 4 } } - else - { - } } + part.preparePlacement(slot, itemStack.getItemDamage) + return part } override def getSubItems(item: Item, tab: CreativeTabs, listToAddTo: List[_]) { - for (i <- 0 until PartQuantumGlyph.MAX_GLYPH) { - { - listToAddTo.add(new ItemStack(item, 1, i)) - } + listToAddTo.add(new ItemStack(item, 1, i)) } } - def getHighlightType: Int = - { - return 1 - } + def getHighlightType: Int = 1 } \ No newline at end of file diff --git a/src/main/scala/resonantinduction/electrical/levitator/ItemLevitator.java b/src/main/scala/resonantinduction/electrical/levitator/ItemLevitator.java deleted file mode 100644 index 8780880f8..000000000 --- a/src/main/scala/resonantinduction/electrical/levitator/ItemLevitator.java +++ /dev/null @@ -1,48 +0,0 @@ -package resonantinduction.electrical.levitator; - -import java.util.List; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; -import resonantinduction.core.prefab.part.IHighlight; -import codechicken.lib.vec.BlockCoord; -import codechicken.lib.vec.Vector3; -import codechicken.microblock.FacePlacementGrid$; -import codechicken.multipart.JItemMultiPart; -import codechicken.multipart.MultiPartRegistry; -import codechicken.multipart.TMultiPart; - -public class ItemLevitator extends JItemMultiPart implements IHighlight -{ - @Override - @SuppressWarnings("unchecked") - public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean par4) - { - list.add("\u00a7cFrom Dev's - Functionality Disabled"); - - } - - @Override - public TMultiPart newPart(ItemStack itemStack, EntityPlayer player, World world, BlockCoord pos, int side, Vector3 hit) - { - side = FacePlacementGrid$.MODULE$.getHitSlot(hit, side); - PartLevitator part = (PartLevitator) MultiPartRegistry.createPart("resonant_induction_levitator", false); - - if (part != null) - { - int l = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3; - int facing = l == 0 ? 2 : (l == 1 ? 5 : (l == 2 ? 3 : (l == 3 ? 4 : 0))); - part.preparePlacement(side, facing); - } - - return part; - } - - @Override - public int getHighlightType() - { - return 0; - } -} diff --git a/src/main/scala/resonantinduction/electrical/levitator/ItemLevitator.scala b/src/main/scala/resonantinduction/electrical/levitator/ItemLevitator.scala new file mode 100644 index 000000000..1467ee2c9 --- /dev/null +++ b/src/main/scala/resonantinduction/electrical/levitator/ItemLevitator.scala @@ -0,0 +1,29 @@ +package resonantinduction.electrical.levitator + +import codechicken.lib.vec.{BlockCoord, Vector3} +import codechicken.microblock.FacePlacementGrid +import codechicken.multipart.{TItemMultiPart, TMultiPart} +import net.minecraft.entity.player.EntityPlayer +import net.minecraft.item.{Item, ItemStack} +import net.minecraft.util.MathHelper +import net.minecraft.world.World +import resonantinduction.core.ResonantPartFactory +import resonantinduction.core.prefab.part.IHighlight + +class ItemLevitator extends Item with TItemMultiPart with IHighlight +{ + def newPart(itemStack: ItemStack, player: EntityPlayer, world: World, pos: BlockCoord, bside: Int, hit: Vector3): TMultiPart = + { + val side = FacePlacementGrid.getHitSlot(hit, bside) + val part: PartLevitator = ResonantPartFactory.create(classOf[PartLevitator]) + if (part != null) + { + val l: Int = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3 + val facing: Int = if (l == 0) 2 else (if (l == 1) 5 else (if (l == 2) 3 else (if (l == 3) 4 else 0))) + part.preparePlacement(side, facing) + } + return part + } + + def getHighlightType: Int = 0 +} \ No newline at end of file diff --git a/src/main/scala/resonantinduction/electrical/multimeter/ItemMultimeter.java b/src/main/scala/resonantinduction/electrical/multimeter/ItemMultimeter.java index 42fa075d6..706721cc2 100644 --- a/src/main/scala/resonantinduction/electrical/multimeter/ItemMultimeter.java +++ b/src/main/scala/resonantinduction/electrical/multimeter/ItemMultimeter.java @@ -14,6 +14,8 @@ import org.lwjgl.input.Keyboard; import resonant.lib.render.EnumColor; import resonant.lib.utility.LanguageUtility; +import resonantinduction.core.ResonantPartFactory; +import resonantinduction.core.ResonantPartFactory$; import resonantinduction.core.prefab.part.IHighlight; import resonantinduction.electrical.wire.base.WireMaterial; import codechicken.lib.vec.BlockCoord; @@ -46,7 +48,7 @@ public class ItemMultimeter extends JItemMultiPart implements IHighlight } } - PartMultimeter part = (PartMultimeter) MultiPartRegistry.createPart("resonant_induction_multimeter", false); + PartMultimeter part = ResonantPartFactory$.MODULE$.create(PartMultimeter.class); if (part != null) { diff --git a/src/main/scala/resonantinduction/electrical/transformer/ItemElectricTransformer.java b/src/main/scala/resonantinduction/electrical/transformer/ItemElectricTransformer.java index eb390d402..ab4aa2f13 100644 --- a/src/main/scala/resonantinduction/electrical/transformer/ItemElectricTransformer.java +++ b/src/main/scala/resonantinduction/electrical/transformer/ItemElectricTransformer.java @@ -4,6 +4,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.MathHelper; import net.minecraft.world.World; +import resonantinduction.core.ResonantPartFactory$; import resonantinduction.core.prefab.part.IHighlight; import codechicken.lib.vec.BlockCoord; import codechicken.lib.vec.Vector3; @@ -11,6 +12,7 @@ import codechicken.microblock.FacePlacementGrid$; import codechicken.multipart.JItemMultiPart; import codechicken.multipart.MultiPartRegistry; import codechicken.multipart.TMultiPart; +import resonantinduction.electrical.multimeter.PartMultimeter; public class ItemElectricTransformer extends JItemMultiPart implements IHighlight { @@ -18,7 +20,7 @@ public class ItemElectricTransformer extends JItemMultiPart implements IHighligh public TMultiPart newPart(ItemStack itemStack, EntityPlayer player, World world, BlockCoord pos, int side, Vector3 hit) { side = FacePlacementGrid$.MODULE$.getHitSlot(hit, side); - PartElectricTransformer part = (PartElectricTransformer) MultiPartRegistry.createPart("resonant_induction_transformer", false); + PartElectricTransformer part = ResonantPartFactory$.MODULE$.create(PartElectricTransformer.class); if (part != null) {