shits working now
This commit is contained in:
@@ -32,7 +32,7 @@ public class CrankBlock extends Block implements ITileEntityProvider{
|
|||||||
|
|
||||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
|
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
|
||||||
|
|
||||||
///if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
System.out.println(world.getBlockMetadata(x, y, z));
|
System.out.println(world.getBlockMetadata(x, y, z));
|
||||||
TileEntCrank tile = (TileEntCrank) world.getTileEntity(x, y, z);
|
TileEntCrank tile = (TileEntCrank) world.getTileEntity(x, y, z);
|
||||||
if(tile.isPowered == false){
|
if(tile.isPowered == false){
|
||||||
@@ -42,10 +42,14 @@ public class CrankBlock extends Block implements ITileEntityProvider{
|
|||||||
if(world.getBlock(x, y, z+1) instanceof LatheBase){
|
if(world.getBlock(x, y, z+1) instanceof LatheBase){
|
||||||
TileEntLatheBase tileLathe = (TileEntLatheBase) world.getTileEntity(x, y, z+1);
|
TileEntLatheBase tileLathe = (TileEntLatheBase) world.getTileEntity(x, y, z+1);
|
||||||
tileLathe.isPowered=true;
|
tileLathe.isPowered=true;
|
||||||
|
tileLathe.markDirty();
|
||||||
|
tileLathe.markForUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//return true;
|
tile.markDirty();
|
||||||
//}
|
tile.markForUpdate();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import nmd.primal.energy.tileents.TileEntLatheBase;
|
|||||||
import nmd.primal.energy.util.CustomTab;
|
import nmd.primal.energy.util.CustomTab;
|
||||||
|
|
||||||
public abstract class LatheBase extends BlockContainer implements ITileEntityProvider{
|
public abstract class LatheBase extends BlockContainer implements ITileEntityProvider{
|
||||||
|
|
||||||
protected LatheBase(String unlocalizedName, Material material) {
|
protected LatheBase(String unlocalizedName, Material material) {
|
||||||
super(material);
|
super(material);
|
||||||
this.setBlockName(unlocalizedName);
|
this.setBlockName(unlocalizedName);
|
||||||
@@ -24,36 +24,36 @@ public abstract class LatheBase extends BlockContainer implements ITileEntityPro
|
|||||||
this.setResistance(6.0F);
|
this.setResistance(6.0F);
|
||||||
this.setStepSound(soundTypeStone);
|
this.setStepSound(soundTypeStone);
|
||||||
this.setBlockBounds(0.1F, 0.0F, 0.1F,
|
this.setBlockBounds(0.1F, 0.0F, 0.1F,
|
||||||
0.9F, 0.75F, 0.9F);
|
0.9F, 0.75F, 0.9F);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
|
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int q, float a, float b, float c) {
|
||||||
|
|
||||||
TileEntLatheBase tileEnt = (TileEntLatheBase) world.getTileEntity(x, y, z);
|
TileEntLatheBase tileEnt = (TileEntLatheBase) world.getTileEntity(x, y, z);
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
if(player.inventory.getCurrentItem()!=null){
|
if(player.inventory.getCurrentItem()!=null){
|
||||||
if(player.inventory.getCurrentItem().getItem()!=ModItems.schiselItem){
|
if(player.inventory.getCurrentItem().getItem()!=ModItems.schiselItem){
|
||||||
if (tileEnt.getStackInSlot(0)==null){
|
if (tileEnt.getStackInSlot(0)==null){
|
||||||
tileEnt.setInventorySlotContents(0, player.inventory.getCurrentItem());
|
tileEnt.setInventorySlotContents(0, player.inventory.getCurrentItem());
|
||||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
|
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
|
||||||
}
|
}
|
||||||
if (tileEnt.getStackInSlot(0)!=null){
|
if (tileEnt.getStackInSlot(0)!=null){
|
||||||
if(player.inventory.getCurrentItem()!=null){
|
if(player.inventory.getCurrentItem()!=null){
|
||||||
ItemStack pStack = player.inventory.getCurrentItem().copy();
|
ItemStack pStack = player.inventory.getCurrentItem().copy();
|
||||||
ItemStack sStack = tileEnt.getStackInSlot(0).copy();
|
ItemStack sStack = tileEnt.getStackInSlot(0).copy();
|
||||||
ItemStack sStackTemp = tileEnt.getStackInSlot(0).copy();
|
ItemStack sStackTemp = tileEnt.getStackInSlot(0).copy();
|
||||||
if(tileEnt.getStackInSlot(0).stackSize < 64){
|
if(tileEnt.getStackInSlot(0).stackSize < 64){
|
||||||
sStackTemp.stackSize++;
|
sStackTemp.stackSize++;
|
||||||
if ((sStack.getItem().equals(pStack.getItem())) && (sStack.getItemDamage() == pStack.getItemDamage()) ){
|
if ((sStack.getItem().equals(pStack.getItem())) && (sStack.getItemDamage() == pStack.getItemDamage()) ){
|
||||||
tileEnt.setInventorySlotContents(0, sStackTemp);
|
tileEnt.setInventorySlotContents(0, sStackTemp);
|
||||||
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (player.isSneaking() && player.inventory.getCurrentItem()==null) {
|
if (player.isSneaking() && player.inventory.getCurrentItem()==null) {
|
||||||
if(tileEnt.getStackInSlot(0)!=null){
|
if(tileEnt.getStackInSlot(0)!=null){
|
||||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, tileEnt.getStackInSlot(0));
|
player.inventory.setInventorySlotContents(player.inventory.currentItem, tileEnt.getStackInSlot(0));
|
||||||
@@ -77,7 +77,7 @@ public abstract class LatheBase extends BlockContainer implements ITileEntityPro
|
|||||||
tileEnt.markDirty();
|
tileEnt.markDirty();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType() {
|
public int getRenderType() {
|
||||||
return RenderID.latheID;
|
return RenderID.latheID;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package nmd.primal.energy.item;
|
package nmd.primal.energy.item;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -29,17 +30,22 @@ public class SChiselItem extends Item{
|
|||||||
GameRegistry.registerItem(this, name);
|
GameRegistry.registerItem(this, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onUsingTick(ItemStack stack, EntityPlayer player, int count){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int count) {
|
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int count) {
|
||||||
|
System.out.println("Stopped Using "+ count);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
|
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
|
||||||
{
|
{
|
||||||
//player.setItemInUse(stack, 72000);
|
//System.out.println("In Use");
|
||||||
|
player.setItemInUse(stack, 72000);
|
||||||
if(!world.isRemote){
|
if(!world.isRemote){
|
||||||
|
|
||||||
}
|
}
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package nmd.primal.energy.packethandle.chiselLathe;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||||
|
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||||
|
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||||
|
|
||||||
|
public class MHChisel implements IMessageHandler<MPChisel, IMessage>{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IMessage onMessage(MPChisel message, MessageContext ctx) {
|
||||||
|
//ShelfFour.caseType = message.caseType;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package nmd.primal.energy.packethandle.chiselLathe;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
|
|
||||||
|
public class MPChisel implements IMessage {
|
||||||
|
|
||||||
|
public int caseType;
|
||||||
|
|
||||||
|
public MPChisel() {}
|
||||||
|
|
||||||
|
public MPChisel(int x){
|
||||||
|
this.caseType = x;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fromBytes(ByteBuf buf) {
|
||||||
|
this.caseType = buf.readInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void toBytes(ByteBuf buf) {
|
||||||
|
buf.writeInt(this.caseType);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -18,8 +18,8 @@ import nmd.primal.energy.tileents.TileEntCrank;
|
|||||||
|
|
||||||
public class RenderCrank extends TileEntitySpecialRenderer {
|
public class RenderCrank extends TileEntitySpecialRenderer {
|
||||||
|
|
||||||
public int i = 0;
|
private int i = 0;
|
||||||
public int a = 0;
|
private int a = 0;
|
||||||
public static final ResourceLocation MODEL = new ResourceLocation("energy:models/Crank.obj");
|
public static final ResourceLocation MODEL = new ResourceLocation("energy:models/Crank.obj");
|
||||||
public static final ResourceLocation TEXTURE = new ResourceLocation("energy:models/Crank.png");
|
public static final ResourceLocation TEXTURE = new ResourceLocation("energy:models/Crank.png");
|
||||||
private IModelCustom model = AdvancedModelLoader.loadModel(MODEL);
|
private IModelCustom model = AdvancedModelLoader.loadModel(MODEL);
|
||||||
@@ -54,6 +54,9 @@ public class RenderCrank extends TileEntitySpecialRenderer {
|
|||||||
GL11.glRotatef(90, 0.0f, 0.0f, -1.0f);
|
GL11.glRotatef(90, 0.0f, 0.0f, -1.0f);
|
||||||
GL11.glTranslatef(-1.0f, 0.0f, 0.0f);
|
GL11.glTranslatef(-1.0f, 0.0f, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tile.markForUpdate();
|
||||||
|
tile.markDirty();
|
||||||
renderBlock(tile, tileEnt.getWorldObj(), tileEnt.xCoord,tileEnt.yCoord, tileEnt.zCoord, ModBlocks.crankBlock);
|
renderBlock(tile, tileEnt.getWorldObj(), tileEnt.xCoord,tileEnt.yCoord, tileEnt.zCoord, ModBlocks.crankBlock);
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
}
|
}
|
||||||
@@ -72,7 +75,7 @@ public class RenderCrank extends TileEntitySpecialRenderer {
|
|||||||
GL11.glRotatef(i, 0.0F, 1.0F, 0.0F);
|
GL11.glRotatef(i, 0.0F, 1.0F, 0.0F);
|
||||||
a++;
|
a++;
|
||||||
if(a==1){
|
if(a==1){
|
||||||
i=i+7;
|
i=i+14;
|
||||||
a=0;
|
a=0;
|
||||||
}
|
}
|
||||||
if(i==360){
|
if(i==360){
|
||||||
@@ -80,6 +83,8 @@ public class RenderCrank extends TileEntitySpecialRenderer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tl.markForUpdate();
|
||||||
|
tl.markDirty();
|
||||||
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);
|
FMLClientHandler.instance().getClient().renderEngine.bindTexture(TEXTURE);
|
||||||
|
|
||||||
this.model.renderAll();
|
this.model.renderAll();
|
||||||
|
|||||||
@@ -27,11 +27,11 @@ public class RenderLathe extends TileEntitySpecialRenderer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderTileEntityAt(TileEntity tileEnt, double x, double y, double z, float scale) {
|
public void renderTileEntityAt(TileEntity tileEnt, double x, double y, double z, float scale) {
|
||||||
|
TileEntLatheBase tile = (TileEntLatheBase) tileEnt;
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
|
|
||||||
GL11.glTranslatef((float) x, (float) y, (float) z);
|
GL11.glTranslatef((float) x, (float) y, (float) z);
|
||||||
TileEntLatheBase tile = (TileEntLatheBase) tileEnt;
|
|
||||||
|
|
||||||
tile.markForUpdate();
|
tile.markForUpdate();
|
||||||
tile.markDirty();
|
tile.markDirty();
|
||||||
@@ -64,7 +64,7 @@ public class RenderLathe extends TileEntitySpecialRenderer {
|
|||||||
RenderManager.instance.renderEntityWithPosYaw(entItem, 0.0D, -0.15D, 0.0D, 0.0F, 0.0F);
|
RenderManager.instance.renderEntityWithPosYaw(entItem, 0.0D, -0.15D, 0.0D, 0.0F, 0.0F);
|
||||||
a++;
|
a++;
|
||||||
if(a==1){
|
if(a==1){
|
||||||
i=i+7;
|
i=i+14;
|
||||||
a=0;
|
a=0;
|
||||||
}
|
}
|
||||||
if(i==360){
|
if(i==360){
|
||||||
@@ -74,10 +74,11 @@ public class RenderLathe extends TileEntitySpecialRenderer {
|
|||||||
if(tile.isPowered==false){
|
if(tile.isPowered==false){
|
||||||
RenderManager.instance.renderEntityWithPosYaw(entItem, 0.0D, -0.15D, 0.0D, 0.0F, 0.0F);
|
RenderManager.instance.renderEntityWithPosYaw(entItem, 0.0D, -0.15D, 0.0D, 0.0F, 0.0F);
|
||||||
}
|
}
|
||||||
//GL11.glRotatef(90, 0, 1, 0);
|
|
||||||
//RenderManager.instance.renderEntityWithPosYaw(entItem, -0.5D, 0.3D, 0.5D, 0.0F, 0.0F);
|
|
||||||
RenderItem.renderInFrame = false;
|
RenderItem.renderInFrame = false;
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
|
tile.markForUpdate();
|
||||||
|
tile.markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import net.minecraft.world.World;
|
|||||||
public class TileBase extends TileEntity{
|
public class TileBase extends TileEntity{
|
||||||
|
|
||||||
protected String specName;
|
protected String specName;
|
||||||
public boolean isPowered = true;
|
|
||||||
|
|
||||||
public TileBase(String name){
|
public TileBase(String name){
|
||||||
specName = name;
|
specName = name;
|
||||||
@@ -23,27 +22,24 @@ public class TileBase extends TileEntity{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
System.out.println(isPowered);
|
|
||||||
World world = this.getWorldObj();
|
World world = this.getWorldObj();
|
||||||
int x = this.xCoord;
|
int x = this.xCoord;
|
||||||
int y = this.yCoord;
|
int y = this.yCoord;
|
||||||
int z = this.zCoord;
|
int z = this.zCoord;
|
||||||
if (worldObj.isRemote) return;
|
if (worldObj.isRemote) return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound tagCompound)
|
public void readFromNBT(NBTTagCompound tagCompound)
|
||||||
{
|
{
|
||||||
super.readFromNBT(tagCompound);
|
super.readFromNBT(tagCompound);
|
||||||
this.isPowered = tagCompound.getBoolean("ISPOWERED");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToNBT(NBTTagCompound tagCompound)
|
public void writeToNBT(NBTTagCompound tagCompound)
|
||||||
{
|
{
|
||||||
super.writeToNBT(tagCompound);
|
super.writeToNBT(tagCompound);
|
||||||
tagCompound.setBoolean("ISPOWERED", this.isPowered);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import net.minecraft.world.World;
|
|||||||
public class TileEntCrank extends TileBase {
|
public class TileEntCrank extends TileBase {
|
||||||
|
|
||||||
private int i;
|
private int i;
|
||||||
|
public boolean isPowered;
|
||||||
|
|
||||||
public TileEntCrank(String name) {
|
public TileEntCrank(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
@@ -28,10 +29,9 @@ public class TileEntCrank extends TileBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (worldObj.isRemote) return;
|
if (worldObj.isRemote) return;
|
||||||
System.out.println(this.isPowered + " " + i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound tagCompound)
|
public void readFromNBT(NBTTagCompound tagCompound)
|
||||||
{
|
{
|
||||||
super.readFromNBT(tagCompound);
|
super.readFromNBT(tagCompound);
|
||||||
@@ -44,6 +44,6 @@ public class TileEntCrank extends TileBase {
|
|||||||
super.writeToNBT(tagCompound);
|
super.writeToNBT(tagCompound);
|
||||||
tagCompound.setBoolean("ISPOWERED", this.isPowered);
|
tagCompound.setBoolean("ISPOWERED", this.isPowered);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ public class TileEntLatheBase extends TileBase implements IInventory {
|
|||||||
|
|
||||||
private ItemStack[] inv;
|
private ItemStack[] inv;
|
||||||
private int i;
|
private int i;
|
||||||
|
public boolean isPowered;
|
||||||
|
|
||||||
public TileEntLatheBase(String name) {
|
public TileEntLatheBase(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
|
|||||||
Reference in New Issue
Block a user