This commit is contained in:
asdflj committed 2022-11-05 15:34:36 +08:00
1 parent fd6eb37369
commit ce1ac164dc
26 files changed
+912 -43

No files matched your search

@@ -0,0 +1,55 @@
package com.glodblock.github.common.block;
import appeng.block.AEBaseItemBlock;
import com.glodblock.github.common.tabs.FluidCraftingTabs;
import com.glodblock.github.common.tile.TileLevelMaintainer;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.util.BlockPos;
import com.glodblock.github.util.NameConst;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
public class BlockLevelMaintainer extends FCBaseBlock {
public BlockLevelMaintainer() {
super(Material.iron, NameConst.BLOCK_LEVEL_MAINTAINER);
setFullBlock(true);
setOpaque(true);
setTileEntity(TileLevelMaintainer.class);
}
public BlockLevelMaintainer register() {
GameRegistry.registerBlock(this, AEBaseItemBlock.class, NameConst.BLOCK_LEVEL_MAINTAINER);
GameRegistry.registerTileEntity(TileLevelMaintainer.class, NameConst.BLOCK_LEVEL_MAINTAINER);
setCreativeTab(FluidCraftingTabs.INSTANCE);
return this;
}
@Override
public boolean onActivated(World world, int x, int y, int z, EntityPlayer player, int facing, float hitX, float hitY, float hitZ) {
if (player.isSneaking()) {
return false;
}
TileLevelMaintainer tile = getTileEntity(world, x, y, z);
if (tile != null) {
if (!world.isRemote) {
InventoryHandler.openGui(player, world, new BlockPos(x, y, z), EnumFacing.getFront(facing), GuiType.LEVEL_MAINTAINER);
}
return true;
}
return false;
}
public ItemStack stack(int size) {
return new ItemStack(this, size);
}
public ItemStack stack() {
return new ItemStack(this, 1);
}
}