• Recently Browsing

    No registered users viewing this page.

  • Posts

    • This is how it looks now: package com.bumpay.travelsimplified.trasim.port; import net.minecraft.nbt.CompoundNBT; import net.minecraft.world.server.ServerWorld; import net.minecraft.world.storage.DimensionSavedDataManager; import net.minecraft.world.storage.WorldSavedData; import java.util.function.Supplier; public class PortWorldSavedData extends WorldSavedData { private static final String NAME = "TraSim_PortData"; public PortWorldSavedData() { super(NAME); } public PortWorldSavedData(String name) { super(name); } @Override public void read(CompoundNBT nbt) { } @Override public CompoundNBT write(CompoundNBT compound) { return null; } public static PortWorldSavedData get(ServerWorld world) { DimensionSavedDataManager data = world.getSavedData(); PortWorldSavedData instance = (PortWorldSavedData) data.getOrCreate(() -> {return null;}, NAME); if(instance == null) { instance = new PortWorldSavedData(); } return instance; } } But as described in the Docs, I guess I shouldn't just pass a null pointer in the getOrCreate function.   I also tried PortWorldSavedData.class there like in the Docs but it sais it is a Supplier<T> needed. public static PortWorldSavedData get(ServerWorld world) { DimensionSavedDataManager data = world.getSavedData(); PortWorldSavedData instance = (PortWorldSavedData) data.getOrCreate(PortWorldSavedData.class, NAME); if(instance == null) { instance = new PortWorldSavedData(); } return instance; }   So I also tried new Supplier<PortWorldSavedData> which added the abstract method within the parameter-section public static PortWorldSavedData get(ServerWorld world) { DimensionSavedDataManager data = world.getSavedData(); PortWorldSavedData instance = (PortWorldSavedData) data.getOrCreate(new Supplier<PortWorldSavedData>() { @Override public PortWorldSavedData get() { return null; } }, NAME); if(instance == null) { instance = new PortWorldSavedData(); } return instance; }   And even though I don't actually know, if this is the right way to do it scince Forge updated but didn't update the Docs. Can someone confirm that I am not complete off the track?
    • Don't create the containmentField in setPos. Initialize it on demand in tick.
    • I do know coding in Java. The only things I am struggeling with are the classes from minecraft as I don't know which are there and how to use them. Yeah I changed it, I did not recognize, that I tried something different there and forgot to type it back.    
    • So I've made an entity that has a part of the model that is a translucent cube, and now I'm trying to render an item from the entity within that translucent cube. I can see that the item is rendering, since it peeks out of the cube a bit, but I can't see the item through the translucent cube. I'm not that great with rendering since I've only recently begun modding Minecraft, so I need a bit of help figuring out how to get the item to be visible through the translucent cube.     Here is what it looks like.         Here is the renderer class that it uses.   package me.bluemond.bluemagic.client.entity.renderer; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import me.bluemond.bluemagic.BlueMagic; import me.bluemond.bluemagic.client.entity.model.EmpowermentEntityModel; import me.bluemond.bluemagic.entities.EmpowermentEntity; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRendererManager; import net.minecraft.client.renderer.entity.model.EntityModel; import net.minecraft.client.renderer.model.ItemCameraTransforms; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.util.ResourceLocation; import software.bernie.geckolib.render.IModelRenderer; public class EmpowermentEntityRenderer extends EntityRenderer<EmpowermentEntity> implements IModelRenderer { protected static final ResourceLocation TEXTURE = new ResourceLocation(BlueMagic.MOD_ID, "textures/entity/empowerment_entity.png"); protected final EmpowermentEntityModel empowermentModel = new EmpowermentEntityModel(); public EmpowermentEntityRenderer(EntityRendererManager renderManager) { super(renderManager); this.shadowSize = 0.5f; } @Override public void render(EmpowermentEntity entityIn, float entityYaw, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn) { this.empowermentModel.setRotationAngles(entityIn, partialTicks, 0.0F, -0.1F, 0.0F, 0.0F); this.empowermentModel.setLivingAnimations(entityIn, 0, 0, partialTicks); IVertexBuilder iVertexBuilder = bufferIn.getBuffer(RenderType.getEntityTranslucent(this.getEntityTexture(entityIn))); this.empowermentModel.render(matrixStackIn, iVertexBuilder, packedLightIn, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F); super.render(entityIn, entityYaw, partialTicks, matrixStackIn, bufferIn, packedLightIn); if(entityIn.getPotionStack() != null){ matrixStackIn.push(); matrixStackIn.translate(0, 1, 0); matrixStackIn.scale(0.5F, 0.5F, 0.5F); Minecraft.getInstance().getItemRenderer().renderItem(entityIn.getPotionStack(), ItemCameraTransforms.TransformType.FIXED, packedLightIn, OverlayTexture.NO_OVERLAY, matrixStackIn, bufferIn); matrixStackIn.pop(); } } @Override public ResourceLocation getEntityTexture(EmpowermentEntity entity){ return TEXTURE; } @Override public EntityModel getEntityModel() { return this.empowermentModel; } }
  • Topics

  • Who's Online (See full list)