fixed the worm.

This commit is contained in:
Flanks255 2023-01-15 17:47:13 -06:00
parent 72e29bf696
commit e2fb8b12a9
4 changed files with 13 additions and 23 deletions

View file

@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.blocks.render.*; import de.ellpeck.actuallyadditions.mod.blocks.render.*;
import de.ellpeck.actuallyadditions.mod.entity.EntityWorm;
import de.ellpeck.actuallyadditions.mod.entity.InitEntities; import de.ellpeck.actuallyadditions.mod.entity.InitEntities;
import de.ellpeck.actuallyadditions.mod.entity.RenderWorm; import de.ellpeck.actuallyadditions.mod.entity.RenderWorm;
import de.ellpeck.actuallyadditions.mod.event.ClientEvents; import de.ellpeck.actuallyadditions.mod.event.ClientEvents;
@ -29,6 +30,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.client.registry.ClientRegistry; import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
public class ActuallyAdditionsClient { public class ActuallyAdditionsClient {
@ -60,7 +62,6 @@ public class ActuallyAdditionsClient {
ScreenManager.register(ActuallyContainers.RANGED_COLLECTOR_CONTAINER.get(), GuiRangedCollector::new); ScreenManager.register(ActuallyContainers.RANGED_COLLECTOR_CONTAINER.get(), GuiRangedCollector::new);
ScreenManager.register(ActuallyContainers.XPSOLIDIFIER_CONTAINER.get(), GuiXPSolidifier::new); ScreenManager.register(ActuallyContainers.XPSOLIDIFIER_CONTAINER.get(), GuiXPSolidifier::new);
// From old proxy // From old proxy
InitEntities.initClient();
MinecraftForge.EVENT_BUS.register(new ClientEvents()); MinecraftForge.EVENT_BUS.register(new ClientEvents());
MinecraftForge.EVENT_BUS.register(new ClientRegistryHandler()); MinecraftForge.EVENT_BUS.register(new ClientRegistryHandler());
MinecraftForge.EVENT_BUS.register(new SpecialRenderInit()); MinecraftForge.EVENT_BUS.register(new SpecialRenderInit());
@ -99,6 +100,8 @@ public class ActuallyAdditionsClient {
ClientRegistry.bindTileEntityRenderer(ActuallyBlocks.LASER_RELAY_ITEM.getTileEntityType(), RenderLaserRelay::new); ClientRegistry.bindTileEntityRenderer(ActuallyBlocks.LASER_RELAY_ITEM.getTileEntityType(), RenderLaserRelay::new);
ClientRegistry.bindTileEntityRenderer(ActuallyBlocks.LASER_RELAY_ITEM_ADVANCED.getTileEntityType(), RenderLaserRelay::new); ClientRegistry.bindTileEntityRenderer(ActuallyBlocks.LASER_RELAY_ITEM_ADVANCED.getTileEntityType(), RenderLaserRelay::new);
ClientRegistry.bindTileEntityRenderer(ActuallyBlocks.LASER_RELAY_FLUIDS.getTileEntityType(), RenderLaserRelay::new); ClientRegistry.bindTileEntityRenderer(ActuallyBlocks.LASER_RELAY_FLUIDS.getTileEntityType(), RenderLaserRelay::new);
RenderingRegistry.registerEntityRenderingHandler(ActuallyAdditions.ENTITY_WORM.get(), RenderWorm::new);
} }
// TODO: [port] validate that this works // TODO: [port] validate that this works

View file

@ -17,11 +17,13 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.IPacket; import net.minecraft.network.IPacket;
import net.minecraft.network.play.server.SSpawnObjectPacket;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld; import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.common.IPlantable; import net.minecraftforge.common.IPlantable;
import net.minecraftforge.fml.network.NetworkHooks;
public class EntityWorm extends Entity { public class EntityWorm extends Entity {
@ -128,6 +130,6 @@ public class EntityWorm extends Entity {
@Override @Override
public IPacket<?> getAddEntityPacket() { public IPacket<?> getAddEntityPacket() {
return null; return NetworkHooks.getEntitySpawningPacket(this);
} }
} }

View file

@ -23,6 +23,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Util; import net.minecraft.util.Util;
import net.minecraft.util.math.vector.Quaternion; import net.minecraft.util.math.vector.Quaternion;
import net.minecraft.util.math.vector.Vector3f;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
@ -46,9 +47,8 @@ public class RenderWorm extends EntityRenderer<EntityWorm> {
matrix.translate(0, 0.7F, 0); matrix.translate(0, 0.7F, 0);
double boop = Util.getMillis() / 70D; double boop = Util.getMillis() / 70D;
matrix.mulPose(new Quaternion(-(float) (boop % 360), 0, 1, 0)); matrix.mulPose(Vector3f.YP.rotationDegrees(-(float) (boop % 360)));
matrix.translate(0,0,0.4);
// stack.getDisplayName()
Minecraft.getInstance().getItemRenderer().renderStatic( Minecraft.getInstance().getItemRenderer().renderStatic(
stack, ItemCameraTransforms.TransformType.FIXED, light, OverlayTexture.NO_OVERLAY, matrix, buffer stack, ItemCameraTransforms.TransformType.FIXED, light, OverlayTexture.NO_OVERLAY, matrix, buffer
); );
@ -56,21 +56,6 @@ public class RenderWorm extends EntityRenderer<EntityWorm> {
matrix.popPose(); matrix.popPose();
} }
// @Override
// public void doRender(EntityWorm entity, double x, double y, double z, float entityYaw, float partialTicks) {
// GlStateManager.pushMatrix();
// this.bindEntityTexture(entity);
// GlStateManager.translate(x, y + 0.7F, z);
// double boop = Minecraft.getSystemTime() / 70D;
// GlStateManager.rotate(-(float) (boop % 360), 0, 1, 0);
// GlStateManager.translate(0, 0, 0.4);
//
// stack.setStackDisplayName(entity.getName());
// AssetUtil.renderItemInWorld(stack, combinedLightIn, combinedOverlayIn, matrices, buffer);
//
// GlStateManager.popMatrix();
// }
@Override @Override
public ResourceLocation getTextureLocation(EntityWorm pEntity) { public ResourceLocation getTextureLocation(EntityWorm pEntity) {
return PlayerContainer.BLOCK_ATLAS; return PlayerContainer.BLOCK_ATLAS;