
LorenzoPapi
Members-
Posts
34 -
Joined
-
Last visited
Everything posted by LorenzoPapi
-
The fact is that in 1.12.2, my item changed colour of some parts depending on what the player was doing. Now I'm going to try the ISTER. Thanks!
-
I have a Java item model and I want to use it. In 1.12.2 I used the iChunUtil mod, but in 1.14.4 I don't know what to use. Since iChunUtil is open source, I saw the code and it used those methods you've seen up there. Is there a vanilla replacement?
-
I'm updating my mod to 1.14.4 and in 1.12.2 I used Minecraft.getInstance().getFramebuffer().isStencilEnabled() and Minecraft.getInstance().getFramebuffer().enableStencil() , but I don't find them in 1.14.4 version and these two methods weren't used in vanilla in 1.12.2. Were they removed?
-
Ok so, I have seen how the forceChunk method works, as you said it uses a similar ticket system and it uses TicketTypes, so you can know what forced the chunk to load. The problem may be that I used the ForgeChunkManager to make a special projectile entity load chunks, but I don't know where to start, since I should do something in the EntityEvent.EnteringChunk , but I don't know what to do.
-
Sorry for the late response. I knew about the forceload command, but I didn't find that method. I'll try it when I'll be back to my pc (~10 hours).
-
Hi! I was searching for the same thing and I came across this topic. Did you find the answer? And do I have to make my own topic or I can ask here?
-
Oh ok, thank you?
-
I've done this: in my 1.12.2 workspace I searched every place where "setFull3D" was called; it was called by BONE, STICK, and BLAZE_ROD in the item class, in which they were registered. in my 1.14.4 workspace I searched for BONE, STICK and BLAZE_ROD Fields, and I saw that they weren't using setFull3D or anything else, just "group" for the itemGroup. Then I asked here.
-
Bump bump
-
After 1.14.4 became the LTS, I had to update my 1.12.2 mod to 1.14.4. I was updating my items and I had a special item that called "setFull3D" method. I searched it in the Item class, but it got removed, just like "shouldRotateAroundWhenRendering". I've seen that BONE, BLAZE ROD and STICK used "setFull3D" method in 1.12.2, but there is nothing in the new version. Can someone help?
-
[1.12.2]Double-part block breaking problem
LorenzoPapi replied to LorenzoPapi's topic in Modder Support
Alright. Now it works. Thanks! -
[1.12.2]Double-part block breaking problem
LorenzoPapi replied to LorenzoPapi's topic in Modder Support
Oops. I totally confused facing.offset with BlockPos.offset Excuse my misunderstanding. I'll try this method when I'll go back to my pc. EDIT: @Draco18s, I don't find facing.offset property. -
[1.12.2]Double-part block breaking problem
LorenzoPapi replied to LorenzoPapi's topic in Modder Support
But as you said, I can't use offset, because the other "HALF" of the block won't be above or below. And btw I already have those two properties. -
[1.12.2]Double-part block breaking problem
LorenzoPapi replied to LorenzoPapi's topic in Modder Support
I really don't know how to do this. I've been thinking of how to do this (didn't code anything, since I didn't know what to write), but I had only an idea. Using another HOR_FACING property, but: 1) This HOR_FACING property should be null when the normal "FACING" property isn't DOWN or UP; 2) I think making another property just to check for a part of the block is completely useless. So this is what I have right now...nothing. Any kind of help would be appreciated. I'm going to bed now. -
[1.12.2]Double-part block breaking problem
LorenzoPapi replied to LorenzoPapi's topic in Modder Support
I didn't think about it. Thanks for explaining! Actually, this entire piece of code was copied and pasted from BlockDoor.class . And it works. Ikr? This is why I asked help on the forum. I was going crazy. Anyways, I've updated the repo: https://github.com/LorenzoPapi/Test-1.12.2 Some help would be amazing. -
[1.12.2]Double-part block breaking problem
LorenzoPapi replied to LorenzoPapi's topic in Modder Support
That's strange. This works for me. Don't care about comments, they're just sentences without any logic sometimes. One thing I don't understand. Why would always one condition be true? Does Minecraft says that if FACING isn't DOWN, it is UP? Maybe it's something I've missed. I'll change this tomorrow, I'm really tired. Anyways, maybe I haven't explained well. This block's placement acts like a bed on the floor, kinda like a door on the sides of a block and like an "upside-down" bed under the roof of a block. But I can't destroy both the parts of the block when it's placed on the floor and under the floor. -
I've got my "block_afp" block. It's formed by two parts, "TOP" and "DOWN". The block can be placed both on walls, on the floor and under the roof and it works perfectly but, when I break a part of the block, there's a problem. If the block isn't on the floor, the other part gets detroyed too. If the block IS on the floor, I don't know how to check for the other part to get destroyed. Here is a working and updated repo of my mod, with my test worlds too: https://github.com/LorenzoPapi/Test-1.12.2
-
Okay so, I'm switching to @ObjectHolder, but there is one problem with this. I've got to do a custom ModelResourceLocation and, when I pass the item, it crashes with NullPointerException. I've updated the repo. The error is here: https://github.com/LorenzoMontanoPecoraro/MyMod/blob/e4d2f97fdd316c20fa5c92fa20963042a00583ee/src/main/java/com/lorenzopapi/portalgun/common/init/ModItems.java#L92
-
Oops, I totally forgot about that ?. Here is the item class: package com.lorenzopapi.portalgun.common.item; import com.lorenzopapi.portalgun.common.PortalGun; import com.lorenzopapi.portalgun.common.block.BlockAFP; import com.lorenzopapi.portalgun.common.init.ModBlocks; import com.lorenzopapi.portalgun.common.util.Reference; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; public class ItemAFP extends ItemBlock { public ItemAFP(Block block) { super(block); this.setMaxStackSize(1); this.setMaxDamage(0); this.setRegistryName(Reference.MOD_ID, "item_aerial_faith_plate"); this.setCreativeTab(PortalGun.CREATIVE_TAB); } @Override public CreativeTabs getCreativeTab() { return PortalGun.CREATIVE_TAB; } @Override public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if (worldIn.isRemote) { return EnumActionResult.SUCCESS; } else if (facing != EnumFacing.UP) { return EnumActionResult.FAIL; } else { IBlockState iblockstate = worldIn.getBlockState(pos); Block block = iblockstate.getBlock(); boolean flag = block.isReplaceable(worldIn, pos); if (!flag) { pos = pos.up(); } int i = MathHelper.floor((double)(player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; EnumFacing enumfacing = EnumFacing.getHorizontal(i); BlockPos blockpos = pos.offset(enumfacing); ItemStack itemstack = player.getHeldItem(hand); if (player.canPlayerEdit(pos, facing, itemstack) && player.canPlayerEdit(blockpos, facing, itemstack)) { IBlockState iblockstate1 = worldIn.getBlockState(blockpos); boolean flag1 = iblockstate1.getBlock().isReplaceable(worldIn, blockpos); boolean flag2 = flag || worldIn.isAirBlock(pos); boolean flag3 = flag1 || worldIn.isAirBlock(blockpos); if (flag2 && flag3 && worldIn.getBlockState(pos.down()).isTopSolid() && worldIn.getBlockState(blockpos.down()).isTopSolid()) { IBlockState iblockstate2 = ModBlocks.blockAfp.getDefaultState().withProperty(BlockAFP.FACING, enumfacing).withProperty(BlockAFP.PART, BlockAFP.EnumPartType.TOP); worldIn.setBlockState(pos, iblockstate2, 10); worldIn.setBlockState(blockpos, iblockstate2.withProperty(BlockAFP.PART, BlockAFP.EnumPartType.DOWN), 10); //SoundType soundtype = iblockstate2.getBlock().getSoundType(iblockstate2, worldIn, pos, player); //worldIn.playSound((EntityPlayer)null, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F); TileEntity tileentity = worldIn.getTileEntity(blockpos); worldIn.notifyNeighborsRespectDebug(pos, block, false); worldIn.notifyNeighborsRespectDebug(blockpos, iblockstate1.getBlock(), false); itemstack.shrink(1); return EnumActionResult.SUCCESS; } else { return EnumActionResult.FAIL; } } else { return EnumActionResult.FAIL; } } } }
-
Basically, I've created a 2x1 block, using pieces of code from the BlockBed class. The problem is that when I use the item to place the block, the blocks are both without texture and, if I select them and press F3, I can see that the block is "minecraft:air". A strange fact is that, if I place the block with /setblock command, it gives texture and model. So, what may be the issue? When I use the item: When I do /setblock The model of my block: block_afp.jsonblock_afp_top.json The class of my block: package com.lorenzopapi.portalgun.common.block; import java.util.Random; import com.lorenzopapi.portalgun.common.init.ModItems; import com.lorenzopapi.portalgun.common.tileentity.TileEntityAFP; import com.lorenzopapi.portalgun.common.util.AABB; import net.minecraft.block.Block; import net.minecraft.block.BlockHorizontal; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.material.EnumPushReaction; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockFaceShape; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.IStringSerializable; import net.minecraft.util.Rotation; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class BlockAFP extends BlockHorizontal implements ITileEntityProvider { public static final PropertyEnum<BlockAFP.EnumPartType> PART = PropertyEnum.<BlockAFP.EnumPartType>create("part", BlockAFP.EnumPartType.class); protected static final AABB AFP_X_AABB = new AABB(0, 0, 2, 16, 1, 14); protected static final AABB AFP_Z_AABB = new AABB(2, 0, 0, 14, 1, 16); public BlockAFP() { super(Material.CIRCUITS); this.setDefaultState(this.getBlockState().getBaseState().withProperty(PART, BlockAFP.EnumPartType.TOP).withProperty(FACING, EnumFacing.NORTH)); this.hasTileEntity = true; } @Override public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) { BlockPos blockpos = pos; if (state.getValue(PART) == BlockAFP.EnumPartType.TOP) { blockpos = pos.offset((EnumFacing)state.getValue(FACING)); } TileEntity tileentity = worldIn.getTileEntity(blockpos); return new ItemStack(Items.BED, 1); } @Override public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) { if (player.capabilities.isCreativeMode && state.getValue(PART) == BlockAFP.EnumPartType.TOP) { BlockPos blockpos = pos.offset((EnumFacing)state.getValue(FACING)); if (worldIn.getBlockState(blockpos).getBlock() == this) { worldIn.setBlockToAir(blockpos); } } } @Override public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) { EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); if (state.getValue(PART) == BlockAFP.EnumPartType.TOP) { if (worldIn.getBlockState(pos.offset(enumfacing)).getBlock() != this) { worldIn.setBlockToAir(pos); } } else if (worldIn.getBlockState(pos.offset(enumfacing.getOpposite())).getBlock() != this) { if (!worldIn.isRemote) { this.dropBlockAsItem(worldIn, pos, state, 0); } worldIn.setBlockToAir(pos); } } @Override public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, TileEntity te, ItemStack stack) { if (state.getValue(PART) == BlockAFP.EnumPartType.DOWN && te instanceof TileEntityAFP) { TileEntityAFP tileentityafp = (TileEntityAFP)te; ItemStack itemstack = tileentityafp.getItemStack(); spawnAsEntity(worldIn, pos, itemstack); } else { super.harvestBlock(worldIn, player, pos, state, (TileEntity)null, stack); } } @Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { EnumFacing enumfacing = state.getValue(FACING); return enumfacing.getAxis() == EnumFacing.Axis.X ? AFP_X_AABB.toAABB() : AFP_Z_AABB.toAABB(); } @Override public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) { EnumFacing enumfacing = placer.getHorizontalFacing(); return super.getStateForPlacement(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer, hand).withProperty(FACING, enumfacing); } @Override public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { return new ItemStack(ModItems.itemAFP, 1); } @Override public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) { if (world.getBlockState(pos.down()).getBlock() != Blocks.AIR) { return world.getBlockState(pos.down()).getBlock().getLightValue(state, world, pos.down()); } return 0; } @Override public IBlockState getStateFromMeta(int meta) { EnumFacing enumfacing = EnumFacing.getHorizontal(meta); return (meta & 4) > 0 ? this.getDefaultState().withProperty(PART, BlockAFP.EnumPartType.DOWN).withProperty(FACING, enumfacing) : this.getDefaultState().withProperty(PART, BlockAFP.EnumPartType.TOP).withProperty(FACING, enumfacing); } @Override public int getMetaFromState(IBlockState state) { int i = 0; i = i | (state.getValue(FACING)).getHorizontalIndex(); if (state.getValue(PART) == BlockAFP.EnumPartType.DOWN) { i |= 4; } return i; } @Override public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { super.breakBlock(worldIn, pos, state); worldIn.removeTileEntity(pos); } @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, new IProperty[] { FACING, PART }); } @Override public IBlockState withRotation(IBlockState state, Rotation rot) { return state.withProperty(FACING, rot.rotate(state.getValue(FACING))); } @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { return state.getValue(PART) == BlockAFP.EnumPartType.TOP ? Items.AIR : ModItems.itemAFP; } public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) { return BlockFaceShape.UNDEFINED; } @Override public boolean hasTileEntity(IBlockState state) { return true; } @Override public boolean isOpaqueCube(IBlockState state) { return false; } @Override public boolean isFullCube(IBlockState state) { return false; } @Override public EnumPushReaction getMobilityFlag(IBlockState state) { return EnumPushReaction.DESTROY; } @Override public TileEntity createNewTileEntity(World worldIn, int meta) { return new TileEntityAFP(); } /*@Override public IBlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(FACING, EnumFacing.getHorizontal(meta & 3)); } @Override public int getMetaFromState(IBlockState state) { int i = 0; i = i | state.getValue(FACING).getHorizontalIndex(); return i; }*/ public static enum EnumPartType implements IStringSerializable { DOWN("down"), TOP("top"); private final String name; private EnumPartType(String name) { this.name = name; } public String toString() { return this.name; } public String getName() { return this.name; } } } And also, do you know why, even if my textures are transparent, there isn't transparency?