Jump to content

Recommended Posts

Posted (edited)
package me.oreobean.boomerang.entities;

import me.oreobean.boomerang.registries.EntityRegistry;
import net.minecraft.entity.EntityType;

import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.IPacket;
import net.minecraft.world.World;
import net.minecraftforge.fml.network.FMLPlayMessages;
import net.minecraftforge.fml.network.NetworkHooks;

public class WoodBoomerangEntity extends AbstractBoomerangEntity{
    public WoodBoomerangEntity(EntityType<? extends WoodBoomerangEntity> type, World world){
        super(type, world);
    }
    public void registerData(){

    }


     @Override
    protected void readAdditional(CompoundNBT compound) {


    }

    @Override
    protected void writeAdditional(CompoundNBT compound) {

    }

    public IPacket<?> createSpawnPacket(){
        return NetworkHooks.getEntitySpawningPacket(this);
    }
    public WoodBoomerangEntity(FMLPlayMessages.SpawnEntity packet, World worldIn){
        super(EntityRegistry.WOOD_BOOMERANG_ENTITY.get(), worldIn);
    }
    public WoodBoomerangEntity(EntityType<? extends WoodBoomerangEntity> type, double x, double y, double z, World world){
        super(EntityRegistry.WOOD_BOOMERANG_ENTITY.get(), world);


    }

    @Override
    public void tick() {
        super.tick();
        this.setPositionAndRotation(this.getPosX(), this.getPosY(), this.getPosZ(), 20,20);
        System.out.println(this.getRotationYawHead());

    }
}

Entity code

 

Edited by OreoBean
Posted
package me.oreobean.boomerang.client.renderers;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import me.oreobean.boomerang.Main;
import me.oreobean.boomerang.client.models.WoodBoomerangModel;
import me.oreobean.boomerang.entities.WoodBoomerangEntity;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.entity.passive.horse.AbstractHorseEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.client.registry.IRenderFactory;

import javax.sound.midi.Receiver;

public class WoodBoomerangRenderer extends EntityRenderer<WoodBoomerangEntity> {
    private static ResourceLocation TEXTURE = new ResourceLocation(Main.MOD_ID, "textures/entity/wood_boomerang.png");
    private final WoodBoomerangModel<WoodBoomerangEntity> MODEL = new WoodBoomerangModel<>();
    public WoodBoomerangRenderer(EntityRendererManager manager){
        super(manager);
    }

    public ResourceLocation getEntityTexture(WoodBoomerangEntity entity){
        return TEXTURE;
    }
    public void render(WoodBoomerangEntity entityIn, float entityYaw, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn) {
        IVertexBuilder ivertexbuilder = net.minecraft.client.renderer.ItemRenderer.getBuffer(bufferIn, this.MODEL.getRenderType(this.getEntityTexture(entityIn)), false, false);
        MODEL.render(matrixStackIn, ivertexbuilder, packedLightIn, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F,1.0F, 1.0F);
        super.render(entityIn, entityYaw, partialTicks, matrixStackIn, bufferIn, packedLightIn);
    }

}

renderer

Posted

here

// Made with Blockbench 3.9.2
// Exported for Minecraft version 1.15 - 1.16 with MCP mappings
// Paste this class into your mod and generate all required imports
package me.oreobean.boomerang.client.models;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import me.oreobean.boomerang.entities.WoodBoomerangEntity;
import net.minecraft.client.renderer.entity.model.EntityModel;
import net.minecraft.client.renderer.model.ModelRenderer;
import net.minecraft.client.renderer.entity.ArrowRenderer;
import net.minecraft.client.renderer.entity.BeeRenderer;

public class WoodBoomerangModel<T extends WoodBoomerangEntity> extends EntityModel<WoodBoomerangEntity> {
    private final ModelRenderer Boomerang;
    private final ModelRenderer OuterArea;
    private final ModelRenderer Bands;
    private final ModelRenderer OuterArea2;
    private final ModelRenderer MiddleArea;

