mirror of
https://github.com/GTNewHorizons/BloodMagic.git
synced 2026-11-27 07:13:14 +00:00
107 lines
3.9 KiB
Java
107 lines
3.9 KiB
Java
package WayofTime.alchemicalWizardry.common.block;
|
|
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
import net.minecraft.block.BlockContainer;
|
|
import net.minecraft.block.material.Material;
|
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.tileentity.TileEntity;
|
|
import net.minecraft.util.ChatComponentTranslation;
|
|
import net.minecraft.world.World;
|
|
|
|
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
|
import WayofTime.alchemicalWizardry.api.Int3;
|
|
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
|
|
import WayofTime.alchemicalWizardry.api.items.interfaces.IReagentManipulator;
|
|
import WayofTime.alchemicalWizardry.common.tileEntity.TEReagentConduit;
|
|
import cpw.mods.fml.relauncher.Side;
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
|
|
|
public class BlockReagentConduit extends BlockContainer {
|
|
|
|
public BlockReagentConduit() {
|
|
super(Material.cloth);
|
|
setHardness(2.0F);
|
|
setResistance(5.0F);
|
|
this.setBlockName("blockReagentConduit");
|
|
this.setCreativeTab(AlchemicalWizardry.tabBloodMagic);
|
|
}
|
|
|
|
@Override
|
|
@SideOnly(Side.CLIENT)
|
|
public void registerBlockIcons(IIconRegister iconRegister) {
|
|
this.blockIcon = iconRegister.registerIcon("AlchemicalWizardry:SimpleTransCircle");
|
|
}
|
|
|
|
@Override
|
|
public TileEntity createNewTileEntity(World world, int meta) {
|
|
return new TEReagentConduit();
|
|
}
|
|
|
|
@Override
|
|
public boolean canProvidePower() {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float what,
|
|
float these, float are) {
|
|
if (!world.isRemote) {
|
|
ItemStack held = player.getHeldItem();
|
|
if (held == null || !(held.getItem() instanceof IReagentManipulator)) {
|
|
TileEntity tile = world.getTileEntity(x, y, z);
|
|
if (tile instanceof TEReagentConduit relay) {
|
|
if (relay.reagentTargetList.isEmpty()) {
|
|
player.addChatComponentMessage(
|
|
new ChatComponentTranslation("message.reagentconduit.noconnections"));
|
|
} else {
|
|
player.addChatComponentMessage(
|
|
new ChatComponentTranslation("message.reagentconduit.connections"));
|
|
for (Map.Entry<Reagent, List<Int3>> entry : relay.reagentTargetList.entrySet()) {
|
|
Reagent reagent = entry.getKey();
|
|
List<Int3> offsets = entry.getValue();
|
|
if (offsets == null) continue;
|
|
for (Int3 offset : offsets) {
|
|
player.addChatComponentMessage(
|
|
new ChatComponentTranslation(
|
|
"message.reagentconduit.connection.entry",
|
|
reagent.name(),
|
|
x + offset.x(),
|
|
y + offset.y(),
|
|
z + offset.z()));
|
|
}
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return super.onBlockActivated(world, x, y, z, player, side, what, these, are);
|
|
}
|
|
|
|
@Override
|
|
public boolean isOpaqueCube() {
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public boolean renderAsNormalBlock() {
|
|
return false;
|
|
}
|
|
|
|
@Override
|
|
public int getRenderType() {
|
|
return -1;
|
|
}
|
|
|
|
// @Override
|
|
// public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int
|
|
// p_149668_4_)
|
|
// {
|
|
// return null;
|
|
// }
|
|
}
|