Jump to content

Issac29

Members
  • Posts

    75
  • Joined

  • Last visited

Recent Profile Visitors

2327 profile views

Issac29's Achievements

Stone Miner

Stone Miner (3/8)

0

Reputation

  1. I tried to load up my recipe datapack for flint and steel which by default vanilla datapack contains an iron ingot instead of steel nugget. Nothing happened and still got the same recipe. I used the command "/datapack list enabled" and I got this. My mod datapack has a lower priority than the forge datapack therefore the recipe uses the forge datapack. THIS FORUM TOPIC MAY BE MOVED TO A DIFFERENT SECTION.
  2. I see no other container classes overriding detectAndSendChanges. Also why a custom packet.
  3. I guess that can cause server lag. How am I able to do that. Also I could not find anything that relates to that.
  4. What the Images don't give enough information. Fine here is the code. public class TankTileEntity extends TileEntity implements INamedContainerProvider, ITickableTileEntity { ManualTank tank = new ManualTank(8000, this); private LazyOptional<FluidTank> optional = LazyOptional.of(() -> this.tank); public TankTileEntity() { super(INCTileEntityTypes.TANK); } @Override public void read(CompoundNBT compound) { super.read(compound); CompoundNBT nbtfluid = compound.getCompound("tank"); //$NON-NLS-1$ this.tank.readFromNBT(nbtfluid); } @Override public CompoundNBT write(CompoundNBT compound) { compound.put("tank", this.tank.writeToNBT(new CompoundNBT())); //$NON-NLS-1$ return super.write(compound); } @Override public CompoundNBT getUpdateTag() { CompoundNBT nbt = super.getUpdateTag(); return this.write(nbt); } @Override public boolean receiveClientEvent(int id, int type) { return true; } @Override public void handleUpdateTag(CompoundNBT tag) { read(tag); } @Override public <T> LazyOptional<T> getCapability(Capability<T> cap) { return cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY ? this.optional.cast() : super.getCapability(cap); } @Override public Container createMenu(int p_createMenu_1_, PlayerInventory p_createMenu_2_, PlayerEntity p_createMenu_3_) { return new TankContainer(p_createMenu_1_, this.world, this.pos, p_createMenu_2_); } @Override public ITextComponent getDisplayName() { return new TranslationTextComponent("container.tank"); //$NON-NLS-1$ } public FluidTank getTank() { return this.tank; } @Override public void tick() { return; } }
  5. Alright most of the tank is synced but the only problem is the when I type this command /setblock x y z namespace:tankName{tankData: {FluidName: #fluidName, Amount: #amount}}, the server loads the data but the client does not load until reloading the world or chunk. That same applies to /data modify block x y z tankData set value {FluidName: #fluidName, Amount: #Amount}. I used every method to sync the client but some odd reason they don't sync when changing the tank value with commands. Before Reloading Chunks: After Reloading Chunks:
  6. I figured out that to get the sprite texture, you needed the Fluid#getAttributes#getStillTexture to obtain that texture. No need for getting the model or the blockstate for just a simple four step code. AtlasTexture texture = minecraft.getModelManager().getAtlasTexture(PlayerContainer.LOCATION_BLOCKS_TEXTURE); TextureAtlasSprite sprite = texture.getSprite(Fluids.WATER.getAttributes().getStillTexture()); texture.bindTexture(); blit(70, 20, 0, 32, 32, sprite);
  7. The texture for weird reason returns "minecraft:missingno". This does not make any sense. As for the model it seems to have a number SimpleBakedModel@411933.
  8. OK I renamed the method "addScreen" to "drawFluidTexture". Which makes more sense. @SuppressWarnings("resource") private void drawFluidTexture(int x, int y) { TextureAtlasSprite texture = this.minecraft.getModelManager().getModel(new ResourceLocation("minecraft:water")).getParticleTexture(EmptyModelData.INSTANCE); texture.getAtlasTexture().bindTexture(); blit(84, 12, 0, 32, 32, texture); } @Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { this.font.drawString(this.title.getFormattedText(), 8.0F, 7.0F, 4210752); this.font.drawString(this.playerInventory.getDisplayName().getFormattedText(), 8.0F, (float) (this.ySize - 96 + 5), 4210752); drawFluidTexture(mouseX, mouseY); } But still has a missing texture. Maybe I needed to soft code it into something better.
  9. Anyway Here is the better code. @SuppressWarnings("resource") private void addScreen(int x, int y) { TextureAtlasSprite sprite = getSprite(new ResourceLocation("minecraft:water")); sprite.getAtlasTexture().bindTexture(); blit(100, 50, 0, 32, 32, sprite); } public TextureAtlasSprite getSprite(ResourceLocation resourceLocation) { return this.minecraft.getAtlasSpriteGetter(PlayerContainer.LOCATION_BLOCKS_TEXTURE).apply(resourceLocation); } @Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { this.font.drawString(this.title.getFormattedText(), 8.0F, 7.0F, 4210752); this.font.drawString(this.playerInventory.getDisplayName().getFormattedText(), 8.0F, (float) (this.ySize - 96 + 5), 4210752); addScreen(mouseX, mouseY); } Edit: For odd reason there still a invalid or missing texture.
  10. I know it makes nonsense but I am trying to get the fluid texture into the tank screen. I used water as an example.
  11. I used water as an example. The parameters were 16, 16, one, 16, 16, and water. Did I forget something? private void addScreen() { @SuppressWarnings("resource") TextureAtlasSprite sprite = getSprite(new ResourceLocation("minecraft", "water")); // This is the one I used blit(16, 16, 1, 16, 16, sprite); } public TextureAtlasSprite getSprite(ResourceLocation resourceLocation) { return this.minecraft.getAtlasSpriteGetter(PlayerContainer.LOCATION_BLOCKS_TEXTURE).apply(resourceLocation); } @Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) { this.font.drawString(this.title.getFormattedText(), 8.0F, 7.0F, 4210752); this.font.drawString(this.playerInventory.getDisplayName().getFormattedText(), 8.0F, (float) (this.ySize - 96 + 5), 4210752); addScreen(); }
  12. I tried using the method blit(int a, int b, int c, int d, int e, TextureAltasSprite f)but that did not work.
  13. Yeah, but that texture needs to bind into the GUI which is the problem. I tried to use Minecraft#getAltasSprtiteGettter but I get a mess of textures.
×
×
  • Create New...

Important Information

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