Jump to content

kenijey

Members
  • Posts

    7
  • Joined

  • Last visited

Everything posted by kenijey

  1. package kenijey.harshenuniverse.blocks; import java.util.List; import kenijey.harshenuniverse.base.BaseBlockHarshenSingleInventory; import kenijey.harshenuniverse.base.BaseTileEntityHarshenSingleItemInventory; import kenijey.harshenuniverse.tileentity.TileEntityHarshenSpawner; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemMonsterPlacer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class HarshenSpawner extends BaseBlockHarshenSingleInventory implements ITileEntityProvider { public HarshenSpawner() { super(Material.ROCK); setRegistryName("harshen_spawner"); setUnlocalizedName("harshen_spawner"); this.blockHardness=(-1); this.blockResistance=(-1); } @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if(playerIn.getHeldItem(hand).getItem() instanceof ItemMonsterPlacer || playerIn.getHeldItem(hand).getItem() == Item.getItemFromBlock(Blocks.AIR)) super.onBlockActivated(worldIn, pos, state, playerIn, hand, facing, hitX, hitY, hitZ); return playerIn.capabilities.isCreativeMode; } @Override public TileEntity createNewTileEntity(World worldIn, int meta) { return new TileEntityHarshenSpawner(); } @Override public BaseTileEntityHarshenSingleItemInventory getTile() { return new TileEntityHarshenSpawner(); } @SideOnly(Side.CLIENT) public BlockRenderLayer getBlockLayer() { return BlockRenderLayer.TRANSLUCENT; } @Override public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean p_185477_7_) { addCollisionBoxToList(pos, entityBox, collidingBoxes, NULL_AABB); } @Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { return new AxisAlignedBB(0.45f, 0.05f, 0.45f, 0.55f, 0.95f, 0.55f); } } this is what i've done with the block class. and this is its tile entity class: package kenijey.harshenuniverse.tileentity; import java.util.UUID; import kenijey.harshenuniverse.HarshenSounds; import kenijey.harshenuniverse.base.BaseTileEntityHarshenSingleItemInventory; import kenijey.harshenuniverse.config.GeneralConfig; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.IEntityLivingData; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemMonsterPlacer; import net.minecraft.item.ItemStack; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; public class TileEntityHarshenSpawner extends BaseTileEntityHarshenSingleItemInventory { private EntityLiving entityliving = null; private UUID spawnedEntityUUID = null; private ItemStack spawnedEntitysEgg = null; public Entity getEntity(ItemStack stack) { if(stack.getItem() == Item.getItemFromBlock(Blocks.AIR) || stack.equals(ItemStack.EMPTY)) { this.entityliving = null; return null; } try { entityliving = (EntityLiving) EntityList.createEntityByIDFromName(ItemMonsterPlacer.getNamedIdFrom(stack), world); entityliving.onInitialSpawn(world.getDifficultyForLocation(new BlockPos(entityliving)), (IEntityLivingData)null); spawnedEntitysEgg = stack; } catch (NullPointerException e) { } return this.entityliving; } @Override protected void tick() { EntityPlayer player = world.getClosestPlayer(pos.getX(), pos.getY(), pos.getZ(), GeneralConfig.harshenSpawnerDistance, false); if(player != null && getEntity(getItem()) != null && !player.isCreative()) activate(player); if(entityliving==null) for(Entity entity : world.loadedEntityList) if(entity.getUniqueID() == spawnedEntityUUID) { if(entityliving == null && !entity.isEntityAlive()) world.setBlockToAir(pos); if(entity.isEntityAlive() && (player == null || player.isCreative()) && entityliving == null) deactivate(spawnedEntitysEgg, entity); } } private void activate(EntityPlayer player) { setItemAir(); this.entityliving.setPosition(pos.getX()+0.5, pos.getY(), pos.getZ()+0.5); this.entityliving.setRotationYawHead(player.getPosition().subtract(pos).getY()); entityliving.onInitialSpawn(world.getDifficultyForLocation(new BlockPos(entityliving)), (IEntityLivingData)null); if(!world.isRemote) world.spawnEntity(this.entityliving); spawnedEntityUUID = entityliving.getUniqueID(); world.playSound(pos.getX(), pos.getY(), pos.getZ(), HarshenSounds.SPAWNER_SUMMON, SoundCategory.BLOCKS, 1f, 1f, false); } private void deactivate(ItemStack stack, Entity entity) { setItem(stack); entity.setDead(); } } BUT in the game, when a creeper or TNT explodes, the block just gets destroyed like a dirt block. And it doesn't happen with my other blocks, only this tile entity one. What did i miss? Thanks for helps.
  2. Well, i got some answers from somewhere, and it's sure. I can use JDK9+ on development, but can't benefit from its new features, and i must keep sourceCompatibility = targetCompatibility = '1.8' in the build.gradle. It's how and explanation for who wonders.
  3. So i need answer like this: "Forge will not support JDK 9/10 on MC 1.13" Or its inverse.
  4. I ask "Will Forge support Java 9 or 10 with Minecraft 1.13?", and they say "JDK 8 is recommended" in that topic, which not about my question. Will Forge support JDK 9+ or not? Because LexManos said that he is working on support for J9 a few months ago. So i'm wondering what's the progress we passed so far, does it support or will it support in 1.13.
  5. Will Forge support Java 9 or 10 with Minecraft 1.13? Can we use JDK 10 (yeah not 9, only 10, since the download page of Java presents only JDK 10, doesn't 9) on development? I very hope so.(cus compiling got "huge" boost on J9+) Thanks for answers, forgive me if i'm pointless at somewhere.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.