Jump to content

Haydenman2

Members
  • Posts

    39
  • Joined

  • Last visited

Posts posted by Haydenman2

  1. Just now, Draco18s said:

    Depends on your goal, really.

     

    Generally speaking you shouldn't create new tags in Forge or Minecraft namespace domains, but sometimes it is appropriate (e.g. if you're adding copper ingots, then forge:ingots might be the right place, because every modder who is adding copper that also do that is going to be interoperable).

    So something along the lines of forge:fluids/oil may be considered appropriate as I would want my oil to be interoperable?

  2. On 12/27/2020 at 5:38 PM, Draco18s said:

    That's because swimming logic is handled by the LivingEntity class, not the block class. And the check it makes is based on the fluid/water tag.

    Thank you for pushing me in the right direction. Now I more understand how to manage and utilize fluid tags. Now, one more question, is it proper/typical to tag the fluid under Minecraft, Forge, or my mod's namespace?

  3. 48 minutes ago, Draco18s said:

    Maybe don't add it to the water tag?

    In that case, removing the fluid from the water (or lava) tag also removes the physics and allows me to walk freely through the fluid. The water tag is the only way I have found to make the fluid act as a disruptor to player movement.

  4. Hello,

     

    I have created a handful of fluids for my mod, and I got to the functionality and physics of a fluid by adding it to the minecraft:fluid/water tag. The issue is, this causes the fluid to work in various machines I do not want it working in, not to mention the water bubbles and other undesired results of tagging it as water. Is there a way to have it physically behave the same as water without any of the side effects of being water internally?

     

    Fluid Class

     

    Registry

     

    Any help would be appreciated. I have tried copying logic from Entity/LivingEntity to no avail.

  5. 15 hours ago, diesieben07 said:

    Start the Forge server with -Dforge.logging.mojang.level=DEBUG. Then the exception should be logged to debug.log.

    I confirmed that this log provides the same info when it matters, upon player join. Nothing additional could be learned from adding this. The paste is too large to post.

  6. Hi y'all,

    I'm reaching out because I'm truly at a loss on why this isn't working. I just built my mod on 1.16.1 for the first time to test with my friend, but neither of us can connect, getting booted on join. I have narrowed it down to being an issue with my mod, as we can join a Forge server with no mods on it. The connection in-game shows:

    Internal Exception: io.netty.handler.codec.DecoderException: io.netty.handler.codec.EncoderException: java.io.UTFDataFormatException: malformed input around byte 83

     

    However I cannot find this in either server or client log at all. Any advice on this issue?

     

    Server Log

     

    Client Log

     

    GitHub

  7. Howdy y'all,

     

    I'm trying to use GL scaling to render small versions of text on a custom-rendered ItemStack, however, this is not working nearly how I want it to. It's very close, however, the text is appearing behind the stack. Any idea why?

    @Override
    		protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
    			super.drawGuiContainerForegroundLayer(mouseX, mouseY);
    			
    			if(tsfm.storedItem == null) {
    				this.font.drawString("Empty", 52, 13, 0xffffff);
    			}else {
    				this.font.drawString(tsfm.storedItem.getName().getFormattedText(), 52, 13, 0xffffff);
    				if(tsfm.internalStored < 10_000_000) {
    					this.font.drawString("Stored: " + Formatting.GENERAL_FORMAT.format(tsfm.internalStored), 52, 25, 0xd4d4d4);
    				}else {
    					this.font.drawString("Stored: " + SCINOT.format(tsfm.internalStored), 52, 25, 0xd4d4d4);
    				}
    				
    				RenderSystem.pushMatrix();
    				
    				RenderSystem.scalef(0.5f, 0.5f, 0.5f);
    				this.itemRenderer.renderItemOverlayIntoGUI(this.font, tsfm.storedItem.getDefaultInstance(), (25)*2, (68)*2, "Hello!");
    				
    				RenderSystem.popMatrix();
    				
    			}
    			
    			
    			
    		}
    		
    		@Override
    		protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
    			super.drawGuiContainerBackgroundLayer(partialTicks, mouseX, mouseY);
    			
    			int x = (this.width - this.xSize) / 2;
    			int y = (this.height - this.ySize) / 2;
    			if(tsfm.storedItem != null) {
    				
    				
    				this.itemRenderer.renderItemIntoGUI(tsfm.storedItem.getDefaultInstance(), (x+17), (y+60));
    			}
    			
    		}

     

    I have tested it, and rendering ItemOverlayIntoGUI works correctly and places on top of the item as proper when scaling is not involved.

     

    EDIT: I actually got it all worked out. Thank you.

    Capture.PNG

  8. 10 minutes ago, carlob said:

    I want to learn so I only created one block and saved it in .json doing export
    But I don't know how to continue to put it in minecraft

    My advice is to start by reading through the Getting Started, Concepts, and Blocks on the Forge docs to get to the point in which you will be able to put in a custom block.

    https://mcforge.readthedocs.io/en/1.15.x/blocks/blocks/

     

    Edit: My bad. Accidentally linked the 1.14 docs.

  9. Override Item#initCapabilities. In there, return a new ICapabilityProvider, essentially a wrapper for the getCapability method. Then, perform ItemStack#getCapability to query the ICapabilityProvider from the Item class.

    Here's an example from my code.

     

    @Override
    	public ICapabilityProvider initCapabilities(ItemStack stack, CompoundNBT nbt) {
    		return new ICapabilityProvider() {
    			
    			protected IEnergyStorage energy = new IEnergyStorage() {
    
    				@Override
    				public int receiveEnergy(int maxReceive, boolean simulate) {
    
    					if (getMaxPower() < maxReceive + getCurrentPower(stack)) {
    						maxReceive = getMaxPower() - getCurrentPower(stack);
    					}
    
    					if (simulate == false) {
    						setCurrentPower(stack, getCurrentPower(stack) + maxReceive);
    					}
    
    					return maxReceive;
    				}
    
    				@Override
    				public int getMaxEnergyStored() {
    					return getMaxPower();
    				}
    
    				@Override
    				public int getEnergyStored() {
    					return getCurrentPower(stack);
    				}
    
    				@Override
    				public int extractEnergy(int maxExtract, boolean simulate) {
    					return 0;
    				}
    
    				@Override
    				public boolean canReceive() {
    					return true;
    				}
    
    				@Override
    				public boolean canExtract() {
    					return false;
    				}
    			};
    			protected LazyOptional<IEnergyStorage> energyHandler = LazyOptional.of(() -> energy);
    			
    			@Override
    			public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) {
    				return this.getCapability(cap);
    			}
    
    			@Override
    			public <T> LazyOptional<T> getCapability(Capability<T> cap) {
    				if (cap == CapabilityEnergy.ENERGY) {
    					return energyHandler.cast();
    				}
    
    				return  LazyOptional.empty();
    			}
    		};
    	}

     

    • Thanks 1
  10. Hello,

     

    I am trying to finish the model for a basic tank block, however despite my best efforts the tanks have very odd shadows being cast. I have tried everything I can think of to get this gone however nothing is working. Any advice for any way I might be able to overcome the strange shading?

     

    	private static final VoxelShape SHAPE = Stream.of(Block.makeCuboidShape(0, 0, 0, 16, 1, 16),
    			Block.makeCuboidShape(0, 1, 15, 1, 15, 16), Block.makeCuboidShape(15, 1, 15, 16, 15, 16),
    			Block.makeCuboidShape(0, 1, 0, 1, 15, 1), Block.makeCuboidShape(15, 1, 0, 16, 15, 1),
    			Block.makeCuboidShape(0, 15, 0, 16, 16, 16), Block.makeCuboidShape(1, 1, 0, 15, 15, 1),
    			Block.makeCuboidShape(1, 1, 15, 15, 15, 16), Block.makeCuboidShape(1, 1, 1, 15, 15, 15),
    			Block.makeCuboidShape(0, 1, 1, 1, 15, 15), Block.makeCuboidShape(15, 1, 1, 16, 15, 15)).reduce((v1, v2) -> {
    				return VoxelShapes.combineAndSimplify(v1, v2, IBooleanFunction.OR);
    			}).get();
    
    	private static final DecimalFormat FORMAT = new DecimalFormat("###,###,###");
    
    	private final int _capacity;
    	private final TemperatureResistance _tempres;
    
    	public BlockFluidTank(int capacity, TemperatureResistance resist) {
    		super(Block.Properties.create(Material.GLASS).notSolid().hardnessAndResistance(4f, 15f).harvestLevel(0)
    				.harvestTool(ToolType.PICKAXE).sound(SoundType.GLASS).variableOpacity());
    		_capacity = capacity;
    		_tempres = resist;
    
    		this.setDefaultState(this.stateContainer.getBaseState().with(StateProperties.FLUID, DisplayFluids.NONE));
    	}
    
    	@Override
    	public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) {
    		if (state.getBlock() != newState.getBlock()) {
    			if (worldIn.getTileEntity(pos) instanceof TEFluidTank) {
    				worldIn.removeTileEntity(pos);
    			}
    		}
    	}
    	
    	@Override
    	public boolean isNormalCube(BlockState state, IBlockReader worldIn, BlockPos pos) {
    		return false;
    	}
    RenderTypeLookup.setRenderLayer(getBlock("steel_fluid_tank"), RenderType.getCutout());
    RenderTypeLookup.setRenderLayer(getBlock("wooden_fluid_tank"), RenderType.getCutout());
    {
    	"parent": "block/cube",
    	"textures": {
    		"0": "block/oak_log",
    		"1": "block/oak_log",
    		"2": "block/glass",
    		"particle": "block/oak_log"
    	},
    	"elements": [
    		"elements": [
    		{
    			"from": [0, 0, 0],
    			"to": [16, 1, 16],
    			"faces": {
    				"north": {"uv": [0, 0, 16, 1], "texture": "#1"},
    				"east": {"uv": [0, 0, 16, 1], "texture": "#1"},
    				"south": {"uv": [0, 0, 16, 1], "texture": "#1"},
    				"west": {"uv": [0, 0, 16, 1], "texture": "#1"},
    				"up": {"uv": [0, 0, 16, 16], "texture": "#1"},
    				"down": {"uv": [0, 0, 16, 16], "texture": "#1"}
    			}
    		},
    		
    		{
    			"from": [0, 15, 0],
    			"to": [16, 16, 16],
    			"rotation": {"angle": 0, "axis": "y", "origin": [8, 23, 8]},
    			"faces": {
    				"north": {"uv": [0, 0, 16, 1], "texture": "#1"},
    				"east": {"uv": [0, 0, 16, 1], "texture": "#1"},
    				"south": {"uv": [0, 0, 16, 1], "texture": "#1"},
    				"west": {"uv": [0, 0, 16, 1], "texture": "#1"},
    				"up": {"uv": [0, 0, 16, 16], "texture": "#1"},
    				"down": {"uv": [0, 0, 16, 16], "texture": "#1"}
    			}
    		},
    		
    		{
    			"from": [0, 1, 15],
    			"to": [1, 15, 16],
    			"rotation": {"angle": 0, "axis": "y", "origin": [8, 9, 23]},
    			"faces": {
    				"north": {"uv": [0, 0, 1, 15], "texture": "#0"},
    				"east": {"uv": [0, 0, 1, 15], "texture": "#0"},
    				"south": {"uv": [0, 0, 1, 15], "texture": "#0"},
    				"west": {"uv": [0, 0, 1, 15], "texture": "#0"},
    				"up": {"uv": [0, 0, 1, 15], "texture": "#0"},
    				"down": {"uv": [0, 0, 1, 15], "texture": "#0"}
    			}
    		},
    		{
    			"from": [15, 1, 15],
    			"to": [16, 15, 16],
    			"rotation": {"angle": 0, "axis": "y", "origin": [23, 9, 23]},
    			"faces": {
    				"north": {"uv": [0, 0, 1, 15], "texture": "#0"},
    				"east": {"uv": [0, 0, 1, 15], "texture": "#0"},
    				"south": {"uv": [0, 0, 1, 15], "texture": "#0"},
    				"west": {"uv": [0, 0, 1, 15], "texture": "#0"},
    				"up": {"uv": [0, 0, 1, 15], "texture": "#0"},
    				"down": {"uv": [0, 0, 1, 15], "texture": "#0"}
    			}
    		},
    		{
    			"from": [0, 1, 0],
    			"to": [1, 15, 1],
    			"rotation": {"angle": 0, "axis": "y", "origin": [9, 9, 8]},
    			"faces": {
    				"north": {"uv": [0, 0, 1, 15], "texture": "#0"},
    				"east": {"uv": [0, 0, 1, 15], "texture": "#0"},
    				"south": {"uv": [0, 0, 1, 15], "texture": "#0"},
    				"west": {"uv": [0, 0, 1, 15], "texture": "#0"},
    				"up": {"uv": [0, 0, 1, 15], "texture": "#0"},
    				"down": {"uv": [0, 0, 1, 15], "texture": "#0"}
    			}
    		},
    		{
    			"from": [15, 1, 0],
    			"to": [16, 15, 1],
    			"rotation": {"angle": 0, "axis": "y", "origin": [23, 9, 8]},
    			"faces": {
    				"north": {"uv": [0, 0, 1, 15], "texture": "#0"},
    				"east": {"uv": [0, 0, 1, 15], "texture": "#0"},
    				"south": {"uv": [0, 0, 1, 15], "texture": "#0"},
    				"west": {"uv": [0, 0, 1, 15], "texture": "#0"},
    				"up": {"uv": [0, 0, 1, 15], "texture": "#0"},
    				"down": {"uv": [0, 0, 1, 15], "texture": "#0"}
    			}
    		},
    		{
    			"from": [1, 1, 0],
    			"to": [15, 15, 1],
    			"rotation": {"angle": 0, "axis": "y", "origin": [9, 9, 8]},
    			"faces": {
    				"north": {"uv": [0, 0, 16, 16], "texture": "#2"},
    				"east": {"uv": [0, 0, 16, 16], "texture": "#2"},
    				"south": {"uv": [0, 0, 16, 16], "texture": "#2"},
    				"west": {"uv": [0, 0, 16, 16], "texture": "#2"},
    				"up": {"uv": [0, 0, 16, 16], "texture": "#2"},
    				"down": {"uv": [0, 0, 16, 16], "texture": "#2"}
    			}
    		},
    		{
    			"from": [1, 1, 15],
    			"to": [15, 15, 16],
    			"rotation": {"angle": 0, "axis": "y", "origin": [9, 9, 23]},
    			"faces": {
    				"north": {"uv": [0, 0, 16, 16], "texture": "#2"},
    				"east": {"uv": [0, 0, 16, 16], "texture": "#2"},
    				"south": {"uv": [0, 0, 16, 16], "texture": "#2"},
    				"west": {"uv": [0, 0, 16, 16], "texture": "#2"},
    				"up": {"uv": [0, 0, 16, 16], "texture": "#2"},
    				"down": {"uv": [0, 0, 16, 16], "texture": "#2"}
    			}
    		},
    		{
    			"from": [0, 1, 1],
    			"to": [1, 15, 15],
    			"rotation": {"angle": 0, "axis": "y", "origin": [8, 9, 9]},
    			"faces": {
    				"north": {"uv": [0, 0, 14, 14], "texture": "#2"},
    				"east": {"uv": [0, 0, 16, 16], "texture": "#2"},
    				"south": {"uv": [0, 0, 14, 14], "texture": "#2"},
    				"west": {"uv": [0, 0, 16, 16], "texture": "#2"},
    				"up": {"uv": [0, 0, 14, 14], "texture": "#2"},
    				"down": {"uv": [0, 0, 14, 14], "texture": "#2"}
    			}
    		},
    		{
    			"from": [15, 1, 1],
    			"to": [16, 15, 15],
    			"rotation": {"angle": 0, "axis": "y", "origin": [23, 9, 18]},
    			"faces": {
    				"north": {"uv": [0, 0, 16, 16], "texture": "#2"},
    				"east": {"uv": [0, 0, 16, 16], "texture": "#2"},
    				"south": {"uv": [0, 0, 16, 16], "texture": "#2"},
    				"west": {"uv": [0, 0, 16, 16], "texture": "#2"},
    				"up": {"uv": [0, 0, 16, 16], "texture": "#2"},
    				"down": {"uv": [0, 0, 16, 16], "texture": "#2"}
    			}
    		}
    	],
    	"groups": [
    		{
    			"name": "VoxelShapes",
    			"origin": [8, 8, 8],
    			"children": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
    		}
    	]
    }

     

    2020-06-18_19.39.14.png

  11. Hi!

     

    I'm trying to store an int amount of specific fluids into the chunk data, and I believe the chunk is being saved correctly (using ChunkDataEvent.Save), however it is not present when trying to load NBT from ChunkDataEvent.Load. Any push in the right direction would be wonderful.

     

    @SubscribeEvent
    	public static void chunkLoad(ChunkDataEvent.Load event) {
    		
    		if(event.getWorld() != null && !event.getWorld().isRemote()) {
    			FluidLevelManager.readData(event.getChunk().getPos(), event.getWorld(), event.getData());
    		}
    	}
    	
    	@SubscribeEvent
    	public static void chunkSave(ChunkDataEvent.Save event) {
    		if(event.getWorld() != null && !event.getWorld().isRemote()) {
    			FluidLevelManager.writeData(event.getChunk(), event.getWorld(), event.getData());
    		}
    	}
    	
    	@SubscribeEvent
    	public static void chunkUnload(ChunkEvent.Unload event) {
    		if(event.getWorld() != null && !event.getWorld().isRemote()) {
    			FluidLevelManager.clearData(event.getWorld(), event.getChunk().getPos());
    		}
    	}
    public class FluidLevelManager {
    
    	
    	public static final ConcurrentHashMap<ChunkCoords, FluidStack> CHUNK_FLUIDS = new ConcurrentHashMap<>();
    	
    	private static final Random RAND = new Random();
    	
    	public static void readData(ChunkPos pos, IWorld world, CompoundNBT nbt) {
    		
    		ChunkCoords cc = new ChunkCoords(world.getDimension().getType().getId(), pos.x, pos.z);
    		if(nbt.contains("assemblylinemachines:chunkfluid")) {
    			
    			CHUNK_FLUIDS.put(cc, FluidStack.loadFluidStackFromNBT(nbt.getCompound("assemblylinemachines:chunkfluid")));
    				
    			
    			
    		}else {
    			
    			int val = RAND.nextInt(40);
    			
    			
    			if(world.getDimension().getType() == DimensionType.OVERWORLD) {
    				
    				
    				if(val == 0) {
    					CHUNK_FLUIDS.put(cc, new FluidStack(Registry.getFluid("oil"), (RAND.nextInt(4000) + 1001) * 1000));
    				}else if(val < 4) {
    					CHUNK_FLUIDS.put(cc, new FluidStack(Fluids.LAVA, (RAND.nextInt(11500) + 1001) * 1000));
    				}else {
    					CHUNK_FLUIDS.put(cc, FluidStack.EMPTY);
    				}
    			}else if(world.getDimension().getType() == DimensionType.THE_NETHER) {
    				if(val < 7) {
    					CHUNK_FLUIDS.put(cc, new FluidStack(Fluids.LAVA, (RAND.nextInt(29000) + 1001) * 1000));
    				}else {
    					CHUNK_FLUIDS.put(cc, FluidStack.EMPTY);
    				}
    			}
    		}
    	}
    	
    	public static void writeData(IChunk chunk, IWorld world, CompoundNBT nbt) {
    		ChunkCoords cc = new ChunkCoords(world.getDimension().getType().getId(), chunk.getPos().x, chunk.getPos().z);
    		if(CHUNK_FLUIDS.containsKey(cc)) {
    			
    			CompoundNBT sub = new CompoundNBT();
    			CHUNK_FLUIDS.get(cc).writeToNBT(sub);
    			nbt.put("assemblylinemachines:chunkfluid", sub);
    			
    		}
    	}
    	
    	public static void clearData(IWorld world, ChunkPos pos) {
    		int dimid = world.getDimension().getType().getId();
    		CHUNK_FLUIDS.remove(new ChunkCoords(dimid, pos.x, pos.z));
    	}
    }

     

    No matter what, the two prints at the top of readData always output 0 and an empty string.

  12. On 6/7/2020 at 3:15 AM, diesieben07 said:

    It's not peculiar if you understand how the dist-only methods come to be. They are most likely optimized away by Mojang's obfuscator (or some other step in their build process), not removed by hand.

    If a method is not used on the server, it is not included.

    That makes a lot of sense, actually.

  13. 1 minute ago, poopoodice said:

    It says maxLength means the string read from the packet can not be longer than it, readString() passed in 32767.

    
       /**
        * Reads a string from this buffer. Expected parameter is maximum allowed string length. Will throw IOException if
        * string length exceeds this value!
        */

    Quote from the comment 

    Considering readString() legitimately passes to readString(32767), that is a very... peculiar sided restriction. Thank you very much for helping me figure it out!

  14. Hello!
    I'm trying to set up a GUI with buttons, and to communicate button changes, I'm using a SimpleChannel. This works flawlessly on client, however, on server, I experience a crash on the server related to missing classes. I assume this is due to referencing a class only present in Client, however I do not know where I do this.

     

    Class for handling packets.

    https://github.com/HaydenBelanger/assembly_line_machines/blob/development/src/main/java/me/haydenb/assemblylinemachines/packets/HashPacketImpl.java

     

    Method for sending the packet to the channel.
    https://github.com/HaydenBelanger/assembly_line_machines/blob/development/src/main/java/me/haydenb/assemblylinemachines/block/energy/BlockBasicBatteryCell.java#L327-L341

     

    Registering the channels.
    https://github.com/HaydenBelanger/assembly_line_machines/blob/development/src/main/java/me/haydenb/assemblylinemachines/registry/Registry.java#L290-L294

     

    java.lang.NoSuchMethodError: net.minecraft.network.PacketBuffer.readString()Ljava/lang/String;
    	at me.haydenb.assemblylinemachines.packets.HashPacketImpl$DecoderConsumer.apply(HashPacketImpl.java:83) ~[main/:?] {re:classloading}
    	at me.haydenb.assemblylinemachines.packets.HashPacketImpl$DecoderConsumer.apply(HashPacketImpl.java:1) ~[main/:?] {re:classloading}
    	at net.minecraftforge.fml.network.simple.IndexedMessageCodec.lambda$tryDecode$0(IndexedMessageCodec.java:116) ~[forge-1.15.2-31.1.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading}
    	at java.util.Optional.map(Optional.java:215) ~[?:1.8.0_181] {}
    	at net.minecraftforge.fml.network.simple.IndexedMessageCodec.tryDecode(IndexedMessageCodec.java:116) ~[forge-1.15.2-31.1.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading}
    	at net.minecraftforge.fml.network.simple.IndexedMessageCodec.consume(IndexedMessageCodec.java:157) ~[forge-1.15.2-31.1.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading}
    	at net.minecraftforge.fml.network.simple.SimpleChannel.networkEventListener(SimpleChannel.java:79) ~[forge-1.15.2-31.1.0_mapped_snapshot_20200514-1.15.1-recomp.jar:?] {re:classloading}
    	at net.minecraftforge.eventbus.EventBus.doCastFilter(EventBus.java:212) ~[eventbus-2.0.0-milestone.1-service.jar:?] {}
    	at net.minecraftforge.eventbus.EventBus.lambda$addListener$11(EventBus.java:204) ~[eventbus-2.0.0-milestone.1-service.jar:?] {}
    	at net.minecraftforge.eventbus.EventBus.post(EventBus.java:258) ~[eventbus-2.0.0-milestone.1-service.jar:?] {}
    	at net.minecraftforge.fml.network.NetworkInstance.dispatch(NetworkInstance.java:84) ~[?:?] {re:classloading}
    	at net.minecraftforge.fml.network.NetworkHooks.lambda$onCustomPayload$0(NetworkHooks.java:74) ~[?:?] {re:classloading}
    	at java.util.Optional.map(Optional.java:215) ~[?:1.8.0_181] {}
    	at net.minecraftforge.fml.network.NetworkHooks.onCustomPayload(NetworkHooks.java:74) ~[?:?] {re:classloading}
    	at net.minecraft.network.play.ServerPlayNetHandler.processCustomPayload(ServerPlayNetHandler.java:1366) ~[?:?] {re:classloading}
    	at net.minecraft.network.play.client.CCustomPayloadPacket.processPacket(CCustomPayloadPacket.java:51) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}
    	at net.minecraft.network.play.client.CCustomPayloadPacket.processPacket(CCustomPayloadPacket.java:12) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}
    	at net.minecraft.network.PacketThreadUtil.lambda$checkThreadAndEnqueue$0(PacketThreadUtil.java:19) ~[?:?] {re:classloading}
    	at net.minecraft.util.concurrent.TickDelayedTask.run(TickDelayedTask.java:20) ~[?:?] {re:classloading}
    	at net.minecraft.util.concurrent.ThreadTaskExecutor.run(ThreadTaskExecutor.java:140) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    	at net.minecraft.util.concurrent.RecursiveEventLoop.run(RecursiveEventLoop.java:22) ~[?:?] {re:classloading}
    	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:757) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:141) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    	at net.minecraft.util.concurrent.ThreadTaskExecutor.driveOne(ThreadTaskExecutor.java:110) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    	at net.minecraft.server.MinecraftServer.driveOneInternal(MinecraftServer.java:740) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    	at net.minecraft.server.MinecraftServer.driveOne(MinecraftServer.java:734) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    	at net.minecraft.util.concurrent.ThreadTaskExecutor.driveUntil(ThreadTaskExecutor.java:123) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    	at net.minecraft.server.MinecraftServer.runScheduledTasks(MinecraftServer.java:720) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}
    	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:664) [?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}

    I would love a point in the right direction as I don't see what could be the problem with this.

  15. I've confirmed the client is receiving the data packet containing the color code as expected and at the correct time, however it is not being translated to the color of the water in the basin.

    @Override
    		public void onDataPacket(NetworkManager net, SUpdateTileEntityPacket pkt) {
    			super.onDataPacket(net, pkt);
    			System.out.println("[DEBUG] Received data packet: " + pkt.getNbtCompound().getInt("assemblylinemachines:fluidcolor"));
    			handleUpdateTag(pkt.getNbtCompound());
    		}
    [m[32m[20:59:08] [Render thread/INFO] [STDOUT/]: [me.haydenb.assemblylinemachines.block.BlockFluidBath$TEFluidBath:onDataPacket:300]: [DEBUG] Received data packet: 11597296

     

  16. Hello.

    I have a basin TileEntity that stores a liquid, and when two items from a crafting recipe are placed in the block, the block changes states to allow the fluid to tint according to the recipe JSON as specified. This tint is working appropriately and the state is updating immediately (as seen in F3) however the actual visual tint won't take effect until a block near the basin is broken. Any advice on how to force the client to update their IBlockColor?

    entity.output = crafting.getRecipeOutput().copy();
    entity.stirsRemaining = crafting.getStirs();
    entity.fluidColor = crafting.getColor();
    world.setBlockState(pos, state.with(STATUS, BathStatus.success), 3);
    entity.sendUpdates();

     

    	public TileEntityALMBase(TileEntityType<?> tileEntityTypeIn) {
    		super(tileEntityTypeIn);
    	}
    
    	@Override
    	public SUpdateTileEntityPacket getUpdatePacket() {
    		return new SUpdateTileEntityPacket(this.pos, -1, this.getUpdateTag());
    	}
    	
    	@Override
    	public CompoundNBT getUpdateTag() {
    		return write(new CompoundNBT());
    	}
    	
    	@Override
    	public void onDataPacket(NetworkManager net, SUpdateTileEntityPacket pkt) {
    		super.onDataPacket(net, pkt);
    		handleUpdateTag(pkt.getNbtCompound());
    	}
    	
    	
    	public void sendUpdates() {
    		world.markBlockRangeForRenderUpdate(pos, getBlockState(), getBlockState());
    		world.notifyBlockUpdate(pos, getBlockState(), getBlockState(), 2);
    		markDirty();
    	}

     

    event.getBlockColors().register(new IBlockColor() {
    			
    			@Override
    			public int getColor(BlockState state, ILightReader reader, BlockPos pos, int tint) {
    				if(reader != null && pos != null) {
    					
    					
    					if(state.get(BlockFluidBath.STATUS) == BathStatus.success) {
    						
    						TileEntity te = reader.getTileEntity(pos);
    						if(te != null && te instanceof TEFluidBath) {
    							TEFluidBath tef = (TEFluidBath) te;
    							return tef.getFluidColor();
    						}
    					}else {
    						if(state.get(BlockFluidBath.FLUID) == BathFluid.lava) {
    							return 0xcb3d07;
    						}else {
    							return BiomeColors.getWaterColor(reader, pos);
    						}
    					}
    					
    				}
    				
    				return 0xffffff;
    			}
    		}, getBlock("fluid_bath"));

     

  17. I'm trying to create a jar of sorts with one section being translucent and another part being opaque. The translucent part works fine, but from some angles the opaque section disappears.  Any tips?

     

    8MWDHG7.png

     

    Class

     

    package tustuff.blocks;

     

    import java.util.List;

     

    import net.minecraft.block.Block;

    import net.minecraft.block.BlockContainer;

    import net.minecraft.block.ITileEntityProvider;

    import net.minecraft.block.SoundType;

    import net.minecraft.block.material.Material;

    import net.minecraft.block.state.IBlockState;

    import net.minecraft.creativetab.CreativeTabs;

    import net.minecraft.entity.Entity;

    import net.minecraft.entity.item.EntityItem;

    import net.minecraft.entity.player.EntityPlayer;

    import net.minecraft.item.ItemStack;

    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 tustuff.init.Init;

    import tustuff.init.ModItems;

    import tustuff.init.NameReg;

    import tustuff.other.TabTustuff;

    import tustuff.tileentities.TEPurpleJar;

     

    public class PurpleJar extends Block implements ITileEntityProvider {

     

    private static final AxisAlignedBB BoundingBox = new AxisAlignedBB(0.0625 * 4, 0, 0.0625 * 4, 0.0625*12, 0.0625*11, 0.0625*12);

    public PurpleJar(){

    super(Material.IRON);

    setUnlocalizedName(NameReg.ModBlocks.PURPLEJAR.getUnlocalizedName());

    setRegistryName(NameReg.ModBlocks.PURPLEJAR.getRegistryName());

    setCreativeTab(TabTustuff.tabTustuff);

    setHardness(1.4F);

    setResistance(4.0F);

    setSoundType(SoundType.GLASS);

    setLightOpacity(0);

    setLightLevel(0.0F);

    isBlockContainer = true;

     

     

    }

     

    @Override

    public boolean isFullCube(IBlockState state){

    return false;

    }

    @Override

    public boolean isOpaqueCube(IBlockState state) {

    return false;

    }

    @Override

    public BlockRenderLayer getBlockLayer() {

    return BlockRenderLayer.TRANSLUCENT;

    }

    @Override

    public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) {

    return BoundingBox;

    }

    @Override

    public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox,

    List<AxisAlignedBB> collidingBoxes, Entity entityIn) {

    super.addCollisionBoxToList(pos, entityBox, collidingBoxes, BoundingBox);

    }

     

    @Override

    public TileEntity createNewTileEntity(World worldIn, int meta) {

    return new TEPurpleJar();

    }

    @Override

    public void breakBlock(World worldIn, BlockPos pos, IBlockState state){

    super.breakBlock(worldIn, pos, state);

    worldIn.removeTileEntity(pos);

    }

    @Override

    public boolean eventReceived(IBlockState state, World worldIn, BlockPos pos, int id, int param){

    super.eventReceived(state, worldIn, pos, id, param);

    TileEntity tileentity = worldIn.getTileEntity(pos);

    return tileentity == null ? false : tileentity.receiveClientEvent(id, param);

    }

    @Override

    public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player){

    if(!worldIn.isRemote){

    EntityItem item = new EntityItem(worldIn, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(ModItems.cheesecracker, TEPurpleJar.itemamount));

    worldIn.spawnEntityInWorld(item);

    }

    }

    @Override

    public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {

    if(!worldIn.isRemote){

    TileEntity tileentity = worldIn.getTileEntity(pos);

    if(tileentity instanceof TEPurpleJar){

    TEPurpleJar tepurplejar = (TEPurpleJar) tileentity;

    if(heldItem != null){

    if(heldItem.getItem() == ModItems.cheesecracker){

    if(TEPurpleJar.addToJar() == true){

    heldItem.stackSize--;

    return true;

    }

    }

    }

    TEPurpleJar.removeFromJar(playerIn);

    }

    }

    return true;

    }

     

    }

     

     

     

    Model

     

    {

     

        "parent": "block/cube",

        "textures": {

            "0": "tustuff:blocks/purpleblock",

            "1": "tustuff:blocks/purplejar-glass",

            "particle": "tustuff:blocks/purplejar-glass"

        },

        "elements": [

            {

                "name": "Base",

                "from": [ 4.0, 0.0, 4.0 ],

                "to": [ 12.0, 1.0, 12.0 ],

                "faces": {

                    "north": { "texture": "#0", "uv": [ 0.0, 0.0, 8.0, 1.0 ] },

                    "east": { "texture": "#0", "uv": [ 0.0, 0.0, 8.0, 1.0 ] },

                    "south": { "texture": "#0", "uv": [ 0.0, 0.0, 8.0, 1.0 ] },

                    "west": { "texture": "#0", "uv": [ 0.0, 0.0, 8.0, 1.0 ] },

                    "up": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 16.0 ] },

                    "down": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 16.0 ] }

                }

            },

            {

                "name": "Glass",

                "from": [ 4.0, 1.0, 4.0 ],

                "to": [ 12.0, 9.0, 12.0 ],

                "faces": {

                    "north": { "texture": "#1", "uv": [ 0.0, 0.0, 16.0, 16.0 ] },

                    "east": { "texture": "#1", "uv": [ 0.0, 0.0, 16.0, 16.0 ] },

                    "south": { "texture": "#1", "uv": [ 0.0, 0.0, 16.0, 16.0 ] },

                    "west": { "texture": "#1", "uv": [ 0.0, 0.0, 16.0, 16.0 ] },

                    "up": { "texture": "#1", "uv": [ 0.0, 0.0, 16.0, 16.0 ] },

                    "down": { "texture": "#1", "uv": [ 0.0, 0.0, 16.0, 16.0 ] }

                }

            },

            {

                "name": "LidA",

                "from": [ 4.0, 9.0, 4.0 ],

                "to": [ 12.0, 10.0, 12.0 ],

                "faces": {

                    "north": { "texture": "#0", "uv": [ 0.0, 0.0, 8.0, 1.0 ] },

                    "east": { "texture": "#0", "uv": [ 0.0, 0.0, 8.0, 1.0 ] },

                    "south": { "texture": "#0", "uv": [ 0.0, 0.0, 8.0, 1.0 ] },

                    "west": { "texture": "#0", "uv": [ 0.0, 0.0, 8.0, 1.0 ] },

                    "up": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 16.0 ] },

                    "down": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 16.0 ] }

                }

            },

            {

                "name": "LidB",

                "from": [ 6.0, 10.0, 6.0 ],

                "to": [ 10.0, 11.0, 10.0 ],

                "faces": {

                    "north": { "texture": "#0", "uv": [ 0.0, 0.0, 4.0, 1.0 ] },

                    "east": { "texture": "#0", "uv": [ 0.0, 0.0, 4.0, 1.0 ] },

                    "south": { "texture": "#0", "uv": [ 0.0, 0.0, 4.0, 1.0 ] },

                    "west": { "texture": "#0", "uv": [ 0.0, 0.0, 4.0, 1.0 ] },

                    "up": { "texture": "#0", "uv": [ 4.0, 5.0, 8.0, 9.0 ] },

                    "down": { "texture": "#0", "uv": [ 4.0, 5.0, 8.0, 9.0 ] }

                }

            }

        ]

    }

     

     

     

  18. I want to create a Chestplate that works with flight as long as it's worn, but as soon as it's taken off your flight is immediately disabled and you can no longer fly. I can get it so that you can fly after first putting it on but taking it off won't disable it until a reload. Any tips?

     

     

    package tustuff.items.armor;

     

    import net.minecraft.entity.player.EntityPlayer;

    import net.minecraft.inventory.EntityEquipmentSlot;

    import net.minecraft.item.ItemArmor;

    import net.minecraft.item.ItemStack;

    import net.minecraft.world.World;

    import tustuff.init.GlobalMethods;

    import tustuff.init.ModItems;

    import tustuff.init.NameReg;

    import tustuff.other.ModMaterials;

    import tustuff.other.TabTustuff;

     

    public class JPurpleGodlyChest extends ItemArmor {

     

    public JPurpleGodlyChest(ArmorMaterial materialIn, int renderIndexIn, EntityEquipmentSlot equipmentSlotIn) {

    super(ModMaterials.armorGodlyPurple, 1, EntityEquipmentSlot.CHEST);

    setUnlocalizedName(NameReg.ModItems.JPURPLEGODLYCHEST.getUnlocalizedName());

    setRegistryName(NameReg.ModItems.JPURPLEGODLYCHEST.getRegistryName());

    setCreativeTab(TabTustuff.tabTustuff);

    }

     

    public void onArmorTickUpdate(World world, EntityPlayer player, ItemStack itemStack){

    if(player.inventory.armorItemInSlot(2) != null && player.inventory.armorItemInSlot(2).getItem() == ModItems.jpurplegodlychest){

    player.capabilities.allowFlying = true;

    player.sendPlayerAbilities();

    return;

    }else{

    player.capabilities.allowFlying = false;

    player.capabilities.isFlying = false;

    player.sendPlayerAbilities();

    }

    }

    }

     

     

    As Draco said it doesn't get called unless it is equiped, solution subscribe to PlayerTickEvent in an EventHandler.

     

    Clever method, will do. Thanks you two

×
×
  • Create New...

Important Information

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