    public WoodBoomerangModel() {
        textureWidth = 32;
        textureHeight = 32;

        Boomerang = new ModelRenderer(this);
        Boomerang.setRotationPoint(0.0F, 24.0F, 0.0F);


        OuterArea = new ModelRenderer(this);
        OuterArea.setRotationPoint(0.0F, 0.0F, 0.0F);
        Boomerang.addChild(OuterArea);
        OuterArea.setTextureOffset(19, 21).addBox(-7.0F, -1.0F, -5.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
        OuterArea.setTextureOffset(11, 0).addBox(-4.0F, -1.0F, -8.0F, 7.0F, 1.0F, 1.0F, 0.0F, false);
        OuterArea.setTextureOffset(0, 8).addBox(-8.0F, -1.0F, -4.0F, 1.0F, 1.0F, 7.0F, 0.0F, false);
        OuterArea.setTextureOffset(21, 18).addBox(-6.0F, -1.0F, -6.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
        OuterArea.setTextureOffset(21, 16).addBox(-5.0F, -1.0F, -7.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
        OuterArea.setTextureOffset(0, 8).addBox(-8.0F, -1.0F, 5.0F, 1.0F, 1.0F, 2.0F, 0.0F, false);
        OuterArea.setTextureOffset(0, 13).addBox(5.0F, -1.0F, -8.0F, 2.0F, 1.0F, 1.0F, 0.0F, false);

        Bands = new ModelRenderer(this);
        Bands.setRotationPoint(0.0F, 0.0F, 0.0F);
        Boomerang.addChild(Bands);
        Bands.setTextureOffset(11, 2).addBox(3.0F, -1.0F, -8.0F, 2.0F, 1.0F, 4.0F, 0.0F, false);
        Bands.setTextureOffset(0, 16).addBox(-8.0F, -1.0F, 3.0F, 4.0F, 1.0F, 2.0F, 0.0F, false);

        OuterArea2 = new ModelRenderer(this);
        OuterArea2.setRotationPoint(0.0F, 0.0F, 0.0F);
        Boomerang.addChild(OuterArea2);
        OuterArea2.setTextureOffset(0, 3).addBox(7.0F, -1.0F, -7.0F, 1.0F, 1.0F, 2.0F, 0.0F, false);
        OuterArea2.setTextureOffset(9, 11).addBox(5.0F, -1.0F, -5.0F, 2.0F, 1.0F, 1.0F, 0.0F, false);
        OuterArea2.setTextureOffset(12, 17).addBox(-1.0F, -1.0F, -5.0F, 4.0F, 1.0F, 1.0F, 0.0F, false);
        OuterArea2.setTextureOffset(15, 21).addBox(-3.0F, -1.0F, -3.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
        OuterArea2.setTextureOffset(11, 21).addBox(-4.0F, -1.0F, -2.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
        OuterArea2.setTextureOffset(7, 21).addBox(-2.0F, -1.0F, -4.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
        OuterArea2.setTextureOffset(12, 12).addBox(-5.0F, -1.0F, -1.0F, 1.0F, 1.0F, 4.0F, 0.0F, false);
        OuterArea2.setTextureOffset(0, 0).addBox(-5.0F, -1.0F, 5.0F, 1.0F, 1.0F, 2.0F, 0.0F, false);
        OuterArea2.setTextureOffset(0, 11).addBox(-7.0F, -1.0F, 7.0F, 2.0F, 1.0F, 1.0F, 0.0F, false);

        MiddleArea = new ModelRenderer(this);
        MiddleArea.setRotationPoint(0.0F, 0.0F, 0.0F);
        Boomerang.addChild(MiddleArea);
        MiddleArea.setTextureOffset(0, 0).addBox(-7.0F, -1.0F, -4.0F, 2.0F, 1.0F, 7.0F, 0.0F, false);
        MiddleArea.setTextureOffset(19, 2).addBox(-7.0F, -1.0F, 5.0F, 2.0F, 1.0F, 2.0F, 0.0F, false);
        MiddleArea.setTextureOffset(9, 8).addBox(-4.0F, -1.0F, -7.0F, 7.0F, 1.0F, 2.0F, 0.0F, false);
        MiddleArea.setTextureOffset(0, 19).addBox(5.0F, -1.0F, -7.0F, 2.0F, 1.0F, 2.0F, 0.0F, false);
        MiddleArea.setTextureOffset(18, 11).addBox(-5.0F, -1.0F, -5.0F, 2.0F, 1.0F, 2.0F, 0.0F, false);
        MiddleArea.setTextureOffset(18, 19).addBox(-3.0F, -1.0F, -5.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
        MiddleArea.setTextureOffset(14, 19).addBox(-3.0F, -1.0F, -4.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
        MiddleArea.setTextureOffset(10, 19).addBox(-5.0F, -1.0F, -3.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
        MiddleArea.setTextureOffset(6, 19).addBox(-5.0F, -1.0F, -2.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
        MiddleArea.setTextureOffset(18, 14).addBox(-4.0F, -1.0F, -3.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
        MiddleArea.setTextureOffset(9, 13).addBox(-2.0F, -1.0F, -5.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
        MiddleArea.setTextureOffset(11, 4).addBox(-5.0F, -1.0F, -6.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);
        MiddleArea.setTextureOffset(11, 2).addBox(-6.0F, -1.0F, -5.0F, 1.0F, 1.0F, 1.0F, 0.0F, false);


    }

   @Override
    public void setRotationAngles(WoodBoomerangEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch){

    }

    @Override
    public void render(MatrixStack matrixStack, IVertexBuilder buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha){
        Boomerang.render(matrixStack, buffer, packedLight, packedOverlay);

    }

    public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
        modelRenderer.rotateAngleX = x;
        modelRenderer.rotateAngleY = y;
        modelRenderer.rotateAngleZ = z;

    }

    @Override
    public void setLivingAnimations(WoodBoomerangEntity entityIn, float limbSwing, float limbSwingAmount, float partialTick) {
        super.setLivingAnimations(entityIn, limbSwing, limbSwingAmount, partialTick);
    }

    public ModelRenderer getBands() {
        return Bands;
    }

    public ModelRenderer getBoomerang() {
        return Boomerang;
    }

    public ModelRenderer getMiddleArea() {
        return MiddleArea;
    }

    public ModelRenderer getOuterArea() {
        return OuterArea;
    }

    public ModelRenderer getOuterArea2() {
        return OuterArea2;
    }
}

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello all. I'm currently grappling with the updateShape method in a custom class extending Block.  My code currently looks like this: The conditionals in CheckState are there to switch blockstate properties, which is working fine, as it functions correctly every time in getStateForPlacement.  The problem I'm running into is that when I update a state, the blocks seem to call CheckState with the position of the block which was changed updated last.  If I build a wall I can see the same change propagate across. My question thus is this: is updateShape sending its return to the neighbouring block?  Is each block not independently executing the updateShape method, thus inserting its own current position?  The first statement appears to be true, and the second false (each block is not independently executing the method). I have tried to fix this by saving the block's own position to a variable myPos at inception, and then feeding this in as CheckState(myPos) but this causes a worse outcome, where all blocks take the update of the first modified block, rather than just their neighbour.  This raises more questions than it answers, obviously: how is a different instance's variable propagating here?  I also tried changing it so that CheckState did not take a BlockPos, but had myPos built into the body - same problem. I have previously looked at neighbourUpdate and onNeighbourUpdate, but could not find a way to get this to work at all.  One post on here about updatePostPlacement and other methods has proven itself long superceded.  All other sources on the net seem to be out of date. Many thanks in advance for any help you might offer me, it's been several days now of trying to get this work and several weeks of generally trying to get round this roadblock.  - Sandermall
    • sorry, I might be stupid, but how do I open it? because the only options I have are too X out, copy it, which doesn't work and send crash report, which doesn't show it to me, also, sorry for taking so long.
    • Can you reproduce this with version 55.0.21? A whole lot of plant placement issues were just fixed in this PR.
    • Necro'ing that thread to ask if you found a solution ? I'm encountering the same crash on loading the world. I created the world in Creative to test my MP, went into survival to test combat, died, crashed on respawn and since then crash on loading the world. Deactivating Oculus isn't fixing it either, and I don't have Optifine (Twilight forest is incompatible)
  • Topics

×
×
  • Create New...

Important Information

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