Skip to content

Commit

Permalink
Tree resin colector placement fixe
Browse files Browse the repository at this point in the history
  • Loading branch information
Dolu1990 committed Mar 21, 2014
1 parent 7223712 commit 95bd3d5
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 11 deletions.
23 changes: 23 additions & 0 deletions mods/eln/TreeResinCollector/TreeResinCollectorDescriptor.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@

import org.lwjgl.opengl.GL11;

import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import mods.eln.misc.Coordonate;
import mods.eln.misc.Direction;
import mods.eln.misc.Obj3D;
import mods.eln.misc.Obj3D.Obj3DPart;
import mods.eln.node.SixNodeDescriptor;
Expand All @@ -28,6 +31,9 @@ public TreeResinCollectorDescriptor(String name,Obj3D obj) {
emptyS = fill.getFloat("emptyS");
}
}



}

float emptyS,emptyT;
Expand Down Expand Up @@ -81,4 +87,21 @@ public void addInformation(ItemStack itemStack, EntityPlayer entityPlayer,
list.add("when placed on tree");
list.add("The production is slow");
}


@Override
public boolean canBePlacedOnSide(EntityPlayer player,Coordonate c,Direction side) {
// TODO Auto-generated method stub
Block b = c.getBlock();
if(b!= Block.wood){
player.addChatMessage("This block must be placed on tree");
return false;
}
if(side.isY()){
player.addChatMessage("You can't place this block at this side");
return false;
}

return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ public ElectricalDataLoggerDescriptor(
led = obj.getPart("led");
}
}

if(onFloor){
setPlaceDirection(Direction.YN);
}
}
Obj3D obj;
Obj3DPart main,led;
Expand Down Expand Up @@ -119,13 +123,7 @@ public boolean hasVolume() {
// TODO Auto-generated method stub
return true;
}
@Override
public boolean canBePlacedOnSide(Direction side) {
if(onFloor && side != Direction.YN) return false;
return super.canBePlacedOnSide(side);
}




@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
Expand Down
9 changes: 7 additions & 2 deletions mods/eln/node/SixNodeDescriptor.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import mods.eln.misc.Coordonate;
import mods.eln.misc.Direction;
import mods.eln.misc.LRDU;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;

Expand Down Expand Up @@ -38,8 +39,11 @@ public boolean hasVolume() {
return false;
}

public boolean canBePlacedOnSide(EntityPlayer player,Coordonate c,Direction side){
return canBePlacedOnSide(player,side);
}

public boolean canBePlacedOnSide(Direction side)
public boolean canBePlacedOnSide(EntityPlayer player,Direction side)
{
if(placeDirection != null){
boolean ok = false;
Expand All @@ -48,6 +52,7 @@ public boolean canBePlacedOnSide(Direction side)
return true;
}
}
player.addChatMessage("You can't place this block at this side");
return false;
}
return true;
Expand Down Expand Up @@ -83,7 +88,7 @@ public void setPlaceDirection(Direction []d)
placeDirection = d;
}

Direction[] placeDirection = null;
protected Direction[] placeDirection = null;
public String checkCanPlace(Coordonate coord, Direction direction,LRDU front) {
if(placeDirection != null){
boolean ok = false;
Expand Down
4 changes: 2 additions & 2 deletions mods/eln/node/SixNodeItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,9 @@ public boolean canPlaceItemBlockOnSide(World par1World, int x, int y, int z, int
int[] vect = new int[]{x,y,z};
Direction.fromIntMinecraftSide(par5).applyTo(vect, 1);
SixNodeDescriptor descriptor = getDescriptor(par7ItemStack);
if(descriptor.canBePlacedOnSide(Direction.fromIntMinecraftSide(par5).getInverse()) == false)
if(descriptor.canBePlacedOnSide(par6EntityPlayer,new Coordonate(x,y,z,par1World), Direction.fromIntMinecraftSide(par5).getInverse()) == false)
{
par6EntityPlayer.addChatMessage("You can't place this block at this side");

return false;
}
if(par1World.getBlockId(vect[0],vect[1],vect[2]) == Eln.sixNodeBlock.blockID) return true;
Expand Down

0 comments on commit 95bd3d5

Please sign in to comment.