nosingleplayer 1.1.1: fond custom via blit + log debug widgets
This commit is contained in:
@@ -0,0 +1,112 @@
|
||||
|
||||
package net.paladrill.paladrillmod.block;
|
||||
|
||||
import net.paladrill.paladrillmod.procedure.ProcedureXpBushPlantRightClicked;
|
||||
import net.paladrill.paladrillmod.creativetab.TabPalaDrillMod;
|
||||
import net.paladrill.paladrillmod.ElementsPaladrillmodMod;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.BlockFlower;
|
||||
import net.minecraft.block.Block;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
|
||||
@ElementsPaladrillmodMod.ModElement.Tag
|
||||
public class BlockXpBush extends ElementsPaladrillmodMod.ModElement {
|
||||
@GameRegistry.ObjectHolder("paladrillmod:xpbush")
|
||||
public static final Block block = null;
|
||||
public BlockXpBush(ElementsPaladrillmodMod instance) {
|
||||
super(instance, 49);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initElements() {
|
||||
elements.blocks.add(() -> new BlockCustomFlower());
|
||||
elements.items.add(() -> new ItemBlock(block).setRegistryName(block.getRegistryName()));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModels(ModelRegistryEvent event) {
|
||||
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, new ModelResourceLocation("paladrillmod:xpbush", "inventory"));
|
||||
}
|
||||
public static class BlockCustomFlower extends BlockFlower {
|
||||
public BlockCustomFlower() {
|
||||
setSoundType(SoundType.PLANT);
|
||||
setCreativeTab(TabPalaDrillMod.tab);
|
||||
setHardness(0F);
|
||||
setResistance(0F);
|
||||
setLightLevel(0F);
|
||||
setUnlocalizedName("xpbush");
|
||||
setRegistryName("xpbush");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReplaceable(IBlockAccess blockAccess, BlockPos pos) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
|
||||
drops.add(new ItemStack(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
|
||||
return new ItemStack(Item.getItemFromBlock(this), 1, this.damageDropped(state));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumPlantType getPlantType(IBlockAccess world, BlockPos pos) {
|
||||
return EnumPlantType.Plains;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockFlower.EnumFlowerColor getBlockType() {
|
||||
return BlockFlower.EnumFlowerColor.YELLOW;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(CreativeTabs tab, net.minecraft.util.NonNullList<ItemStack> list) {
|
||||
for (BlockFlower.EnumFlowerType blockflower$enumflowertype : BlockFlower.EnumFlowerType.getTypes(this.getBlockType())) {
|
||||
list.add(new ItemStack(this, 1, blockflower$enumflowertype.getMeta()));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entity, EnumHand hand, EnumFacing direction,
|
||||
float hitX, float hitY, float hitZ) {
|
||||
int x = pos.getX();
|
||||
int y = pos.getY();
|
||||
int z = pos.getZ();
|
||||
{
|
||||
Map<String, Object> $_dependencies = new HashMap<>();
|
||||
$_dependencies.put("entity", entity);
|
||||
ProcedureXpBushPlantRightClicked.executeProcedure($_dependencies);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user