Fixed all multipart item part placement ID
This commit is contained in:
parent
9aa9090645
commit
e76863530c
5 changed files with 50 additions and 86 deletions
|
@ -8,16 +8,13 @@ import codechicken.multipart._
|
||||||
import net.minecraft.creativetab.CreativeTabs
|
import net.minecraft.creativetab.CreativeTabs
|
||||||
import net.minecraft.entity.player.EntityPlayer
|
import net.minecraft.entity.player.EntityPlayer
|
||||||
import net.minecraft.item.{Item, ItemStack}
|
import net.minecraft.item.{Item, ItemStack}
|
||||||
import net.minecraft.tileentity.TileEntity
|
|
||||||
import net.minecraft.world.World
|
import net.minecraft.world.World
|
||||||
import resonant.lib.wrapper.WrapList._
|
import resonant.lib.wrapper.WrapList._
|
||||||
|
import resonantinduction.core.ResonantPartFactory
|
||||||
import resonantinduction.core.prefab.part.IHighlight
|
import resonantinduction.core.prefab.part.IHighlight
|
||||||
|
|
||||||
import scala.util.control.Breaks._
|
|
||||||
|
|
||||||
class ItemQuantumGlyph extends Item with TItemMultiPart with IHighlight
|
class ItemQuantumGlyph extends Item with TItemMultiPart with IHighlight
|
||||||
{
|
{
|
||||||
|
|
||||||
setHasSubtypes(true)
|
setHasSubtypes(true)
|
||||||
|
|
||||||
override def getUnlocalizedName(itemStack: ItemStack): String =
|
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 =
|
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]
|
val part = ResonantPartFactory.create(classOf[PartQuantumGlyph])
|
||||||
var slot: Int = CornerPlacementGrid.getHitSlot(hit, side)
|
var slot = CornerPlacementGrid.getHitSlot(hit, side)
|
||||||
val tile: TileEntity = world.getTileEntity(pos.x, pos.y, pos.z)
|
val tile = world.getTileEntity(pos.x, pos.y, pos.z)
|
||||||
|
|
||||||
if (tile.isInstanceOf[TileMultipart])
|
if (tile.isInstanceOf[TileMultipart])
|
||||||
{
|
{
|
||||||
val checkPart: TMultiPart = (tile.asInstanceOf[TileMultipart]).partMap(slot)
|
val checkPart: TMultiPart = (tile.asInstanceOf[TileMultipart]).partMap(slot)
|
||||||
|
@ -37,47 +35,28 @@ class ItemQuantumGlyph extends Item with TItemMultiPart with IHighlight
|
||||||
{
|
{
|
||||||
side match
|
side match
|
||||||
{
|
{
|
||||||
case 0 =>
|
case 0 => slot -= 1
|
||||||
slot -= 1
|
case 1 => slot += 1
|
||||||
break //todo: break is not supported
|
case 2 => slot -= 2
|
||||||
case 1 =>
|
case 3 => slot += 2
|
||||||
slot += 1
|
case 4 => slot -= 4
|
||||||
break //todo: break is not supported
|
case 5 => slot += 4
|
||||||
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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
part.preparePlacement(slot, itemStack.getItemDamage)
|
part.preparePlacement(slot, itemStack.getItemDamage)
|
||||||
|
|
||||||
return part
|
return part
|
||||||
}
|
}
|
||||||
|
|
||||||
override def getSubItems(item: Item, tab: CreativeTabs, listToAddTo: List[_])
|
override def getSubItems(item: Item, tab: CreativeTabs, listToAddTo: List[_])
|
||||||
{
|
{
|
||||||
|
|
||||||
for (i <- 0 until PartQuantumGlyph.MAX_GLYPH)
|
for (i <- 0 until PartQuantumGlyph.MAX_GLYPH)
|
||||||
{
|
{
|
||||||
{
|
listToAddTo.add(new ItemStack(item, 1, i))
|
||||||
listToAddTo.add(new ItemStack(item, 1, i))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def getHighlightType: Int =
|
def getHighlightType: Int = 1
|
||||||
{
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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
|
||||||
|
}
|
|
@ -14,6 +14,8 @@ import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
import resonant.lib.render.EnumColor;
|
import resonant.lib.render.EnumColor;
|
||||||
import resonant.lib.utility.LanguageUtility;
|
import resonant.lib.utility.LanguageUtility;
|
||||||
|
import resonantinduction.core.ResonantPartFactory;
|
||||||
|
import resonantinduction.core.ResonantPartFactory$;
|
||||||
import resonantinduction.core.prefab.part.IHighlight;
|
import resonantinduction.core.prefab.part.IHighlight;
|
||||||
import resonantinduction.electrical.wire.base.WireMaterial;
|
import resonantinduction.electrical.wire.base.WireMaterial;
|
||||||
import codechicken.lib.vec.BlockCoord;
|
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)
|
if (part != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,6 +4,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
import resonantinduction.core.ResonantPartFactory$;
|
||||||
import resonantinduction.core.prefab.part.IHighlight;
|
import resonantinduction.core.prefab.part.IHighlight;
|
||||||
import codechicken.lib.vec.BlockCoord;
|
import codechicken.lib.vec.BlockCoord;
|
||||||
import codechicken.lib.vec.Vector3;
|
import codechicken.lib.vec.Vector3;
|
||||||
|
@ -11,6 +12,7 @@ import codechicken.microblock.FacePlacementGrid$;
|
||||||
import codechicken.multipart.JItemMultiPart;
|
import codechicken.multipart.JItemMultiPart;
|
||||||
import codechicken.multipart.MultiPartRegistry;
|
import codechicken.multipart.MultiPartRegistry;
|
||||||
import codechicken.multipart.TMultiPart;
|
import codechicken.multipart.TMultiPart;
|
||||||
|
import resonantinduction.electrical.multimeter.PartMultimeter;
|
||||||
|
|
||||||
public class ItemElectricTransformer extends JItemMultiPart implements IHighlight
|
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)
|
public TMultiPart newPart(ItemStack itemStack, EntityPlayer player, World world, BlockCoord pos, int side, Vector3 hit)
|
||||||
{
|
{
|
||||||
side = FacePlacementGrid$.MODULE$.getHitSlot(hit, side);
|
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)
|
if (part != null)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue