ElTotisPro50
Members-
Posts
266 -
Joined
-
Last visited
-
Days Won
1
Everything posted by ElTotisPro50
-
Hi i made a block and i added ladder properties, but my block doesnt even put, i made the blockstate the same as the ladder with the N,S,W,E variants but nothing: package net.totis.totismod.block.custom; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.HorizontalBlock; import net.minecraft.fluid.FluidState; import net.minecraft.fluid.Fluids; import net.minecraft.item.BlockItemUseContext; import net.minecraft.state.DirectionProperty; import net.minecraft.state.StateContainer; import net.minecraft.util.Direction; import net.minecraft.util.Mirror; import net.minecraft.util.Rotation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorld; import net.minecraft.world.IWorldReader; import javax.annotation.Nullable; public class BloodBlock extends Block { public static final DirectionProperty FACING = HorizontalBlock.HORIZONTAL_FACING; protected static final VoxelShape BLOOD_EAST_AABB = Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 3.0D, 16.0D, 16.0D); protected static final VoxelShape BLOOD_WEST_AABB = Block.makeCuboidShape(13.0D, 0.0D, 0.0D, 16.0D, 16.0D, 16.0D); protected static final VoxelShape BLOOD_SOUTH_AABB = Block.makeCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 16.0D, 3.0D); protected static final VoxelShape BLOOD_NORTH_AABB = Block.makeCuboidShape(0.0D, 0.0D, 13.0D, 16.0D, 16.0D, 16.0D); public BloodBlock(Properties properties) { super(properties); this.setDefaultState(this.getDefaultState().with(FACING, Direction.NORTH)); } public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) { switch((Direction)state.get(FACING)) { case NORTH: return BLOOD_NORTH_AABB; case SOUTH: return BLOOD_SOUTH_AABB; case WEST: return BLOOD_WEST_AABB; case EAST: default: return BLOOD_EAST_AABB; } } private boolean canAttachTo(IBlockReader blockReader, BlockPos pos, Direction direction) { BlockState blockstate = blockReader.getBlockState(pos); return blockstate.isSolidSide(blockReader, pos, direction); } public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos pos) { Direction direction = state.get(FACING); return this.canAttachTo(worldIn, pos.offset(direction.getOpposite()), direction); } @Nullable public BlockState getStateForPlacement(BlockItemUseContext context) { if (!context.replacingClickedOnBlock()) { BlockState blockstate = context.getWorld().getBlockState(context.getPos().offset(context.getFace().getOpposite())); if (blockstate.matchesBlock(this) && blockstate.get(FACING) == context.getFace()) { return null; } } BlockState blockstate1 = this.getDefaultState(); IWorldReader iworldreader = context.getWorld(); BlockPos blockpos = context.getPos(); FluidState fluidstate = context.getWorld().getFluidState(context.getPos()); for(Direction direction : context.getNearestLookingDirections()) { if (direction.getAxis().isHorizontal()) { blockstate1 = blockstate1.with(FACING, direction.getOpposite()); } } return null; } public BlockState rotate(BlockState state, Rotation rot) { return state.with(FACING, rot.rotate(state.get(FACING))); } /** * Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed * blockstate. */ public BlockState mirror(BlockState state, Mirror mirrorIn) { return state.rotate(mirrorIn.toRotation(state.get(FACING))); } protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) { builder.add(FACING); } } i dont know why my block isnt working but minecraft is not crashing or throwing errors...
-
Bounce animation for my entities doesnt work correctly
ElTotisPro50 posted a topic in Modder Support
I made a entity and i want to give it an animation by code(becaue geckolib doesnt work for java anymore ) and i saw 2 mods named panduras creatures and mowzies mobs that use their one methods for make the animation easier, but it doesnt work for me or at least correctly: public static void bounce(ModelRenderer model, float speed, float degree, boolean bouncy, float f, float f1) { float bounce = (float) (Math.sin(f * speed) * f1 * degree - f1 * degree); if (bouncy) { bounce = (float) -Math.abs((Math.sin(f * speed) * f1 * degree)); } model.rotationPointY += bounce; } This exact code make the entity bounce up and down a bit, if i use the bounce method + what i saw on the video: limbSwing = entity.ticksExisted; limbSwingAmount = 0.5f; float globalHeight = 1f; float globalSpeed = 1f; float globalDegree = 1f; Animations.bounce(root, 1F * globalSpeed, 2F * globalHeight, true, limbSwing, limbSwingAmount); the model just elevates and doesnt stop, and i discovered that instead of model.rotationPointY += bounce i have to put model.rotationPointY = bounce: the entity bounces but it elevates half a block, https://imgur.com/a/uREqwih i tried to subtract the Math, the bounce float, but i cant put the entity in the ground(it bounces but i dont need my entity half a block up) -
Hi, i made a entity and if i put my animations in "setRotationAngles" the animation plays when the entity moves, but i want to make separated animations for when the entity died, moved, jumped, idle, etc, like if(entityIn.WALKING or entityIn.IS_IDLE or entityIn.DIED) @Override public void setRotationAngles(T entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) { if(entityIn.isWalking) //an example { //my animation for walking this.root.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 0.3F * limbSwingAmount; } if(entityIn.isIdle) { //my animation for idle this.root.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 0.3F * limbSwingAmount; } }
-
Hi, i have a TickEvent.PlayerTickEvent event(by the way the class of the events works correctly) im using this because is like a loop, im trying to detect an item: if(stack.getItem().equals(ModItems.MYITEM)) and it throws the invalid hand null @SubscribeEvent public static void testEvent(TickEvent.PlayerTickEvent event) { PlayerEntity player = event.player; World world = event.player.world; ItemStack stack = player.getHeldItem(player.getActiveHand()); if(stack.getItem().equals(ModItems.MYITEM)) { //dosomething } } minecraft crashes when the world is loaded...
-
RenderPlayerEvent is not working(1.16.5)
ElTotisPro50 replied to ElTotisPro50's topic in Modder Support
:/, im not lazy is just that i dont know how to "analyze" the code created by mojang but i have no choice, thanks for nothing -
I want to debug in intellij but when i click the debug icon it runs like normal, and if you go to top right(Gradle icon), normally i use runClient but if i try runServer minecraft doesnt open, or runServer with debug(https://imgur.com/a/KuSUqwt), (the eula.txt file has eula=true just in case) before minecraft window open it close with no errors, like if i closed it on purpose
-
RenderPlayerEvent is not working(1.16.5)
ElTotisPro50 replied to ElTotisPro50's topic in Modder Support
affter a bit of time this worked: @SubscribeEvent public static void renderPlayerPre(RenderPlayerEvent.Pre event) { //here i was canceling the pre event so... event.getRenderer().getEntityModel().bipedLeftArm.showModel = false; } @SubscribeEvent public static void renderPlayerPost(RenderPlayerEvent.Post event) { PlayerEntity player = event.getPlayer(); PlayerModel<AbstractClientPlayerEntity> model = event.getRenderer().getEntityModel(); ModelRenderer rightArm = model.bipedLeftArm; rightArm.showModel = true; rightArm.render( event.getMatrixStack(), event.getBuffers().getBuffer(RenderType.getEntitySolid(((AbstractClientPlayerEntity)player).getLocationSkin())), Minecraft.getInstance().getRenderManager().getPackedLight(player, 1f), OverlayTexture.NO_OVERLAY); } But just one more thing, i promess no more questions..., the hand is like this: https://imgur.com/a/KTVudC3, and there is no offsetX, Y, or Z, do i need arm.rotationPointSOMETHING to move the hand wherever i want? -
RenderPlayerEvent is not working(1.16.5)
ElTotisPro50 replied to ElTotisPro50's topic in Modder Support
rightArm.render( event.getMatrixStack(), event.getBuffers().getBuffer(RenderType.entitySolid(((AbstractClientPlayerEntity)player).getSkinTextureLocation())), Minecraft.getInstance().getEntityRenderDispatcher().getPackedLightCoords(player, 1f), OverlayTexture.NO_OVERLAY); has errors, im using the forge mappings :/, getEntityRenderDispatcher does not exist... im so angry because mojang ALL THE TIME has to change almost the entire code of minecraft, in 1.12.2 you needed 1 LINE OF CODE, wtf (There are like 3 things that doest exist, getEntityRenderDispatcher , getSkinTextureLocation, getPackedLightCoords(player, 1f)) -
RenderPlayerEvent is not working(1.16.5)
ElTotisPro50 replied to ElTotisPro50's topic in Modder Support
Nope, i need a example with code, because i dont know what you mean by "On PlayerRenderEvent.Pre and .Post", im using a key event to work, RenderPlayerEvent is a minecraft class and i cant modify it, i dont know what you mean by that, even if that sound silly thats how i program, i cant just read a solution and do it because i dont know how to do it i need a example, most programers dont need a guide with examples but i do, even i know java, c++ and python -
RenderPlayerEvent is not working(1.16.5)
ElTotisPro50 replied to ElTotisPro50's topic in Modder Support
Ok i didnt undertand absolutely anything, even that i learned minecraft modding 1 year ago, can you post a image with code of how can i do that please? -
RenderPlayerEvent is not working(1.16.5)
ElTotisPro50 replied to ElTotisPro50's topic in Modder Support
Is not working -
Hi, i made a keybind and when i press it it should modify my player, like the rotation of any part or something but it is doing nothing @SubscribeEvent public static void playerRotations(RenderPlayerEvent.Pre event) { if(ModKeys.testKey.isKeyDown()) { event.getPlayer().sendStatusMessage(new StringTextComponent("Hola"),false); event.getRenderer().getEntityModel().bipedRightArm.rotateAngleX = 180f; } } It is sending the message but is not rotating my arm, or head or anything that i put after .biped, i also tried RenderPlayerEvent.Post and is not working neither,as I said is not the playerRotations() event because is displaying the message and i have more events in this class that does work, i tried using math: event.getRenderer().getEntityModel().bipedRightArm.rotateAngleX = (float) Math.toRadians(180f); but nothing is working, i need a solution because i made this in 1.12.2 and it worked, the only thing that changed was .getEntityModel(), in 1.12.2 it was getMainModel()
-
Hi, i have a storage block, with a container, when i try to open my gui it doesnt do anything, i made a furnace too, a chest with different slots, a container that have to be opened with a modded item, all works perfectly, game doesnt crash, any error, but i just cant open the gui, :( Please help me ---------------------------------------------------------------------------------------------------------------- Principal Block Class: https://pastebin.com/eFtjtDKY Container Class: https://pastebin.com/BZ3QtB2M Gui Class: https://pastebin.com/52gCaDVE The TileEntity Class: https://pastebin.com/XFTDzLPK Reference Class: https://pastebin.com/tqZ7kSa5 GuiHandler: https://pastebin.com/SipAz4Vc TileEntityHandler: https://pastebin.com/iFBJxqUM RegistryHandler: https://pastebin.com/LDi2wvyP ---------------------------------------------------------------------------------------------------------------- I keep thinking that the problem is in the Principal Block Class but i dont know, i really need this :( Minecraft Version: 1.12.2