-
Content Count
72 -
Joined
-
Last visited
Community Reputation
0 NeutralAbout BudRunBun
-
Rank
Stone Miner
- Birthday October 4
Converted
-
Gender
Male
-
Location
Russia
Recent Profile Visitors
404 profile views
-
I want to make an entity, which has a sword in the right hand and a shield in the left. For this I added ItemHeldLayer in the renderer and sword works perfectly and shield when it's not activated looks good too. The question is: How do a I set a rotation for shield to look like it is right-clicked by player? I have tried to change rotation angles in the entity model but they change rotation of arm itself, not the shield.
-
Thank you! Placement.NOPE just confused me
-
I am trying to make a structure that spawns in the world, I have registered the structure. When I run /locate command it gives me the coordinates but it just does not spawn in the world, there is nothing at the coordinates Structure: package com.budrunbun.lavalamp.worldgen; import com.mojang.datafixers.Dynamic; import net.minecraft.util.math.MutableBoundingBox; import net.minecraft.world.biome.Biome; import net.minecraft.world.gen.ChunkGenerator; import net.minecraft.world.gen.feature.NoFeatureConfig; import net.minecraft.world.gen.feature.structure.ScatteredStructure; import net.minecraft.world.gen.feature.structure.Structure; import net.minecraft.world.gen.feature.structure.StructureStart; import net.minecraft.world.gen.feature.template.TemplateManager; import javax.annotation.Nonnull; import java.util.function.Function; public class ShopStructure extends ScatteredStructure<NoFeatureConfig> { public ShopStructure(Function<Dynamic<?>, ? extends NoFeatureConfig> p_i51449_1_) { super(p_i51449_1_); } @Override protected int getSeedModifier() { return 0; } @Override public IStartFactory getStartFactory() { return ShopStructure.Start::new; } @Override public String getStructureName() { return "Shop"; } @Override public int getSize() { return 3; } public static class Start extends StructureStart { public Start(Structure<?> p_i50289_1_, int p_i50289_2_, int p_i50289_3_, Biome p_i50289_4_, MutableBoundingBox p_i50289_5_, int p_i50289_6_, long p_i50289_7_) { super(p_i50289_1_, p_i50289_2_, p_i50289_3_, p_i50289_4_, p_i50289_5_, p_i50289_6_, p_i50289_7_); } public void init(ChunkGenerator<?> generator, TemplateManager templateManagerIn, int chunkX, int chunkZ, @Nonnull Biome biomeIn) { ShopStructurePiece shopStructurePiece = new ShopStructurePiece(this.rand, chunkX * 16, chunkZ * 16); this.components.add(shopStructurePiece); this.recalculateStructureSize(); } } } Piece: package com.budrunbun.lavalamp.worldgen; import net.minecraft.block.Blocks; import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.math.ChunkPos; import net.minecraft.util.math.MutableBoundingBox; import net.minecraft.world.IWorld; import net.minecraft.world.gen.feature.structure.IStructurePieceType; import net.minecraft.world.gen.feature.structure.ScatteredStructurePiece; import net.minecraft.world.gen.feature.template.TemplateManager; import javax.annotation.Nonnull; import java.util.Random; public class ShopStructurePiece extends ScatteredStructurePiece { public static IStructurePieceType type = IStructurePieceType.register(ShopStructurePiece::new, "shop"); public ShopStructurePiece(Random random, int x, int z) { super(type, random, x, 100, z, 100, 100, 100); } public ShopStructurePiece(TemplateManager templateManager, CompoundNBT compoundNBT) { super(type, compoundNBT); } @Override public boolean addComponentParts(@Nonnull IWorld world, @Nonnull Random random, @Nonnull MutableBoundingBox structureBoundingBoxIn, @Nonnull ChunkPos pos) { this.fillWithBlocks(world, structureBoundingBoxIn, 0, 0, 0, this.width - 1, 100, this.depth - 1, Blocks.COBBLESTONE.getDefaultState(), Blocks.COBBLESTONE.getDefaultState(), false); return true; } } Adding to biomes: private void setupCommon(final FMLCommonSetupEvent event) { for (Biome biome : ForgeRegistries.BIOMES) { biome.addStructure(ModFeatures.SHOP, NoFeatureConfig.NO_FEATURE_CONFIG); } proxy.init(); }
-
[1.14.4] [SOLVED] Adding a TileEntity to vanilla blocks
BudRunBun replied to BudRunBun's topic in Modder Support
Okay, I will make my door then -
[1.14.4] [SOLVED] Adding a TileEntity to vanilla blocks
BudRunBun replied to BudRunBun's topic in Modder Support
Does it replace vanilla door somehow? -
[1.14.4] [SOLVED] Adding a TileEntity to vanilla blocks
BudRunBun replied to BudRunBun's topic in Modder Support
But MalisisDoors somehow works -
I want to make vanilla doors open smoothly via TileEntityRenderer, for this TileEntity is required, which vanilla doors don't have. The problem is that I don't know what to with hasTileEntity() and createTileEntity() methods that need to be overriden in order to make it work.
-
[1.14.4] [SOLVED] Netty Packet Handler Error
BudRunBun replied to BudRunBun's topic in Modder Support
It was the probem. Thank you very much! -
[1.14.4] [SOLVED] Netty Packet Handler Error
BudRunBun replied to BudRunBun's topic in Modder Support
I moved it to ClientProxy like so: package com.budrunbun.lavalamp.proxy; import com.budrunbun.lavalamp.container.ModContainers; import com.budrunbun.lavalamp.renderer.DisplayFreezerRenderer; import com.budrunbun.lavalamp.renderer.ShelfBlockRenderer; import com.budrunbun.lavalamp.screen.CheeseGeneratorScreen; import com.budrunbun.lavalamp.tileentity.DisplayFreezerTileEntity; import com.budrunbun.lavalamp.tileentity.ShelfTileEntity; import net.minecraft.client.gui.ScreenManager; import net.minecraftforge.fml.client.registry.ClientRegistry; public class ClientProxy implements IProxy { @Override public void init() { ScreenManager.registerFactory(ModContainers.CHEESE_GENERATOR_CONTAINER, CheeseGeneratorScreen::new); ClientRegistry.bindTileEntitySpecialRenderer(ShelfTileEntity.class, new ShelfBlockRenderer()); ClientRegistry.bindTileEntitySpecialRenderer(DisplayFreezerTileEntity.class, new DisplayFreezerRenderer()); } } but error is the same -
[1.14.4] [SOLVED] Netty Packet Handler Error
BudRunBun replied to BudRunBun's topic in Modder Support
Here -
I am making a minecraft mod and when I run it in the single player everything is fine but when I launch it on the dedicated server I get an Internal Exception: io.netty.handler.codec.EncoderException: java.lang.NullPointerException debug.log
-
Can I get rid of the Tile Entity?
-
Okay, I changed it a bit and it works now package com.budrunbun.lavalamp.tileEntities; import com.budrunbun.lavalamp.blocks.PlayerSensorBlock; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.TileEntity; public class PlayerSensorTileEntity extends TileEntity implements ITickableTileEntity { public PlayerSensorTileEntity() { super(ModTileEntities.PLAYER_SENSOR_TE); } @Override public void tick() { PlayerEntity playerentity = this.world.getClosestPlayer(this.pos.getX(), this.pos.getY(), this.pos.getZ(), 3.0D, false); if (playerentity != null) { world.setBlockState(getPos(), world.getBlockState(pos).with(PlayerSensorBlock.LIT, true)); } else { world.setBlockState(getPos(), world.getBlockState(pos).with(PlayerSensorBlock.LIT, false)); } } }
-
I want to make a block that emits redstone signal if there is a player nearby but getClosestPlayer() always returns an empty PlayerEntity TE: package com.budrunbun.lavalamp.tileEntities; import com.budrunbun.lavalamp.blocks.PlayerSensorBlock; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.TileEntity; public class PlayerSensorTileEntity extends TileEntity implements ITickableTileEntity { public PlayerSensorTileEntity() { super(ModTileEntities.PLAYER_SENSOR_TE); } @Override public void tick() { PlayerEntity playerentity = this.world.getClosestPlayer((double) ((float) this.pos.getX() + 0.5F), (double) ((float) this.pos.getY() + 0.5F), (double) ((float) this.pos.getZ() + 0.5F), 3.0D, false); if (playerentity != null) { System.out.println("Tick"); world.setBlockState(getPos(), world.getBlockState(pos).with(PlayerSensorBlock.LIT, true)); } } }
-
Now I have another problem. If player is in creative mode right-clicks an item in shelf I want it to disappear (I think that onBlockClicked() is for right-click and removedByPlayer() is to prevent the block from destruction), but when I right-click it item dissappears, block gets destroyed and immediately restored, even particles spawn. @Override public boolean removedByPlayer(BlockState state, World world, BlockPos pos, PlayerEntity player, boolean willHarvest, IFluidState fluid) { if (player.isCreative()) { if (canBreakBlockInCreative(state, world, pos, player)) world.setBlockState(pos, Blocks.AIR.getDefaultState(), world.isRemote() ? 11 : 3); else onBlockClicked(state, world, pos, player); return false; } return super.removedByPlayer(state, world, pos, player, false, fluid) || willHarvest; } public boolean canBreakBlockInCreative(BlockState state, World world, BlockPos pos, PlayerEntity player) { double blockReachDistance = player.getAttribute(PlayerEntity.REACH_DISTANCE).getValue() + 1; BlockRayTraceResult rayResult = rayTraceEyes(world, player, blockReachDistance + 1); return getSlot(rayResult, state, pos) == -1; } @Override public void onBlockClicked(BlockState state, World worldIn, BlockPos pos, PlayerEntity player) { if (!worldIn.isRemote()) { BlockRayTraceResult hit = rayTraceEyes(worldIn, player, player.getAttribute(PlayerEntity.REACH_DISTANCE).getValue() + 1); int slot = getSlot(hit, state, pos); ShelfTileEntity shelf = (ShelfTileEntity) worldIn.getTileEntity(pos); ItemStackHandler handler = shelf.getHandler(); if (slot != -1 && !handler.getStackInSlot(slot).isEmpty()) { ItemStack item = handler.getStackInSlot(slot); if (!player.isCreative()) { if (!player.inventory.addItemStackToInventory(item)) { dropItemStack(worldIn, pos, item); } } handler.setStackInSlot(slot, ItemStack.EMPTY); worldIn.notifyBlockUpdate(pos, state, state, 3); shelf.setHandler(handler); } }