Moved to RebornCore
This commit is contained in:
parent
50a830a101
commit
8abf6e5282
313 changed files with 3987 additions and 16508 deletions
|
@ -10,8 +10,8 @@ import net.minecraft.entity.Entity;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.lib.vecmath.Vecs3d;
|
||||
import techreborn.lib.vecmath.Vecs3dCube;
|
||||
import reborncore.common.misc.vecmath.Vecs3d;
|
||||
import reborncore.common.misc.vecmath.Vecs3dCube;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.lib.Location;
|
||||
import techreborn.lib.vecmath.Vecs3dCube;
|
||||
import reborncore.common.misc.Location;
|
||||
import reborncore.common.misc.vecmath.Vecs3dCube;
|
||||
|
||||
public interface IPartProvider {
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ package techreborn.partSystem;
|
|||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.lib.Location;
|
||||
import reborncore.common.misc.Location;
|
||||
|
||||
/**
|
||||
* Extend this class to make your multipart
|
||||
|
|
|
@ -9,10 +9,10 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
|||
import ic2.api.item.IC2Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import techreborn.Core;
|
||||
import techreborn.client.TechRebornCreativeTab;
|
||||
import techreborn.init.ModParts;
|
||||
import techreborn.partSystem.parts.CablePart;
|
||||
import techreborn.util.LogHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
@ -37,10 +37,10 @@ public class ModPartRegistry {
|
|||
iPartProvider.init();
|
||||
}
|
||||
|
||||
LogHelper.info("Started to load all parts");
|
||||
Core.logHelper.info("Started to load all parts");
|
||||
|
||||
for (ModPart modPart : ModPartRegistry.parts) {
|
||||
if(modPart.needsItem()){
|
||||
if (modPart.needsItem()) {
|
||||
Item part = new ModPartItem(modPart)
|
||||
.setUnlocalizedName(modPart.getName())
|
||||
.setCreativeTab(TechRebornCreativeTab.instance)
|
||||
|
@ -82,15 +82,15 @@ public class ModPartRegistry {
|
|||
}
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
LogHelper.error("Failed to load " + className
|
||||
Core.logHelper.error("Failed to load " + className
|
||||
+ " to the part system!");
|
||||
} catch (InstantiationException e) {
|
||||
e.printStackTrace();
|
||||
LogHelper.error("Failed to load " + className
|
||||
Core.logHelper.error("Failed to load " + className
|
||||
+ " to the part system!");
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
LogHelper.error("Failed to load " + className
|
||||
Core.logHelper.error("Failed to load " + className
|
||||
+ " to the part system!");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@ package techreborn.partSystem;
|
|||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.lib.Location;
|
||||
import techreborn.lib.vecmath.Vecs3dCube;
|
||||
import reborncore.common.misc.Location;
|
||||
import reborncore.common.misc.vecmath.Vecs3dCube;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
package techreborn.partSystem.QLib;
|
||||
|
||||
import techreborn.lib.vecmath.Vecs3d;
|
||||
import techreborn.lib.vecmath.Vecs3dCube;
|
||||
import reborncore.common.misc.vecmath.Vecs3d;
|
||||
import reborncore.common.misc.vecmath.Vecs3dCube;
|
||||
import uk.co.qmunity.lib.vec.Vec3d;
|
||||
import uk.co.qmunity.lib.vec.Vec3dCube;
|
||||
|
||||
|
|
|
@ -8,9 +8,9 @@ import net.minecraft.client.renderer.RenderBlocks;
|
|||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.lib.Location;
|
||||
import techreborn.lib.vecmath.Vecs3d;
|
||||
import techreborn.lib.vecmath.Vecs3dCube;
|
||||
import reborncore.common.misc.Location;
|
||||
import reborncore.common.misc.vecmath.Vecs3d;
|
||||
import reborncore.common.misc.vecmath.Vecs3dCube;
|
||||
import techreborn.partSystem.ModPart;
|
||||
import uk.co.qmunity.lib.client.render.RenderHelper;
|
||||
import uk.co.qmunity.lib.part.*;
|
||||
|
|
|
@ -11,8 +11,8 @@ import net.minecraft.util.MovingObjectPosition;
|
|||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import techreborn.lib.Location;
|
||||
import techreborn.lib.vecmath.Vecs3dCube;
|
||||
import reborncore.common.misc.Location;
|
||||
import reborncore.common.misc.vecmath.Vecs3dCube;
|
||||
import techreborn.partSystem.IModPart;
|
||||
import techreborn.partSystem.IPartProvider;
|
||||
import techreborn.partSystem.ModPart;
|
||||
|
|
|
@ -14,8 +14,8 @@ import net.minecraft.util.Vec3;
|
|||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import techreborn.lib.Location;
|
||||
import techreborn.lib.vecmath.Vecs3d;
|
||||
import reborncore.common.misc.Location;
|
||||
import reborncore.common.misc.vecmath.Vecs3d;
|
||||
import techreborn.partSystem.IModPart;
|
||||
import techreborn.partSystem.ModPartItem;
|
||||
|
||||
|
|
|
@ -12,15 +12,14 @@ import codechicken.multipart.NormallyOccludedPart;
|
|||
import codechicken.multipart.TMultiPart;
|
||||
import codechicken.multipart.TileMultipart;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import ic2.api.info.IC2Classic;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import techreborn.lib.Location;
|
||||
import techreborn.lib.vecmath.Vecs3dCube;
|
||||
import reborncore.common.misc.Location;
|
||||
import reborncore.common.misc.vecmath.Vecs3dCube;
|
||||
import techreborn.partSystem.IModPart;
|
||||
import techreborn.partSystem.IPartProvider;
|
||||
import techreborn.partSystem.ModPart;
|
||||
|
@ -65,7 +64,7 @@ public class FMPFactory implements MultiPartRegistry.IPartFactory2,
|
|||
for (TMultiPart p : t) {
|
||||
if (ret == false) {
|
||||
if (p.getType().equals(name)) {
|
||||
if(p instanceof FMPModPart){
|
||||
if (p instanceof FMPModPart) {
|
||||
return ((FMPModPart) p).iModPart;
|
||||
}
|
||||
ret = true;
|
||||
|
@ -79,7 +78,7 @@ public class FMPFactory implements MultiPartRegistry.IPartFactory2,
|
|||
|
||||
@Override
|
||||
public void init() {
|
||||
if(Loader.isModLoaded("IC2")){
|
||||
if (Loader.isModLoaded("IC2")) {
|
||||
MultiPartRegistry.registerConverter(new CableConverter());
|
||||
MinecraftForge.EVENT_BUS.register(new CableConverter());
|
||||
}
|
||||
|
|
|
@ -16,17 +16,14 @@ import codechicken.multipart.TMultiPart;
|
|||
import codechicken.multipart.TSlottedPart;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import techreborn.lib.Location;
|
||||
import techreborn.lib.vecmath.Vecs3d;
|
||||
import techreborn.lib.vecmath.Vecs3dCube;
|
||||
import reborncore.common.misc.Location;
|
||||
import reborncore.common.misc.vecmath.Vecs3d;
|
||||
import reborncore.common.misc.vecmath.Vecs3dCube;
|
||||
import techreborn.partSystem.IPartDesc;
|
||||
import techreborn.partSystem.ModPart;
|
||||
import techreborn.util.LogHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -50,7 +47,7 @@ public class FMPModPart extends TMultiPart implements TSlottedPart,
|
|||
public Iterable<Cuboid6> getOcclusionBoxes() {
|
||||
List<Cuboid6> cubes = new ArrayList<Cuboid6>();
|
||||
for (Vecs3dCube c : iModPart.getOcclusionBoxes())
|
||||
if(c != null)
|
||||
if (c != null)
|
||||
cubes.add(new Cuboid6(c.toAABB()));
|
||||
return cubes;
|
||||
}
|
||||
|
@ -176,8 +173,6 @@ public class FMPModPart extends TMultiPart implements TSlottedPart,
|
|||
List<ItemStack> stackArrayList = new ArrayList<ItemStack>();
|
||||
if (iModPart.getItem() != null) {
|
||||
stackArrayList.add(iModPart.getItem().copy());
|
||||
} else {
|
||||
LogHelper.error("Part " + iModPart.getName() + " has a null drop");
|
||||
}
|
||||
return stackArrayList;
|
||||
}
|
||||
|
|
|
@ -7,8 +7,6 @@ import codechicken.lib.vec.Vector3;
|
|||
import codechicken.multipart.MultiPartRegistry;
|
||||
import codechicken.multipart.TMultiPart;
|
||||
import codechicken.multipart.TileMultipart;
|
||||
import codechicken.multipart.minecraft.McBlockPart;
|
||||
import codechicken.multipart.minecraft.McMultipartSPH;
|
||||
import cpw.mods.fml.common.eventhandler.EventPriority;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import ic2.api.item.IC2Items;
|
||||
|
@ -57,46 +55,42 @@ public class CableConverter implements MultiPartRegistry.IPartConverter {
|
|||
private ThreadLocal<Object> placing = new ThreadLocal<Object>();
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.LOW)
|
||||
public void playerInteract(PlayerInteractEvent event)
|
||||
{
|
||||
if(event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK && event.entityPlayer.worldObj.isRemote)
|
||||
{
|
||||
if(placing.get() != null)
|
||||
public void playerInteract(PlayerInteractEvent event) {
|
||||
if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK && event.entityPlayer.worldObj.isRemote) {
|
||||
if (placing.get() != null)
|
||||
return;
|
||||
placing.set(event);
|
||||
if(place(event.entityPlayer, event.entityPlayer.worldObj))
|
||||
if (place(event.entityPlayer, event.entityPlayer.worldObj))
|
||||
event.setCanceled(true);
|
||||
placing.set(null);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean place(EntityPlayer player, World world)
|
||||
{
|
||||
public static boolean place(EntityPlayer player, World world) {
|
||||
MovingObjectPosition hit = RayTracer.reTrace(world, player);
|
||||
if(hit == null)
|
||||
if (hit == null)
|
||||
return false;
|
||||
|
||||
BlockCoord pos = new BlockCoord(hit.blockX, hit.blockY, hit.blockZ).offset(hit.sideHit);
|
||||
ItemStack held = player.getHeldItem();
|
||||
FMPModPart part = null;
|
||||
if(held == null)
|
||||
if (held == null)
|
||||
return false;
|
||||
|
||||
Item heldItem = held.getItem();
|
||||
|
||||
|
||||
if(heldItem == IC2Items.getItem("copperCableItem").getItem())
|
||||
if (heldItem == IC2Items.getItem("copperCableItem").getItem())
|
||||
part = placeCable(world, pos, hit.sideHit, held);
|
||||
|
||||
if(part == null)
|
||||
if (part == null)
|
||||
return false;
|
||||
|
||||
if(world.isRemote && !player.isSneaking())//attempt to use block activated like normal and tell the server the right stuff
|
||||
if (world.isRemote && !player.isSneaking())//attempt to use block activated like normal and tell the server the right stuff
|
||||
{
|
||||
Vector3 f = new Vector3(hit.hitVec).add(-hit.blockX, -hit.blockY, -hit.blockZ);
|
||||
Block block = world.getBlock(hit.blockX, hit.blockY, hit.blockZ);
|
||||
if(!ignoreActivate(block) && block.onBlockActivated(world, hit.blockX, hit.blockY, hit.blockZ, player, hit.sideHit, (float)f.x, (float)f.y, (float)f.z))
|
||||
{
|
||||
if (!ignoreActivate(block) && block.onBlockActivated(world, hit.blockX, hit.blockY, hit.blockZ, player, hit.sideHit, (float) f.x, (float) f.y, (float) f.z)) {
|
||||
player.swingItem();
|
||||
PacketCustom.sendToServer(new C08PacketPlayerBlockPlacement(
|
||||
hit.blockX, hit.blockY, hit.blockZ, hit.sideHit,
|
||||
|
@ -107,48 +101,41 @@ public class CableConverter implements MultiPartRegistry.IPartConverter {
|
|||
}
|
||||
|
||||
TileMultipart tile = TileMultipart.getOrConvertTile(world, pos);
|
||||
if(tile == null || !tile.canAddPart(part))
|
||||
if (tile == null || !tile.canAddPart(part))
|
||||
return false;
|
||||
|
||||
if(!world.isRemote)
|
||||
{
|
||||
if (!world.isRemote) {
|
||||
TileMultipart.addPart(world, pos, part);
|
||||
world.playSoundEffect(pos.x + 0.5, pos.y + 0.5, pos.z + 0.5,
|
||||
Blocks.wool.stepSound.func_150496_b(),
|
||||
(Blocks.wool.stepSound.getVolume() + 1.0F) / 2.0F,
|
||||
Blocks.wool.stepSound.getPitch() * 0.8F);
|
||||
if(!player.capabilities.isCreativeMode)
|
||||
{
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
held.stackSize--;
|
||||
if (held.stackSize == 0)
|
||||
{
|
||||
if (held.stackSize == 0) {
|
||||
player.inventory.mainInventory[player.inventory.currentItem] = null;
|
||||
MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(player, held));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
player.swingItem();
|
||||
// new PacketCustom(McMultipartSPH.channel, 1).sendToServer();
|
||||
// new PacketCustom(McMultipartSPH.channel, 1).sendToServer();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean ignoreActivate(Block block)
|
||||
{
|
||||
if(block instanceof BlockFence)
|
||||
private static boolean ignoreActivate(Block block) {
|
||||
if (block instanceof BlockFence)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static FMPModPart placeCable(World world, BlockCoord pos, int side, ItemStack held)
|
||||
{
|
||||
if(side == 0)
|
||||
public static FMPModPart placeCable(World world, BlockCoord pos, int side, ItemStack held) {
|
||||
if (side == 0)
|
||||
return null;
|
||||
pos = pos.copy().offset(side^1);
|
||||
pos = pos.copy().offset(side ^ 1);
|
||||
Block block = world.getBlock(pos.x, pos.y, pos.z);
|
||||
if(!block.isSideSolid(world, pos.x, pos.y, pos.z, ForgeDirection.getOrientation(side)) && (side != 1 || block.canPlaceTorchOnTop(world, pos.x, pos.y, pos.z)))
|
||||
if (!block.isSideSolid(world, pos.x, pos.y, pos.z, ForgeDirection.getOrientation(side)) && (side != 1 || block.canPlaceTorchOnTop(world, pos.x, pos.y, pos.z)))
|
||||
return null;
|
||||
|
||||
CablePart part = new CablePart();
|
||||
|
|
|
@ -17,11 +17,11 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import reborncore.common.misc.Functions;
|
||||
import reborncore.common.misc.Location;
|
||||
import reborncore.common.misc.vecmath.Vecs3d;
|
||||
import reborncore.common.misc.vecmath.Vecs3dCube;
|
||||
import techreborn.client.render.RenderCablePart;
|
||||
import techreborn.lib.Functions;
|
||||
import techreborn.lib.Location;
|
||||
import techreborn.lib.vecmath.Vecs3d;
|
||||
import techreborn.lib.vecmath.Vecs3dCube;
|
||||
import techreborn.partSystem.IModPart;
|
||||
import techreborn.partSystem.IPartDesc;
|
||||
import techreborn.partSystem.ModPart;
|
||||
|
|
|
@ -7,8 +7,8 @@ package techreborn.partSystem.parts;
|
|||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import techreborn.lib.vecmath.Vecs3d;
|
||||
import techreborn.lib.vecmath.Vecs3dCube;
|
||||
import reborncore.common.misc.vecmath.Vecs3d;
|
||||
import reborncore.common.misc.vecmath.Vecs3dCube;
|
||||
import techreborn.partSystem.IModPart;
|
||||
import techreborn.partSystem.ModPart;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue