Everything posted by Yurim64
-
Sound is not reproduced [1.16.5]
There are no errors, the sound is loaded correctly. Now i try to use ClientTickEvent and see if something changes
-
Problem Refreshing Screen GUI [1.16.5]
Ok, so I need a custom slot? Because the index pointed by a Slot is marked as final.
-
Sound is not reproduced [1.16.5]
dove dovrei riprodurre il suono? e come? I call the update Siren here, in my Client Event Handler: @SubscribeEvent public void onKeyInput(InputEvent.KeyInputEvent event) { if (Minecraft.getInstance().player == null) return; if (ClientProxy.KEY_CYCLE_SEATS.isPressed() && event.getAction() == GLFW.GLFW_PRESS) { if (Minecraft.getInstance().player.getRidingEntity() instanceof VehicleEntity) { PacketHandler.instance.sendToServer(new MessageCycleSeats()); } } if (ClientProxy.KEY_AMBULANCE_SIREN.isPressed() && event.getAction() == GLFW.GLFW_PRESS) { Entity entity = Minecraft.getInstance().player.getRidingEntity(); if (entity instanceof AmbulanceEntity) { ((AmbulanceEntity) entity).updateSiren(); } } }
-
Problem Refreshing Screen GUI [1.16.5]
Hi! I was creating a GUI with a scroll pane, but when i scroll up or down with the mouse (the button is not implemented yet) the GUI will not update until i click on a slot with an item. How can i resolve this problem? This is the Screen Code: public class ColossalChestScreen extends BaseChestScreen { private ColossalChestContainer colossalContainer; public ColossalChestScreen(BaseChestContainer container, PlayerInventory inventory, ITextComponent title) { super(container, inventory, title); if (container instanceof ColossalChestContainer) this.colossalContainer = (ColossalChestContainer) container; else throw new IllegalArgumentException("Invalid Container for Colossal Chest"); this.imageHeight = 204; this.imageWidth = 197; this.inventoryLabelY = 110; this.bgLocation = new ResourceLocation(TenChest.MODID, "textures/gui/colossal_chest_gui.png"); } @Override public boolean mouseScrolled(double x, double y, double movement) { System.out.println("Trying to scroll off " + (-movement)); this.colossalContainer.scrollOff((int) -movement); return super.mouseScrolled(x, y, movement); } } This is the Container Screen: public class ColossalChestContainer extends BaseChestContainer { public static ColossalChestContainer defaultContainer(int id, IInventory inventory, PlayerInventory playerInventory) { return new ColossalChestContainer(id, inventory, playerInventory); } public static ColossalChestContainer defaultContainer(int id, PlayerInventory inventory) { return new ColossalChestContainer(id, new Inventory(9 * MAX_ROWS), inventory); } public static final int MAX_ROWS = 12; private static final int VISIBLE_ROWS = 5; private int startingRow = 0; public ColossalChestContainer(int id, IInventory inventory, PlayerInventory playerInventory) { super(BaseChestContainerType.COLOSSAL_CHEST.get(), id, inventory, playerInventory); } @Override protected void generateSlot(PlayerInventory playerInventory) { int index = 0; for (int i = 0; i < VISIBLE_ROWS; i++) { for (int j = 0; j < 9; j++) { this.addSlot(new Slot(this.inventory, index++, 12 + (j * 18), 18 + (i * 18))); } } index = 0; for (int i = 0; i < 9; i++) { this.addSlot(new Slot(playerInventory, index++, 12 + (i * 18), 181)); } for (int i = 0; i < 3; i++) { for (int j = 0; j < 9; j++) { this.addSlot(new Slot(playerInventory, index++, 12 + (j * 18), 123 + (18 * i))); } } } public void scrollOff(int val) { this.scrollTo(this.startingRow + val); } public void scrollTo(int row) { if (canScrollTo(row)) { this.startingRow = row; System.out.println("Changed First Row Index to: " + this.startingRow); int index = 0; for (int i = 0; i < VISIBLE_ROWS; i++) { for (int j = 0; j < 9; j++) { int inventoryIndex = (this.startingRow * 9) + index; System.out.println("Inventory Slot Visible at: " + index + " -> " + inventoryIndex); this.setItem(index, this.inventory.getItem(inventoryIndex)); index++; } } } else { System.out.println("Can't Scroll To " + row); } } public boolean canScrollTo(int rows) { return rows >= 0 && rows + VISIBLE_ROWS <= MAX_ROWS; } }
-
Sound is not reproduced [1.16.5]
Hi! I was making a custom ambulance, and when i press the key "b", it should play the siren sound effect, but it doesn't. Can someone help? This is Where i Call the Sound: public class AmbulanceEntity extends VehicleEntity { private boolean sirenActivate; public AmbulanceEntity(EntityType<? extends AmbulanceEntity> type, World worldIn) { super(type, worldIn); this.setMaxSpeed(20F); this.sirenActivate = false; } public boolean isSirenOn() { return this.sirenActivate; } public void updateSiren() { this.sirenActivate = !this.sirenActivate; if (this.sirenActivate) { AmbulanceSirenSound sound = new AmbulanceSirenSound(this); System.out.println("Add Sound"); Minecraft.getInstance().getSoundHandler().play(sound); } PacketHandler.instance.sendToServer(new MessageAmbulanceSirenChange(this.sirenActivate)); } public void setSirenActivate(boolean sirenActivate) { this.sirenActivate = sirenActivate; } } The Ambulance Sound Class: public class AmbulanceSirenSound extends TickableSound { private AmbulanceEntity refEntity; public AmbulanceSirenSound(AmbulanceEntity entity) { super(ModSounds.AMBULANCE_SIREN.get(), SoundCategory.MUSIC); this.refEntity = entity; this.repeat = true; this.repeatDelay = 0; this.volume = 0.8F; this.pitch = 0.85F; } @Override public void tick() { if (this.refEntity == null || Minecraft.getInstance().player == null) { this.func_239509_o_(); return; } if (refEntity.isSirenOn() && this.refEntity.getPassengers().size() > 0) { PlayerEntity localPlayer = Minecraft.getInstance().player; this.x = (float) (this.refEntity.getPosX() + (localPlayer.getPosX() - this.refEntity.getPosX()) * 0.65); this.y = (float) (this.refEntity.getPosY() + (localPlayer.getPosY() - this.refEntity.getPosY()) * 0.65); this.z = (float) (this.refEntity.getPosZ() + (localPlayer.getPosZ() - this.refEntity.getPosZ()) * 0.65); System.out.println("Sound Tick"); } else { //refEntity.sirenOff(); this.func_239509_o_(); } } }
-
defineId called for[1.16.5]
Yeah, i changed it, you can see on the link of pastebin. Did you have some tutorial to suggest to me for using ModelRenderer?
-
defineId called for[1.16.5]
Thanks, now my entity is displayed. Could I ask you for a tutorial for using ModelRenderers? I am not a great expert in this field, and I would like to understand how they work, how to create them in a personalized way and so on. Even the part of the texture on how it is rendered I am not familiar with it, I am going a little blind.
-
defineId called for[1.16.5]
Ok so, I cleaned up the code as you advised me and now I have these classes, but despite this I can't render the model and I don't understand why. It doesn't even show the shadow below, it has no collisions and more. How can I do? I can't find any valid tutorials for 16.5. Here is the files: The Entity Class: https://pastebin.com/AYZ0jN2g The Entity Renderer: https://pastebin.com/3yYX2UxK The Entity Model: https://pastebin.com/AvxakRaH The Registry: https://pastebin.com/U6bE24Ts The Main Mod Class: https://pastebin.com/rDmrLAFA The lastest debug.log: https://pastebin.com/bGgZL408 (There is nothing strange in my opinion, the initial warning has disappeared) For the Attributes, i can't use the EntityAttributeCreationEvent because i only for LivingEntity, and my TestVehicleEntity is not a subclass of LivingEntity.
-
defineId called for[1.16.5]
Ok, thanks for the suggestions. How can i add attributes to my entity? I tried using RenderRegistry.registerEntityRenderingHandler (); The "defineId called for" warning is gone, but it doesn't render the entity anyway.
-
defineId called for[1.16.5]
Hi! I'm adding a new entities in minecraft 1.16.5, but when i spawn it, it doesn't render and on the console it send a warning: This is the console: [17:29:18] [Server thread/WARN] [minecraft/EntityDataManager]: defineId called for: class net.minecraft.entity.item.minecart.AbstractMinecartEntity from class com.ike.ambulancemod.entity.veichle.ambulance.AmbulanceEntity [17:29:18] [Server thread/WARN] [minecraft/EntityDataManager]: defineId called for: class net.minecraft.entity.item.minecart.AbstractMinecartEntity from class com.ike.ambulancemod.entity.veichle.ambulance.AmbulanceEntity [17:29:18] [Server thread/INFO] [minecraft/MinecraftServer]: [Dev: Summoned new entity.ambulance.ambulance] [17:29:18] [Render thread/INFO] [minecraft/NewChatGui]: [CHAT] Summoned new entity.ambulance.ambulance [17:29:34] [Server thread/INFO] [minecraft/MinecraftServer]: [Dev: Summoned new entity.ambulance.ambulance] [17:29:34] [Render thread/INFO] [minecraft/NewChatGui]: [CHAT] Summoned new entity.ambulance.ambulance This is the Entity Class: public class AmbulanceEntity extends Entity { private int seat = 2; private static final DataParameter<Integer> DATA_ID_DISPLAY_BLOCK = EntityDataManager.defineId(AbstractMinecartEntity.class, DataSerializers.INT); private static final DataParameter<Boolean> DATA_ID_CUSTOM_DISPLAY = EntityDataManager.defineId(AbstractMinecartEntity.class, DataSerializers.BOOLEAN); public AmbulanceEntity(EntityType<? extends AmbulanceEntity> type, World world) { super(type, world); } public AmbulanceEntity(World world) { super(AmbulanceType.getType(), world); } //Stuff For Vehicle @Override protected void addPassenger(Entity passenger) { super.addPassenger(passenger); } @Override protected boolean canAddPassenger(Entity passenger) { return super.canAddPassenger(passenger); } //================================================== @Override public void load(CompoundNBT nbt) { super.load(nbt); } @Override public boolean save(CompoundNBT nbt) { return super.save(nbt); } @Override protected void defineSynchedData() { this.entityData.define(DATA_ID_DISPLAY_BLOCK, Block.getId(Blocks.AIR.defaultBlockState())); this.entityData.define(DATA_ID_CUSTOM_DISPLAY, true); } @Override protected void readAdditionalSaveData(CompoundNBT p_70037_1_) { } @Override public int getId() { return super.getId(); } @Override protected void addAdditionalSaveData(CompoundNBT p_213281_1_) { } @Override public IPacket<?> getAddEntityPacket() { return new SSpawnObjectPacket(this); } @Override public void tick() { super.tick(); } } This is where i add the Entity and the Model: public class AmbulanceMod { public static final String MODID = "ambulance"; private static final Logger LOGGER = LogManager.getLogger(); public AmbulanceMod() { FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); ForgeRegistries.ENTITIES.register(AmbulanceType.getType()); } private void setup(final FMLCommonSetupEvent event) { //TODO Add renderer Minecraft.getInstance().getEntityRenderDispatcher().register(AmbulanceType.getType(), new AmbulanceRenderer<>(Minecraft.getInstance().getEntityRenderDispatcher())); } } This is the renderer: public class AmbulanceRenderer<T extends AmbulanceEntity> extends EntityRenderer<T> { private EntityModel model = new AmbulanceModel(); public AmbulanceRenderer(EntityRendererManager rendererManager) { super(rendererManager); } @Override public void render(T entity, float f_1, float f_2, MatrixStack matrix, IRenderTypeBuffer buffer, int light) { super.render(entity, f_1, f_2, matrix, buffer, light); matrix.pushPose(); IVertexBuilder ivertexbuilder = buffer.getBuffer(RenderType.armorCutoutNoCull(this.getTextureLocation(entity))); System.out.println("Ok"); this.model.renderToBuffer(matrix, ivertexbuilder, light, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F); matrix.popPose(); } @Override public ResourceLocation getTextureLocation(T p_110775_1_) { ResourceLocation resourceLocation = new ResourceLocation(AmbulanceMod.MODID, "model/ambulance"); System.out.println(resourceLocation); return resourceLocation; } } Can someone help?
-
Using Blender Model for custom minecart [1.16.5]
The file has .obj as extension, extracted from blender
-
Using Blender Model for custom minecart [1.16.5]
Hi! Could anyone tell me how I can use Blender models as models for entities? (in this case a custom minecart) Around I find only old tutorials for 1.10 or earlier.
-
TileEntity in multiple blocks [1.16.5]
How can I make multiple blocks interact with a single main TileEntity? Maybe I could create a TileEntity for the ColossalChestPart to which I pass the main TileEntity?
-
TileEntity in multiple blocks [1.16.5]
Hi! I was creating a block that is bigger than 1x1x1 with a custom tile entity. When i place the block, a part of the struct is spawned around (for now 1 single block above) and the tile entity is copied in the other position of the struct, but it result to be null. Here is the code: The Central Block: public class ColossalChest extends BaseChestBlock { protected static final int SIZE = 5; public ColossalChest() { super(Block.Properties.of(Material.METAL), BaseChestTileEntityType.COLOSSAL_CHEST::get); } @Override public void playerWillDestroy(World world, BlockPos pos, BlockState state, PlayerEntity player) { super.playerWillDestroy(world, pos, state, player); destroyStructure(world, pos); } private static final BlockState AIR = Blocks.AIR.defaultBlockState(); private void destroyStructure(World world, BlockPos pos) { final BlockState STRUCT_BLOCK = com.ike.tenchest.Blocks.COLOSSAL_CHEST_PART.get().defaultBlockState(); world.setBlockAndUpdate(pos, AIR); world.setBlockEntity(pos, null); BlockPos above = pos.above(); if (world.getBlockState(above).equals(STRUCT_BLOCK)) destroyStructure(world, above); BlockPos west = pos.west(); if (world.getBlockState(west).equals(STRUCT_BLOCK)) destroyStructure(world, west); BlockPos east = pos.east(); if (world.getBlockState(east).equals(STRUCT_BLOCK)) destroyStructure(world, east); BlockPos south = pos.south(); if (world.getBlockState(south).equals(STRUCT_BLOCK)) destroyStructure(world, south); BlockPos north = pos.north(); if (world.getBlockState(north).equals(STRUCT_BLOCK)) destroyStructure(world, north); BlockPos below = pos.below(); if (world.getBlockState(below).equals(STRUCT_BLOCK)) destroyStructure(world, below); } @Override public void setPlacedBy(World world, BlockPos pos, BlockState state, @Nullable LivingEntity entity, ItemStack stack) { if (entity instanceof PlayerEntity) { placeStructure(world, pos); } super.setPlacedBy(world, pos, state, entity, stack); } private void placeStructure(World world, BlockPos center) { final BlockState STRUCT_BLOCK = com.ike.tenchest.Blocks.COLOSSAL_CHEST_PART.get().defaultBlockState(); TileEntity blockEntity = world.getBlockEntity(center); System.out.println(blockEntity); BlockPos above = center.above(); world.setBlockAndUpdate(above, STRUCT_BLOCK); world.setBlockEntity(above, blockEntity); } @Override public boolean hasTileEntity(BlockState state) { return true; } @Nullable @Override public TileEntity createTileEntity(BlockState state, IBlockReader world) { return new ColossalChestTileEntity(); } } And the Block of the struct: public class ColossalChestPart extends Block { public ColossalChestPart() { super(AbstractBlock.Properties.of(Material.BARRIER).strength(-1.0F, 3600000.8F).noDrops().noOcclusion()); } @Override public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult rayTrace) { if (world.isClientSide) { return ActionResultType.SUCCESS; } else { INamedContainerProvider inamedcontainerprovider = this.getMenuProvider(state, world, pos); System.out.println(inamedcontainerprovider); if (inamedcontainerprovider != null) { player.openMenu(inamedcontainerprovider); player.awardStat(Stats.CUSTOM.get(Stats.OPEN_CHEST)); PiglinTasks.angerNearbyPiglins(player, true); } return ActionResultType.CONSUME; } } @Nullable @Override public INamedContainerProvider getMenuProvider(BlockState state, World world, BlockPos pos) { TileEntity entity = world.getBlockEntity(pos); System.out.println(entity); return entity instanceof INamedContainerProvider ? (INamedContainerProvider) entity : null; } public boolean propagatesSkylightDown(BlockState p_200123_1_, IBlockReader p_200123_2_, BlockPos p_200123_3_) { return true; } public BlockRenderType getRenderShape(BlockState p_149645_1_) { return BlockRenderType.INVISIBLE; } @OnlyIn(Dist.CLIENT) public float getShadeBrightness(BlockState p_220080_1_, IBlockReader p_220080_2_, BlockPos p_220080_3_) { return 1.0F; } } In the getMenuProvider function of the ColossalChestPart the TileEntity result to be Null.
-
Player ModelRederer [1.16.5]
Hi! I would like to render the second layer of the player skins in 3D, but when I even try to change the position of the player's hat, nothing changes. Here is the Class: public class SkinLayerRenderer extends LivingRenderer<AbstractClientPlayerEntity, PlayerModel<AbstractClientPlayerEntity>> { public SkinLayerRenderer(EntityRendererManager p_i46102_1_) { this(p_i46102_1_, false); } public SkinLayerRenderer(EntityRendererManager p_i46103_1_, boolean p_i46103_2_) { super(p_i46103_1_, new PlayerModel<>(0.0F, p_i46103_2_), 0.5F); this.addLayer(new BipedArmorLayer<>(this, new BipedModel(0.5F), new BipedModel(1.0F))); this.addLayer(new HeldItemLayer<>(this)); this.addLayer(new ArrowLayer<>(this)); this.addLayer(new Deadmau5HeadLayer(this)); this.addLayer(new CapeLayer(this)); this.addLayer(new HeadLayer<>(this, .5f, .5f, .5f)); //index = 5 this.addLayer(new ElytraLayer<>(this)); this.addLayer(new ParrotVariantLayer<>(this)); this.addLayer(new SpinAttackEffectLayer<>(this)); this.addLayer(new BeeStingerLayer<>(this)); } public void render(AbstractClientPlayerEntity player, float f1, float f2, MatrixStack matrix, IRenderTypeBuffer buffer, int n) { this.setModelProperties(player); this.model.hat.visible = true; this.model.hat.y = 10; this.model.hat.z = 10; this.model.hat.x = 10; super.render(player, f1, f2, matrix, buffer, n); } public Vector3d getRenderOffset(AbstractClientPlayerEntity player, float f1) { return player.isCrouching() ? new Vector3d(0.0D, -0.125D, 0.0D) : super.getRenderOffset(player, f1); } private void setModelProperties(AbstractClientPlayerEntity player) { PlayerModel<AbstractClientPlayerEntity> playermodel = this.getModel(); if (player.isSpectator()) { playermodel.setAllVisible(false); playermodel.head.visible = true; playermodel.hat.visible = true; } else { playermodel.setAllVisible(true); playermodel.hat.visible = player.isModelPartShown(PlayerModelPart.HAT); playermodel.jacket.visible = player.isModelPartShown(PlayerModelPart.JACKET); playermodel.leftPants.visible = player.isModelPartShown(PlayerModelPart.LEFT_PANTS_LEG); playermodel.rightPants.visible = player.isModelPartShown(PlayerModelPart.RIGHT_PANTS_LEG); playermodel.leftSleeve.visible = player.isModelPartShown(PlayerModelPart.LEFT_SLEEVE); playermodel.rightSleeve.visible = player.isModelPartShown(PlayerModelPart.RIGHT_SLEEVE); playermodel.crouching = player.isCrouching(); BipedModel.ArmPose bipedmodel$armpose = getArmPose(player, Hand.MAIN_HAND); BipedModel.ArmPose bipedmodel$armpose1 = getArmPose(player, Hand.OFF_HAND); if (bipedmodel$armpose.isTwoHanded()) { bipedmodel$armpose1 = player.getOffhandItem().isEmpty() ? BipedModel.ArmPose.EMPTY : BipedModel.ArmPose.ITEM; } if (player.getMainArm() == HandSide.RIGHT) { playermodel.rightArmPose = bipedmodel$armpose; playermodel.leftArmPose = bipedmodel$armpose1; } else { playermodel.rightArmPose = bipedmodel$armpose1; playermodel.leftArmPose = bipedmodel$armpose; } } } private static BipedModel.ArmPose getArmPose(AbstractClientPlayerEntity player, Hand hand) { ItemStack itemstack = player.getItemInHand(hand); if (itemstack.isEmpty()) { return BipedModel.ArmPose.EMPTY; } else { if (player.getUsedItemHand() == hand && player.getUseItemRemainingTicks() > 0) { UseAction useaction = itemstack.getUseAnimation(); if (useaction == UseAction.BLOCK) { return BipedModel.ArmPose.BLOCK; } if (useaction == UseAction.BOW) { return BipedModel.ArmPose.BOW_AND_ARROW; } if (useaction == UseAction.SPEAR) { return BipedModel.ArmPose.THROW_SPEAR; } if (useaction == UseAction.CROSSBOW && hand == player.getUsedItemHand()) { return BipedModel.ArmPose.CROSSBOW_CHARGE; } } else if (!player.swinging && itemstack.getItem() == Items.CROSSBOW && CrossbowItem.isCharged(itemstack)) { return BipedModel.ArmPose.CROSSBOW_HOLD; } return BipedModel.ArmPose.ITEM; } } public ResourceLocation getTextureLocation(AbstractClientPlayerEntity player) { return player.getSkinTextureLocation(); } protected void scale(AbstractClientPlayerEntity player, MatrixStack matrix, float f) { float f1 = 0.9375F; matrix.scale(0.9375F, 0.9375F, 0.9375F); } protected void renderNameTag(AbstractClientPlayerEntity player, ITextComponent text, MatrixStack matrix, IRenderTypeBuffer buffer, int n) { double d0 = this.entityRenderDispatcher.distanceToSqr(player); matrix.pushPose(); if (d0 < 100.0D) { Scoreboard scoreboard = player.getScoreboard(); ScoreObjective scoreobjective = scoreboard.getDisplayObjective(2); if (scoreobjective != null) { Score score = scoreboard.getOrCreatePlayerScore(player.getScoreboardName(), scoreobjective); super.renderNameTag(player, (new StringTextComponent(Integer.toString(score.getScore()))).append(" ").append(scoreobjective.getDisplayName()), matrix, buffer, n); matrix.translate(0.0D, (double) (9.0F * 1.15F * 0.025F), 0.0D); } } super.renderNameTag(player, text, matrix, buffer, n); matrix.popPose(); } public void renderRightHand(MatrixStack matrix, IRenderTypeBuffer buffer, int n, AbstractClientPlayerEntity player) { this.renderHand(matrix, buffer, n, player, (this.model).rightArm, (this.model).rightSleeve); } public void renderLeftHand(MatrixStack matrix, IRenderTypeBuffer buffer, int n, AbstractClientPlayerEntity player) { this.renderHand(matrix, buffer, n, player, (this.model).leftArm, (this.model).leftSleeve); } private void renderHand(MatrixStack matrix, IRenderTypeBuffer buffer, int n, AbstractClientPlayerEntity player, ModelRenderer arm, ModelRenderer sleeve) { PlayerModel<AbstractClientPlayerEntity> playermodel = this.getModel(); this.setModelProperties(player); playermodel.attackTime = 0.0F; playermodel.crouching = false; playermodel.swimAmount = 0.0F; playermodel.setupAnim(player, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F); arm.xRot = 0.0F; arm.render(matrix, buffer.getBuffer(RenderType.entitySolid(player.getSkinTextureLocation())), n, OverlayTexture.NO_OVERLAY); sleeve.xRot = 0.0F; sleeve.render(matrix, buffer.getBuffer(RenderType.entityTranslucent(player.getSkinTextureLocation())), n, OverlayTexture.NO_OVERLAY); } protected void setupRotations(AbstractClientPlayerEntity player, MatrixStack matrix, float x, float y, float z) { float f = player.getSwimAmount(z); if (player.isFallFlying()) { super.setupRotations(player, matrix, x, y, z); float f1 = (float) player.getFallFlyingTicks() + z; float f2 = MathHelper.clamp(f1 * f1 / 100.0F, 0.0F, 1.0F); if (!player.isAutoSpinAttack()) { matrix.mulPose(Vector3f.XP.rotationDegrees(f2 * (-90.0F - player.xRot))); } Vector3d vector3d = player.getViewVector(z); Vector3d vector3d1 = player.getDeltaMovement(); double d0 = Entity.getHorizontalDistanceSqr(vector3d1); double d1 = Entity.getHorizontalDistanceSqr(vector3d); if (d0 > 0.0D && d1 > 0.0D) { double d2 = (vector3d1.x * vector3d.x + vector3d1.z * vector3d.z) / Math.sqrt(d0 * d1); double d3 = vector3d1.x * vector3d.z - vector3d1.z * vector3d.x; matrix.mulPose(Vector3f.YP.rotation((float) (Math.signum(d3) * Math.acos(d2)))); } } else if (f > 0.0F) { super.setupRotations(player, matrix, x, y, z); float f3 = player.isInWater() ? -90.0F - player.xRot : -90.0F; float f4 = MathHelper.lerp(f, 0.0F, f3); matrix.mulPose(Vector3f.XP.rotationDegrees(f4)); if (player.isVisuallySwimming()) { matrix.translate(0.0D, -1.0D, (double) 0.3F); } } else { super.setupRotations(player, matrix, x, y, z); } } } Can someone help me?
-
Spawn Custom Structures [1.16.5]
Ok, i finally make it work I leave it the code for everyone that need something like this. public static void readStructure(ResourceLocation res, World world, BlockPos pos) { if (world instanceof ServerWorld) { ServerWorld server = (ServerWorld) world; TemplateManager templateManager = server.getStructureManager(); Template template = templateManager.get(res); if (template != null) { template.placeInWorld(server, pos, new PlacementSettings().setRandom(server.random), server.random); System.out.println("Template loaded"); } else { System.out.println("Template " + res + " does not exist"); } } }
-
Spawn Custom Structures [1.16.5]
Ok maybe i found out how can i spawn the struct, but i don't know how to get the CompoundNBT from the ResourcceLocation of the file. Can someone help?
-
Spawn Custom Structures [1.16.5]
Hi! I have a file .nbt that represents a struct. The question is, how can i spawn that struct in a particular BlockPos?
-
Command execute from code [1.16.5]
Yeah, sorry! Thanks!
-
Command execute from code [1.16.5]
Hi! I was wandering if someone can explain how can i execute a command from code in minecraft 1.16.5. Thanks!
-
Block with custom dimension inside [1.16.5]
Hi! I was wandering if there is some guide/tutorial on how i can create a particular custom dimension with the size of 16*16*16 in which i can place block and do some stuff. Basically something like the Compact Machine Mod, a reserved dimension for some stuff linked by a block
-
Custom render player skin [1.16.5]
Ok I will try, thanks
-
Custom render player skin [1.16.5]
Hi! I would like to know if there is a way to get the second layer of the player skin, and render it in a custom way
-
Block bigger than 1 size [1.16.5]
Ok thanks, very useful!
-
Block bigger than 1 size [1.16.5]
Ok, and how could I do? To create it I could spawn n * n * n blocks, but to break it properly?
IPS spam blocked by CleanTalk.