Added onBlockPlacedBy() wrapper to BlockGenericPipe and Pipe

This commit is contained in:
Krapht 2013-01-26 17:58:06 +01:00
parent 6ab8a50b64
commit 129a437d4e
2 changed files with 14 additions and 0 deletions

View file

@ -19,6 +19,7 @@ import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
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;
@ -362,7 +363,17 @@ public class BlockGenericPipe extends BlockContainer {
return meta; return meta;
} }
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving placer) {
super.onBlockPlacedBy(world, x, y, z, placer);
Pipe pipe = getPipe(world, x, y, z);
if (isValid(pipe)) {
pipe.onBlockPlacedBy(placer);
}
}
@Override @Override
public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityplayer, int par6, float par7, float par8, float par9) { public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer entityplayer, int par6, float par7, float par8, float par9) {
super.onBlockActivated(world, i, j, k, entityplayer, par6, par7, par8, par9); super.onBlockActivated(world, i, j, k, entityplayer, par6, par7, par8, par9);

View file

@ -15,6 +15,7 @@ import java.util.Map;
import java.util.Random; import java.util.Random;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -122,6 +123,8 @@ public abstract class Pipe implements IPipe, IDropControlInventory {
logic.onBlockPlaced(); logic.onBlockPlaced();
transport.onBlockPlaced(); transport.onBlockPlaced();
} }
public void onBlockPlacedBy(EntityLiving placer) {}
public void onNeighborBlockChange(int blockId) { public void onNeighborBlockChange(int blockId) {
logic.onNeighborBlockChange(blockId); logic.onNeighborBlockChange(blockId);