Jump to content

ocome

Members
  • Posts

    91
  • Joined

  • Last visited

Everything posted by ocome

  1. I solved problem is Hunger value is duplicated
  2. public class ManaOverlay extends Gui implements IIngameOverlay { private final Minecraft mc; private Font font = null; public int left_height = 39; public int right_height = 49; private RenderGameOverlayEvent eventParent; public static final ResourceLocation GUI_MANA_LOCATION = new ResourceLocation("textures/gui/icons.png"); private static final ManaOverlay INSTANCE = new ManaOverlay(Minecraft.getInstance()); public ManaOverlay(Minecraft p_93005_) { super(p_93005_); this.mc = Minecraft.getInstance(); this.font = mc.font; OverlayRegistry.registerOverlayTop("Mana ", (gui, mStack, partialTicks, screenWidth, screenHeight) -> { boolean isMounted = gui.minecraft.player.getVehicle() instanceof LivingEntity; if (!isMounted && !gui.minecraft.options.hideGui && gui.shouldDrawSurvivalElements()) { setupOverlayRenderState(true, false); renderMana(screenWidth, screenHeight, mStack); } }); } public void setupOverlayRenderState(boolean blend, boolean depthText) { setupOverlayRenderState(blend, depthText, GUI_MANA_LOCATION); } public void setupOverlayRenderState(boolean blend, boolean depthTest, @Nullable ResourceLocation texture) { if (blend) { RenderSystem.enableBlend(); RenderSystem.defaultBlendFunc(); } else { RenderSystem.disableBlend(); } if (depthTest) { RenderSystem.enableDepthTest(); } else { RenderSystem.disableDepthTest(); } if (texture != null) { RenderSystem.enableTexture(); bind(texture); } else { RenderSystem.disableTexture(); } RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.setShader(GameRenderer::getPositionTexShader); } public static void init() { MinecraftForge.EVENT_BUS.register(INSTANCE); } public void renderMana(int width, int height, PoseStack mStack) { minecraft.getProfiler().push("mana"); Player player = (Player)this.minecraft.getCameraEntity(); RenderSystem.enableBlend(); int left = width / 2 + 91; int top = height - right_height ; boolean unused = false;// Unused flag in vanilla, seems to be part of a 'fade out' mechanic FoodData stats = minecraft.player.getFoodData(); int level = stats.getFoodLevel(); for (int i = 0; i < 10; ++i) { int idx = i * 2 + 1; int x = left - i * 8 - 9; int y = top; int icon = 16; byte background = 0; if (minecraft.player.hasEffect(MobEffects.HUNGER)) { icon += 36; background = 13; } if (unused) background = 1; //Probably should be a += 1 but vanilla never uses this if (player.getFoodData().getSaturationLevel() <= 0.0F && tickCount % (level * 3 + 1) == 0) { y = top + (random.nextInt(3) - 1); } blit(mStack, x, y, 16 + background * 9, 27, 9, 9); if (idx < level) blit(mStack, x, y, icon + 36, 27, 9, 9); else if (idx == level) blit(mStack, x, y, icon + 45, 27, 9, 9); } RenderSystem.disableBlend(); minecraft.getProfiler().pop(); } @Override public void render(ForgeIngameGui gui, PoseStack pStack, float partialTicks, int width, int height) { this.screenWidth = this.minecraft.getWindow().getGuiScaledWidth(); this.screenHeight = this.minecraft.getWindow().getGuiScaledHeight(); eventParent = new RenderGameOverlayEvent(pStack, partialTicks, this.minecraft.getWindow()); if (pre(ALL, pStack)) return; font = minecraft.font; this.random.setSeed(tickCount * 312871L); OverlayRegistry.orderedEntries().forEach(entry -> { try { if (!entry.isEnabled()) return; IIngameOverlay overlay = entry.getOverlay(); if (pre(overlay, pStack)) return; //overlay.render(this, pStack, partialTicks, screenWidth, screenHeight); post(overlay, pStack); } catch(Exception e) { } }); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); post(ALL, pStack); } private boolean pre(RenderGameOverlayEvent.ElementType type, PoseStack mStack) { return MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Pre(mStack, eventParent, type)); } private void post(RenderGameOverlayEvent.ElementType type, PoseStack mStack) { MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Post(mStack, eventParent, type)); } private boolean pre(IIngameOverlay overlay, PoseStack mStack) { return MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.PreLayer(mStack, eventParent, overlay)); } private void post(IIngameOverlay overlay, PoseStack mStack) { MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.PostLayer(mStack, eventParent, overlay)); } private void bind(ResourceLocation res) { RenderSystem.setShaderTexture(0, res); } } Thanks to you, I was able to display it. However, the bar that uses the full hunger keeps shaking. I wonder why that is? Then I feel like it's getting heavier ...
  3. I see. It says that enqueue is not necessary. I was wondering if I had to call the event again somewhere. I was able to call the existing health and see that the two rows of stats are displayed! Thank you Luis.
  4. I added it like this main private void doClientStuff(final FMLClientSetupEvent event) { event.enqueueWork(() -> { OverlayRegistry.registerOverlayBelow(ForgeIngameGui.FOOD_LEVEL_ELEMENT , "Mana", new ManaOverlay()); }); } But it's not working. I feel that you don't understand about main... I'll try to find it.
  5. public ManaHealthOverlay() { this.minecraft = Minecraft.getInstance(); OverlayRegistry.registerOverlayBelow(ForgeIngameGui.FOOD_LEVEL_ELEMENT , "Mana", this); } Does this solve the problem with OverlayRegistry? I thought I had implemented Mana based on the player's stats. But nothing shows up. Is it still not enough? The second half is equivalent to playerhealth, only the values have been changed. public class ManaOverlay extends GuiComponent implements IIngameOverlay { protected int screenWidth; protected int screenHeight; protected int tickCount; protected int lastMana; protected int displayMana; protected long lastManaTime; protected long manaBlinkTime; private final Minecraft minecraft; protected final Random random = new Random(); private static final ResourceLocation GUI_MANA_LOCATION = new ResourceLocation("textures/gui/bars.png"); final Map<UUID, LerpingBossEvent> events = Maps.newLinkedHashMap(); private static final ManaOverlay INSTANCE = new ManaOverlay(); public static void init() { MinecraftForge.EVENT_BUS.register(INSTANCE); } public ManaOverlay() { this.minecraft = Minecraft.getInstance(); OverlayRegistry.registerOverlayBelow(ForgeIngameGui.FOOD_LEVEL_ELEMENT , "Mana", this); } private Player getCameraPlayer() { return !(this.minecraft.getCameraEntity() instanceof Player) ? null : (Player)this.minecraft.getCameraEntity(); } ....
  6. oh All right. I'll try it right away. thank you
  7. I wanted to implement mana values, so I first tried to run it using Bosshealth, but nothing shows up! I think it's not being called, but is it impossible to call it in init? Mana health public class ManaHealthOverlay extends GuiComponent { private final Minecraft minecraft; private static final ResourceLocation GUI_MANA_LOCATION = new ResourceLocation("textures/gui/bars.png"); private static final int BAR_WIDTH = 182; private static final int BAR_HEIGHT = 5; private static final int OVERLAY_OFFSET = 80; final Map<UUID, LerpingBossEvent> events = Maps.newLinkedHashMap(); private static final ManaHealthOverlay INSTANCE = new ManaHealthOverlay(); public static void init() { MinecraftForge.EVENT_BUS.register(INSTANCE); } public ManaHealthOverlay() { this.minecraft = Minecraft.getInstance(); } public void render(PoseStack p_93705_) { //if (!this.events.isEmpty()) { int i = this.minecraft.getWindow().getGuiScaledWidth(); int j = 12; for(LerpingBossEvent lerpingbossevent : this.events.values()) { int k = i / 2 - 91; ...... main public Mod() { ManaHealthOverlay.init();
  8. Solved Code SoundEvents public class ModSoundEvents { public static final DeferredRegister<SoundEvent> SOUNDS = DeferredRegister.create(ForgeRegistries.SOUND_EVENTS, TutorialMod.MOD_ID); public static final RegistryObject<SoundEvent> TUTORIALSOUND= SOUNDS.register("tutorial_sound", () -> new SoundEvent(new ResourceLocation(TutorialMod.MOD_ID, "tutorial_sound"))); } main public TutorialMod() { IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus(); ModSoundEvents.SOUNDS.register(eventBus); ........... Mob protected SoundEvent getStepSound() { return ModSoundEvents.TUTORIALSOUND.get(); }
  9. I'm busy so I'll fill in the solution later, but it's solved. Thanks Luis_ST
  10. After some research, I found that using DeferredRegister is the best choice for now. I'll give it a try.
  11. I added the blocks by referring to the code to add them, but it didn't work very well. Is there anything else that needs to be done? ModSoundEvents @Mod.EventBusSubscriber(modid = TutorialMod.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) public class ModSoundEvents { public static final SoundEvent TUTORIALSOUND= new SoundEvent(new ResourceLocation("tutorial_sound")); @SubscribeEvent public static void registerSounds(RegistryEvent.Register<SoundEvent> event){ event.getRegistry().register(TUTORIALSOUND.setRegistryName("tutorial_sound")); } }
  12. It is possible to play sounds in playsound, but no sound is played from the Mob TutorialZombie protected SoundEvent getAmbientSound() { return ModSoundEvents.TUTORIALSOUND; } protected SoundEvent getHurtSound(DamageSource p_34327_) { return ModSoundEvents.TUTORIALSOUND; } protected SoundEvent getDeathSound() { return ModSoundEvents.TUTORIALSOUND; } protected SoundEvent getStepSound() { return ModSoundEvents.TUTORIALSOUND; } ModSoundEvents.java @Mod.EventBusSubscriber(modid = TutorialMod.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) public class ModSoundEvents { public static final SoundEvent TUTORIALSOUND= new SoundEvent(new ResourceLocation("entity.tutorial_sound")); } resources/assets/sounds.json { "tutorial_sound": { "category": "tutorialmod:tutorial", "subtitle": "tutorialmod:tutorial_sound", "sounds": [ { "name": "tutorialmod:tutorial_sound", "stream": true } ] } } resources/assets/tutorialmod/sounds tutorial_sound.ogg No particular kind of error occurs. It's just silent. Thank you in advance.
  13. Oh... Sorry I don't know why I didn't notice something so basic You were right about that. Thank you very much.
  14. Was this a bad question? If so, I'm sorry
  15. I tried to create the same monster as in vanilla, but when I use the Summon command, it appears for a moment and then disappears TutorialZombie public class TutorialZombie extends Monster { private static final UUID SPEED_MODIFIER_BABY_UUID = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A270D836"); private static final AttributeModifier SPEED_MODIFIER_BABY = new AttributeModifier(SPEED_MODIFIER_BABY_UUID, "Baby speed boost", 0.5D, AttributeModifier.Operation.MULTIPLY_BASE); private static final EntityDataAccessor<Boolean> DATA_BABY_ID = SynchedEntityData.defineId(TutorialZombie.class, EntityDataSerializers.BOOLEAN); private static final EntityDataAccessor<Integer> DATA_SPECIAL_TYPE_ID = SynchedEntityData.defineId(TutorialZombie.class, EntityDataSerializers.INT); private static final EntityDataAccessor<Boolean> DATA_DROWNED_CONVERSION_ID = SynchedEntityData.defineId(TutorialZombie.class, EntityDataSerializers.BOOLEAN); public static final float ZOMBIE_LEADER_CHANCE = 0.05F; public static final int REINFORCEMENT_ATTEMPTS = 50; public static final int REINFORCEMENT_RANGE_MAX = 40; public static final int REINFORCEMENT_RANGE_MIN = 7; private static final float BREAK_DOOR_CHANCE = 0.1F; private static final Predicate<Difficulty> DOOR_BREAKING_PREDICATE = (p_34284_) -> { return p_34284_ == Difficulty.HARD; }; private final BreakDoorGoal breakDoorGoal = new BreakDoorGoal(this, DOOR_BREAKING_PREDICATE); private boolean canBreakDoors; private int inWaterTime; private int conversionTime; public TutorialZombie(EntityType<? extends TutorialZombie> p_34271_, Level p_34272_) { super(p_34271_, p_34272_); } protected TutorialZombie(Level p_34274_) { this(ModEntityType.TUTORIAL_ZOMBIE, p_34274_); } protected void registerGoals() { this.goalSelector.addGoal(4, new TutorialZombie.ZombieAttackTurtleEggGoal(this, 1.0D, 3)); this.goalSelector.addGoal(8, new LookAtPlayerGoal(this, Player.class, 8.0F)); this.goalSelector.addGoal(8, new RandomLookAroundGoal(this)); this.addBehaviourGoals(); } protected void addBehaviourGoals() { // this.goalSelector.addGoal(2, new ZombieAttackGoal(this, 1.0D, false)); this.goalSelector.addGoal(6, new MoveThroughVillageGoal(this, 1.0D, true, 4, this::canBreakDoors)); this.goalSelector.addGoal(7, new WaterAvoidingRandomStrollGoal(this, 1.0D)); this.targetSelector.addGoal(1, (new HurtByTargetGoal(this)).setAlertOthers(ZombifiedPiglin.class)); this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, true)); this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, AbstractVillager.class, false)); this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, IronGolem.class, true)); this.targetSelector.addGoal(5, new NearestAttackableTargetGoal<>(this, Turtle.class, 10, true, false, Turtle.BABY_ON_LAND_SELECTOR)); } .... Model public class TutorialZombieModel<T extends TutorialZombie> extends AbstractZombieModel<T> { public TutorialZombieModel(ModelPart p_171090_) { super(p_171090_); } public static LayerDefinition createBodyLayer() { MeshDefinition meshdefinition = createMesh( CubeDeformation.NONE,0.0F); return LayerDefinition.create(meshdefinition, 64, 64); } public static MeshDefinition createMesh(CubeDeformation p_170682_, float p_170683_) { MeshDefinition meshdefinition = new MeshDefinition(); PartDefinition partdefinition = meshdefinition.getRoot(); partdefinition.addOrReplaceChild("head", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, p_170682_), PartPose.offset(0.0F, 0.0F + p_170683_, 0.0F)); partdefinition.addOrReplaceChild("hat", CubeListBuilder.create().texOffs(32, 0).addBox(-4.0F, -8.0F, -4.0F, 8.0F, 8.0F, 8.0F, p_170682_.extend(0.5F)), PartPose.offset(0.0F, 0.0F + p_170683_, 0.0F)); partdefinition.addOrReplaceChild("body", CubeListBuilder.create().texOffs(16, 16).addBox(-4.0F, 0.0F, -2.0F, 8.0F, 12.0F, 4.0F, p_170682_), PartPose.offset(0.0F, 0.0F + p_170683_, 0.0F)); partdefinition.addOrReplaceChild("right_arm", CubeListBuilder.create().texOffs(40, 16).addBox(-3.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, p_170682_), PartPose.offset(-5.0F, 2.0F + p_170683_, 0.0F)); partdefinition.addOrReplaceChild("left_arm", CubeListBuilder.create().texOffs(40, 16).mirror().addBox(-1.0F, -2.0F, -2.0F, 4.0F, 12.0F, 4.0F, p_170682_), PartPose.offset(5.0F, 2.0F + p_170683_, 0.0F)); partdefinition.addOrReplaceChild("right_leg", CubeListBuilder.create().texOffs(0, 16).addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, p_170682_), PartPose.offset(-1.9F, 12.0F + p_170683_, 0.0F)); partdefinition.addOrReplaceChild("left_leg", CubeListBuilder.create().texOffs(0, 16).mirror().addBox(-2.0F, 0.0F, -2.0F, 4.0F, 12.0F, 4.0F, p_170682_), PartPose.offset(1.9F, 12.0F + p_170683_, 0.0F)); return meshdefinition; } public boolean isAggressive(T p_104155_) { return p_104155_.isAggressive(); } } Renderer public class TutorialZombieRenderer extends TutorialAbstractZombieRenderer<TutorialZombie, TutorialZombieModel<TutorialZombie>> { public TutorialZombieRenderer(EntityRendererProvider.Context p_174456_) { this(p_174456_, ModEntityRenderers.TUTORIAL_ZOMNBIE_LAYER); } public TutorialZombieRenderer(EntityRendererProvider.Context p_174458_, ModelLayerLocation p_174459_) { super(p_174458_, new TutorialZombieModel<>(p_174458_.bakeLayer(p_174459_))); } } EntityType public class ModEntityType{ public static final EntityType<TutorialZombie> TUTORIAL_ZOMBIE= EntityType.Builder.of(TutorialZombie::new, MobCategory.MONSTER) .sized(0.9F, 0.9F).clientTrackingRange(10).build(prefix("tutorial_zombie")); @SubscribeEvent public static void registerEntity(RegistryEvent.Register<EntityType<?>> event) { event.getRegistry().register(TUTORIAL_ZOMBIE.setRegistryName("tutorial_zombie")); SpawnPlacements.register(TUTORIAL_ZOMBIE, SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Monster::checkMonsterSpawnRules); } @SubscribeEvent public static void registerEntityAttribute(EntityAttributeCreationEvent event) { event.put(TUTORIAL_ZOMBIE, TutorialZombie.createAttributes().build()); } } EntityRenderer public class ModEntityRenderers{ public static ModelLayerLocation TUTORIAL_ZOMNBIE_LAYER = new ModelLayerLocation(new ResourceLocation(TutorialMod.MOD_ID, "tutorial_zombie"), "tutorial_zombie"); public static ModelLayerLocation createBoatModelName(TutorialBoat.Type p_171290_) { return createLocation("boat/" + p_171290_.getName(), "main"); } private static ModelLayerLocation createLocation(String p_171301_, String p_171302_) { return new ModelLayerLocation(new ResourceLocation("minecraft", p_171301_), p_171302_); } public static void init() { } //registry list @SubscribeEvent public static void registerEntityRenders(EntityRenderersEvent.RegisterRenderers event) { event.registerEntityRenderer(ModEntityType.TUTORIAL_ZOMBIE, TutorialZombieRenderer::new); } //renderer list @SubscribeEvent public static void registerLayerDefinition(EntityRenderersEvent.RegisterLayerDefinitions event) { event.registerLayerDefinition(TUTORIAL_ZOMNBIE_LAYER, TutorialZombieModel::createBodyLayer); } } Github Link https://github.com/ocome85/Mod-Tutorial/tree/main/Tutorial1.18 Only monsters are experiencing this phenomenon. Please help!
  16. public class TutorialBoat extends Entity { private static final EntityDataAccessor<Integer> DATA_ID_HURT = SynchedEntityData.defineId(TutorialBoat.class, EntityDataSerializers.INT); private static final EntityDataAccessor<Integer> DATA_ID_HURTDIR = SynchedEntityData.defineId(TutorialBoat.class, EntityDataSerializers.INT); private static final EntityDataAccessor<Float> DATA_ID_DAMAGE = SynchedEntityData.defineId(TutorialBoat.class, EntityDataSerializers.FLOAT); private static final EntityDataAccessor<Integer> DATA_ID_TYPE = SynchedEntityData.defineId(TutorialBoat.class, EntityDataSerializers.INT); private static final EntityDataAccessor<Boolean> DATA_ID_PADDLE_LEFT = SynchedEntityData.defineId(TutorialBoat.class, EntityDataSerializers.BOOLEAN); private static final EntityDataAccessor<Boolean> DATA_ID_PADDLE_RIGHT = SynchedEntityData.defineId(TutorialBoat.class, EntityDataSerializers.BOOLEAN); private static final EntityDataAccessor<Integer> DATA_ID_BUBBLE_TIME = SynchedEntityData.defineId(TutorialBoat.class, EntityDataSerializers.INT); public static final int PADDLE_LEFT = 0; public static final int PADDLE_RIGHT = 1; private static final int TIME_TO_EJECT = 60; private static final double PADDLE_SPEED = (double)((float)Math.PI / 8F); public static final double PADDLE_SOUND_TIME = (double)((float)Math.PI / 4F); public static final int BUBBLE_TIME = 60; private final float[] paddlePositions = new float[2]; private float invFriction; private float outOfControlTicks; private float deltaRotation; private int lerpSteps; private double lerpX; private double lerpY; private double lerpZ; private double lerpYRot; private double lerpXRot; private boolean inputLeft; private boolean inputRight; private boolean inputUp; private boolean inputDown; private double waterLevel; private float landFriction; private TutorialBoat.Status status; private TutorialBoat.Status oldStatus; private double lastYd; private boolean isAboveBubbleColumn; private boolean bubbleColumnDirectionIsDown; private float bubbleMultiplier; private float bubbleAngle; private float bubbleAngleO; public TutorialBoat(EntityType<TutorialBoat> p_38290_, Level p_38291_) { super(p_38290_, p_38291_); this.blocksBuilding = true; } protected TutorialBoat(Level p_38293_, double p_38294_, double p_38295_, double p_38296_) { this(ModEntityType.TUTORIAL_BOAT, p_38293_); this.setPos(p_38294_, p_38295_, p_38296_); this.xo = p_38294_; this.yo = p_38295_; this.zo = p_38296_; } protected float getEyeHeight(Pose p_38327_, EntityDimensions p_38328_) { return p_38328_.height; } protected Entity.MovementEmission getMovementEmission() { return Entity.MovementEmission.NONE; } protected void defineSynchedData() { this.entityData.define(DATA_ID_HURT, 0); this.entityData.define(DATA_ID_HURTDIR, 1); this.entityData.define(DATA_ID_DAMAGE, 0.0F); this.entityData.define(DATA_ID_TYPE, TutorialBoat.Type.OAK.ordinal()); this.entityData.define(DATA_ID_PADDLE_LEFT, false); this.entityData.define(DATA_ID_PADDLE_RIGHT, false); this.entityData.define(DATA_ID_BUBBLE_TIME, 0); } public boolean canCollideWith(Entity p_38376_) { return canVehicleCollide(this, p_38376_); } public static boolean canVehicleCollide(Entity p_38324_, Entity p_38325_) { return (p_38325_.canBeCollidedWith() || p_38325_.isPushable()) && !p_38324_.isPassengerOfSameVehicle(p_38325_); } public boolean canBeCollidedWith() { return true; } public boolean isPushable() { return true; } protected Vec3 getRelativePortalPosition(Direction.Axis p_38335_, BlockUtil.FoundRectangle p_38336_) { return LivingEntity.resetForwardDirectionOfRelativePortalPosition(super.getRelativePortalPosition(p_38335_, p_38336_)); } public double getPassengersRidingOffset() { return -0.1D; } public boolean hurt(DamageSource p_38319_, float p_38320_) { if (this.isInvulnerableTo(p_38319_)) { return false; } else if (!this.level.isClientSide && !this.isRemoved()) { this.setHurtDir(-this.getHurtDir()); this.setHurtTime(10); this.setDamage(this.getDamage() + p_38320_ * 10.0F); this.markHurt(); this.gameEvent(GameEvent.ENTITY_DAMAGED, p_38319_.getEntity()); boolean flag = p_38319_.getEntity() instanceof Player && ((Player)p_38319_.getEntity()).getAbilities().instabuild; if (flag || this.getDamage() > 40.0F) { if (!flag && this.level.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) { this.spawnAtLocation(this.getDropItem()); } this.discard(); } return true; } else { return true; } } public void onAboveBubbleCol(boolean p_38381_) { if (!this.level.isClientSide) { this.isAboveBubbleColumn = true; this.bubbleColumnDirectionIsDown = p_38381_; if (this.getBubbleTime() == 0) { this.setBubbleTime(60); } } this.level.addParticle(ParticleTypes.SPLASH, this.getX() + (double)this.random.nextFloat(), this.getY() + 0.7D, this.getZ() + (double)this.random.nextFloat(), 0.0D, 0.0D, 0.0D); if (this.random.nextInt(20) == 0) { this.level.playLocalSound(this.getX(), this.getY(), this.getZ(), this.getSwimSplashSound(), this.getSoundSource(), 1.0F, 0.8F + 0.4F * this.random.nextFloat(), false); } this.gameEvent(GameEvent.SPLASH, this.getControllingPassenger()); } public void push(Entity p_38373_) { if (p_38373_ instanceof TutorialBoat) { if (p_38373_.getBoundingBox().minY < this.getBoundingBox().maxY) { super.push(p_38373_); } } else if (p_38373_.getBoundingBox().minY <= this.getBoundingBox().minY) { super.push(p_38373_); } } public Item getDropItem() { switch(this.getBoatType()) { case OAK: default: return Items.OAK_BOAT; case SPRUCE: return Items.SPRUCE_BOAT; case BIRCH: return Items.BIRCH_BOAT; case JUNGLE: return Items.JUNGLE_BOAT; case ACACIA: return Items.ACACIA_BOAT; case DARK_OAK: return Items.DARK_OAK_BOAT; } } public void animateHurt() { this.setHurtDir(-this.getHurtDir()); this.setHurtTime(10); this.setDamage(this.getDamage() * 11.0F); } public boolean isPickable() { return !this.isRemoved(); } public void lerpTo(double p_38299_, double p_38300_, double p_38301_, float p_38302_, float p_38303_, int p_38304_, boolean p_38305_) { this.lerpX = p_38299_; this.lerpY = p_38300_; this.lerpZ = p_38301_; this.lerpYRot = (double)p_38302_; this.lerpXRot = (double)p_38303_; this.lerpSteps = 10; } public Direction getMotionDirection() { return this.getDirection().getClockWise(); } public void tick() { this.oldStatus = this.status; this.status = this.getStatus(); if (this.status != TutorialBoat.Status.UNDER_WATER && this.status != TutorialBoat.Status.UNDER_FLOWING_WATER) { this.outOfControlTicks = 0.0F; } else { ++this.outOfControlTicks; } if (!this.level.isClientSide && this.outOfControlTicks >= 60.0F) { this.ejectPassengers(); } if (this.getHurtTime() > 0) { this.setHurtTime(this.getHurtTime() - 1); } if (this.getDamage() > 0.0F) { this.setDamage(this.getDamage() - 1.0F); } super.tick(); this.tickLerp(); if (this.isControlledByLocalInstance()) { if (!(this.getFirstPassenger() instanceof Player)) { this.setPaddleState(false, false); } this.floatBoat(); if (this.level.isClientSide) { this.controlBoat(); this.level.sendPacketToServer(new ServerboundPaddleBoatPacket(this.getPaddleState(0), this.getPaddleState(1))); } this.move(MoverType.SELF, this.getDeltaMovement()); } else { this.setDeltaMovement(Vec3.ZERO); } this.tickBubbleColumn(); for(int i = 0; i <= 1; ++i) { if (this.getPaddleState(i)) { if (!this.isSilent() && (double)(this.paddlePositions[i] % ((float)Math.PI * 2F)) <= (double)((float)Math.PI / 4F) && ((double)this.paddlePositions[i] + (double)((float)Math.PI / 8F)) % (double)((float)Math.PI * 2F) >= (double)((float)Math.PI / 4F)) { SoundEvent soundevent = this.getPaddleSound(); if (soundevent != null) { Vec3 vec3 = this.getViewVector(1.0F); double d0 = i == 1 ? -vec3.z : vec3.z; double d1 = i == 1 ? vec3.x : -vec3.x; this.level.playSound((Player)null, this.getX() + d0, this.getY(), this.getZ() + d1, soundevent, this.getSoundSource(), 1.0F, 0.8F + 0.4F * this.random.nextFloat()); this.level.gameEvent(this.getControllingPassenger(), GameEvent.SPLASH, new BlockPos(this.getX() + d0, this.getY(), this.getZ() + d1)); } } this.paddlePositions[i] = (float)((double)this.paddlePositions[i] + (double)((float)Math.PI / 8F)); } else { this.paddlePositions[i] = 0.0F; } } this.checkInsideBlocks(); List<Entity> list = this.level.getEntities(this, this.getBoundingBox().inflate((double)0.2F, (double)-0.01F, (double)0.2F), EntitySelector.pushableBy(this)); if (!list.isEmpty()) { boolean flag = !this.level.isClientSide && !(this.getControllingPassenger() instanceof Player); for(int j = 0; j < list.size(); ++j) { Entity entity = list.get(j); if (!entity.hasPassenger(this)) { if (flag && this.getPassengers().size() < 2 && !entity.isPassenger() && entity.getBbWidth() < this.getBbWidth() && entity instanceof LivingEntity && !(entity instanceof WaterAnimal) && !(entity instanceof Player)) { entity.startRiding(this); } else { this.push(entity); } } } } } private void tickBubbleColumn() { if (this.level.isClientSide) { int i = this.getBubbleTime(); if (i > 0) { this.bubbleMultiplier += 0.05F; } else { this.bubbleMultiplier -= 0.1F; } this.bubbleMultiplier = Mth.clamp(this.bubbleMultiplier, 0.0F, 1.0F); this.bubbleAngleO = this.bubbleAngle; this.bubbleAngle = 10.0F * (float)Math.sin((double)(0.5F * (float)this.level.getGameTime())) * this.bubbleMultiplier; } else { if (!this.isAboveBubbleColumn) { this.setBubbleTime(0); } int k = this.getBubbleTime(); if (k > 0) { --k; this.setBubbleTime(k); int j = 60 - k - 1; if (j > 0 && k == 0) { this.setBubbleTime(0); Vec3 vec3 = this.getDeltaMovement(); if (this.bubbleColumnDirectionIsDown) { this.setDeltaMovement(vec3.add(0.0D, -0.7D, 0.0D)); this.ejectPassengers(); } else { this.setDeltaMovement(vec3.x, this.hasPassenger((p_150274_) -> { return p_150274_ instanceof Player; }) ? 2.7D : 0.6D, vec3.z); } } this.isAboveBubbleColumn = false; } } } @Nullable protected SoundEvent getPaddleSound() { switch(this.getStatus()) { case IN_WATER: case UNDER_WATER: case UNDER_FLOWING_WATER: return SoundEvents.BOAT_PADDLE_WATER; case ON_LAND: return SoundEvents.BOAT_PADDLE_LAND; case IN_AIR: default: return null; } } private void tickLerp() { if (this.isControlledByLocalInstance()) { this.lerpSteps = 0; this.setPacketCoordinates(this.getX(), this.getY(), this.getZ()); } if (this.lerpSteps > 0) { double d0 = this.getX() + (this.lerpX - this.getX()) / (double)this.lerpSteps; double d1 = this.getY() + (this.lerpY - this.getY()) / (double)this.lerpSteps; double d2 = this.getZ() + (this.lerpZ - this.getZ()) / (double)this.lerpSteps; double d3 = Mth.wrapDegrees(this.lerpYRot - (double)this.getYRot()); this.setYRot(this.getYRot() + (float)d3 / (float)this.lerpSteps); this.setXRot(this.getXRot() + (float)(this.lerpXRot - (double)this.getXRot()) / (float)this.lerpSteps); --this.lerpSteps; this.setPos(d0, d1, d2); this.setRot(this.getYRot(), this.getXRot()); } } public void setPaddleState(boolean p_38340_, boolean p_38341_) { this.entityData.set(DATA_ID_PADDLE_LEFT, p_38340_); this.entityData.set(DATA_ID_PADDLE_RIGHT, p_38341_); } public float getRowingTime(int p_38316_, float p_38317_) { return this.getPaddleState(p_38316_) ? (float)Mth.clampedLerp((double)this.paddlePositions[p_38316_] - (double)((float)Math.PI / 8F), (double)this.paddlePositions[p_38316_], (double)p_38317_) : 0.0F; } private TutorialBoat.Status getStatus() { TutorialBoat.Status boat$status = this.isUnderwater(); if (boat$status != null) { this.waterLevel = this.getBoundingBox().maxY; return boat$status; } else if (this.checkInWater()) { return TutorialBoat.Status.IN_WATER; } else { float f = this.getGroundFriction(); if (f > 0.0F) { this.landFriction = f; return TutorialBoat.Status.ON_LAND; } else { return TutorialBoat.Status.IN_AIR; } } } public float getWaterLevelAbove() { AABB aabb = this.getBoundingBox(); int i = Mth.floor(aabb.minX); int j = Mth.ceil(aabb.maxX); int k = Mth.floor(aabb.maxY); int l = Mth.ceil(aabb.maxY - this.lastYd); int i1 = Mth.floor(aabb.minZ); int j1 = Mth.ceil(aabb.maxZ); BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); label39: for(int k1 = k; k1 < l; ++k1) { float f = 0.0F; for(int l1 = i; l1 < j; ++l1) { for(int i2 = i1; i2 < j1; ++i2) { blockpos$mutableblockpos.set(l1, k1, i2); FluidState fluidstate = this.level.getFluidState(blockpos$mutableblockpos); if (fluidstate.is(FluidTags.WATER)) { f = Math.max(f, fluidstate.getHeight(this.level, blockpos$mutableblockpos)); } if (f >= 1.0F) { continue label39; } } } if (f < 1.0F) { return (float)blockpos$mutableblockpos.getY() + f; } } return (float)(l + 1); } public float getGroundFriction() { AABB aabb = this.getBoundingBox(); AABB aabb1 = new AABB(aabb.minX, aabb.minY - 0.001D, aabb.minZ, aabb.maxX, aabb.minY, aabb.maxZ); int i = Mth.floor(aabb1.minX) - 1; int j = Mth.ceil(aabb1.maxX) + 1; int k = Mth.floor(aabb1.minY) - 1; int l = Mth.ceil(aabb1.maxY) + 1; int i1 = Mth.floor(aabb1.minZ) - 1; int j1 = Mth.ceil(aabb1.maxZ) + 1; VoxelShape voxelshape = Shapes.create(aabb1); float f = 0.0F; int k1 = 0; BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); for(int l1 = i; l1 < j; ++l1) { for(int i2 = i1; i2 < j1; ++i2) { int j2 = (l1 != i && l1 != j - 1 ? 0 : 1) + (i2 != i1 && i2 != j1 - 1 ? 0 : 1); if (j2 != 2) { for(int k2 = k; k2 < l; ++k2) { if (j2 <= 0 || k2 != k && k2 != l - 1) { blockpos$mutableblockpos.set(l1, k2, i2); BlockState blockstate = this.level.getBlockState(blockpos$mutableblockpos); if (!(blockstate.getBlock() instanceof WaterlilyBlock) && Shapes.joinIsNotEmpty(blockstate.getCollisionShape(this.level, blockpos$mutableblockpos).move((double)l1, (double)k2, (double)i2), voxelshape, BooleanOp.AND)) { f += blockstate.getFriction(this.level, blockpos$mutableblockpos, this); ++k1; } } } } } } return f / (float)k1; } private boolean checkInWater() { AABB aabb = this.getBoundingBox(); int i = Mth.floor(aabb.minX); int j = Mth.ceil(aabb.maxX); int k = Mth.floor(aabb.minY); int l = Mth.ceil(aabb.minY + 0.001D); int i1 = Mth.floor(aabb.minZ); int j1 = Mth.ceil(aabb.maxZ); boolean flag = false; this.waterLevel = -Double.MAX_VALUE; BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); for(int k1 = i; k1 < j; ++k1) { for(int l1 = k; l1 < l; ++l1) { for(int i2 = i1; i2 < j1; ++i2) { blockpos$mutableblockpos.set(k1, l1, i2); FluidState fluidstate = this.level.getFluidState(blockpos$mutableblockpos); if (fluidstate.is(FluidTags.WATER)) { float f = (float)l1 + fluidstate.getHeight(this.level, blockpos$mutableblockpos); this.waterLevel = Math.max((double)f, this.waterLevel); flag |= aabb.minY < (double)f; } } } } return flag; } @Nullable private TutorialBoat.Status isUnderwater() { AABB aabb = this.getBoundingBox(); double d0 = aabb.maxY + 0.001D; int i = Mth.floor(aabb.minX); int j = Mth.ceil(aabb.maxX); int k = Mth.floor(aabb.maxY); int l = Mth.ceil(d0); int i1 = Mth.floor(aabb.minZ); int j1 = Mth.ceil(aabb.maxZ); boolean flag = false; BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(); for(int k1 = i; k1 < j; ++k1) { for(int l1 = k; l1 < l; ++l1) { for(int i2 = i1; i2 < j1; ++i2) { blockpos$mutableblockpos.set(k1, l1, i2); FluidState fluidstate = this.level.getFluidState(blockpos$mutableblockpos); if (fluidstate.is(FluidTags.WATER) && d0 < (double)((float)blockpos$mutableblockpos.getY() + fluidstate.getHeight(this.level, blockpos$mutableblockpos))) { if (!fluidstate.isSource()) { return TutorialBoat.Status.UNDER_FLOWING_WATER; } flag = true; } } } } return flag ? TutorialBoat.Status.UNDER_WATER : null; } private void floatBoat() { double d0 = (double)-0.04F; double d1 = this.isNoGravity() ? 0.0D : (double)-0.04F; double d2 = 0.0D; this.invFriction = 0.05F; if (this.oldStatus == TutorialBoat.Status.IN_AIR && this.status != TutorialBoat.Status.IN_AIR && this.status != TutorialBoat.Status.ON_LAND) { this.waterLevel = this.getY(1.0D); this.setPos(this.getX(), (double)(this.getWaterLevelAbove() - this.getBbHeight()) + 0.101D, this.getZ()); this.setDeltaMovement(this.getDeltaMovement().multiply(1.0D, 0.0D, 1.0D)); this.lastYd = 0.0D; this.status = TutorialBoat.Status.IN_WATER; } else { if (this.status == TutorialBoat.Status.IN_WATER) { d2 = (this.waterLevel - this.getY()) / (double)this.getBbHeight(); this.invFriction = 0.9F; } else if (this.status == TutorialBoat.Status.UNDER_FLOWING_WATER) { d1 = -7.0E-4D; this.invFriction = 0.9F; } else if (this.status == TutorialBoat.Status.UNDER_WATER) { d2 = (double)0.01F; this.invFriction = 0.45F; } else if (this.status == TutorialBoat.Status.IN_AIR) { this.invFriction = 0.9F; } else if (this.status == TutorialBoat.Status.ON_LAND) { this.invFriction = this.landFriction; if (this.getControllingPassenger() instanceof Player) { this.landFriction /= 2.0F; } } Vec3 vec3 = this.getDeltaMovement(); this.setDeltaMovement(vec3.x * (double)this.invFriction, vec3.y + d1, vec3.z * (double)this.invFriction); this.deltaRotation *= this.invFriction; if (d2 > 0.0D) { Vec3 vec31 = this.getDeltaMovement(); this.setDeltaMovement(vec31.x, (vec31.y + d2 * 0.06153846016296973D) * 0.75D, vec31.z); } } } private void controlBoat() { if (this.isVehicle()) { float f = 0.0F; if (this.inputLeft) { --this.deltaRotation; } if (this.inputRight) { ++this.deltaRotation; } if (this.inputRight != this.inputLeft && !this.inputUp && !this.inputDown) { f += 0.005F; } this.setYRot(this.getYRot() + this.deltaRotation); if (this.inputUp) { f += 0.04F; } if (this.inputDown) { f -= 0.005F; } this.setDeltaMovement(this.getDeltaMovement().add((double)(Mth.sin(-this.getYRot() * ((float)Math.PI / 180F)) * f), 0.0D, (double)(Mth.cos(this.getYRot() * ((float)Math.PI / 180F)) * f))); this.setPaddleState(this.inputRight && !this.inputLeft || this.inputUp, this.inputLeft && !this.inputRight || this.inputUp); } } public void positionRider(Entity p_38379_) { if (this.hasPassenger(p_38379_)) { float f = 0.0F; float f1 = (float)((this.isRemoved() ? (double)0.01F : this.getPassengersRidingOffset()) + p_38379_.getMyRidingOffset()); if (this.getPassengers().size() > 1) { int i = this.getPassengers().indexOf(p_38379_); if (i == 0) { f = 0.2F; } else { f = -0.6F; } if (p_38379_ instanceof Animal) { f = (float)((double)f + 0.2D); } } Vec3 vec3 = (new Vec3((double)f, 0.0D, 0.0D)).yRot(-this.getYRot() * ((float)Math.PI / 180F) - ((float)Math.PI / 2F)); p_38379_.setPos(this.getX() + vec3.x, this.getY() + (double)f1, this.getZ() + vec3.z); p_38379_.setYRot(p_38379_.getYRot() + this.deltaRotation); p_38379_.setYHeadRot(p_38379_.getYHeadRot() + this.deltaRotation); this.clampRotation(p_38379_); if (p_38379_ instanceof Animal && this.getPassengers().size() > 1) { int j = p_38379_.getId() % 2 == 0 ? 90 : 270; p_38379_.setYBodyRot(((Animal)p_38379_).yBodyRot + (float)j); p_38379_.setYHeadRot(p_38379_.getYHeadRot() + (float)j); } } } public Vec3 getDismountLocationForPassenger(LivingEntity p_38357_) { Vec3 vec3 = getCollisionHorizontalEscapeVector((double)(this.getBbWidth() * Mth.SQRT_OF_TWO), (double)p_38357_.getBbWidth(), p_38357_.getYRot()); double d0 = this.getX() + vec3.x; double d1 = this.getZ() + vec3.z; BlockPos blockpos = new BlockPos(d0, this.getBoundingBox().maxY, d1); BlockPos blockpos1 = blockpos.below(); if (!this.level.isWaterAt(blockpos1)) { List<Vec3> list = Lists.newArrayList(); double d2 = this.level.getBlockFloorHeight(blockpos); if (DismountHelper.isBlockFloorValid(d2)) { list.add(new Vec3(d0, (double)blockpos.getY() + d2, d1)); } double d3 = this.level.getBlockFloorHeight(blockpos1); if (DismountHelper.isBlockFloorValid(d3)) { list.add(new Vec3(d0, (double)blockpos1.getY() + d3, d1)); } for(Pose pose : p_38357_.getDismountPoses()) { for(Vec3 vec31 : list) { if (DismountHelper.canDismountTo(this.level, vec31, p_38357_, pose)) { p_38357_.setPose(pose); return vec31; } } } } return super.getDismountLocationForPassenger(p_38357_); } protected void clampRotation(Entity p_38322_) { p_38322_.setYBodyRot(this.getYRot()); float f = Mth.wrapDegrees(p_38322_.getYRot() - this.getYRot()); float f1 = Mth.clamp(f, -105.0F, 105.0F); p_38322_.yRotO += f1 - f; p_38322_.setYRot(p_38322_.getYRot() + f1 - f); p_38322_.setYHeadRot(p_38322_.getYRot()); } public void onPassengerTurned(Entity p_38383_) { this.clampRotation(p_38383_); } protected void addAdditionalSaveData(CompoundTag p_38359_) { p_38359_.putString("Type", this.getBoatType().getName()); } protected void readAdditionalSaveData(CompoundTag p_38338_) { if (p_38338_.contains("Type", 8)) { this.setType(TutorialBoat.Type.byName(p_38338_.getString("Type"))); } } public InteractionResult interact(Player p_38330_, InteractionHand p_38331_) { if (p_38330_.isSecondaryUseActive()) { return InteractionResult.PASS; } else if (this.outOfControlTicks < 60.0F) { if (!this.level.isClientSide) { return p_38330_.startRiding(this) ? InteractionResult.CONSUME : InteractionResult.PASS; } else { return InteractionResult.SUCCESS; } } else { return InteractionResult.PASS; } } protected void checkFallDamage(double p_38307_, boolean p_38308_, BlockState p_38309_, BlockPos p_38310_) { this.lastYd = this.getDeltaMovement().y; if (!this.isPassenger()) { if (p_38308_) { if (this.fallDistance > 3.0F) { if (this.status != TutorialBoat.Status.ON_LAND) { this.resetFallDistance(); return; } this.causeFallDamage(this.fallDistance, 1.0F, DamageSource.FALL); if (!this.level.isClientSide && !this.isRemoved()) { this.kill(); if (this.level.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) { for(int i = 0; i < 3; ++i) { this.spawnAtLocation(this.getBoatType().getPlanks()); } for(int j = 0; j < 2; ++j) { this.spawnAtLocation(Items.STICK); } } } } this.resetFallDistance(); } else if (!this.level.getFluidState(this.blockPosition().below()).is(FluidTags.WATER) && p_38307_ < 0.0D) { this.fallDistance = (float)((double)this.fallDistance - p_38307_); } } } public boolean getPaddleState(int p_38314_) { return this.entityData.<Boolean>get(p_38314_ == 0 ? DATA_ID_PADDLE_LEFT : DATA_ID_PADDLE_RIGHT) && this.getControllingPassenger() != null; } public void setDamage(float p_38312_) { this.entityData.set(DATA_ID_DAMAGE, p_38312_); } public float getDamage() { return this.entityData.get(DATA_ID_DAMAGE); } public void setHurtTime(int p_38355_) { this.entityData.set(DATA_ID_HURT, p_38355_); } public int getHurtTime() { return this.entityData.get(DATA_ID_HURT); } private void setBubbleTime(int p_38367_) { this.entityData.set(DATA_ID_BUBBLE_TIME, p_38367_); } private int getBubbleTime() { return this.entityData.get(DATA_ID_BUBBLE_TIME); } public float getBubbleAngle(float p_38353_) { return Mth.lerp(p_38353_, this.bubbleAngleO, this.bubbleAngle); } public void setHurtDir(int p_38363_) { this.entityData.set(DATA_ID_HURTDIR, p_38363_); } public int getHurtDir() { return this.entityData.get(DATA_ID_HURTDIR); } public void setType(TutorialBoat.Type p_38333_) { this.entityData.set(DATA_ID_TYPE, p_38333_.ordinal()); } public TutorialBoat.Type getBoatType() { return TutorialBoat.Type.byId(this.entityData.get(DATA_ID_TYPE)); } protected boolean canAddPassenger(Entity p_38390_) { return this.getPassengers().size() < 2 && !this.isEyeInFluid(FluidTags.WATER); } @Nullable public Entity getControllingPassenger() { return this.getFirstPassenger(); } public void setInput(boolean p_38343_, boolean p_38344_, boolean p_38345_, boolean p_38346_) { this.inputLeft = p_38343_; this.inputRight = p_38344_; this.inputUp = p_38345_; this.inputDown = p_38346_; } public Packet<?> getAddEntityPacket() { return new ClientboundAddEntityPacket(this); } public boolean isUnderWater() { return this.status == TutorialBoat.Status.UNDER_WATER || this.status == TutorialBoat.Status.UNDER_FLOWING_WATER; } // Forge: Fix MC-119811 by instantly completing lerp on board @Override protected void addPassenger(Entity passenger) { super.addPassenger(passenger); if (this.isControlledByLocalInstance() && this.lerpSteps > 0) { this.lerpSteps = 0; this.absMoveTo(this.lerpX, this.lerpY, this.lerpZ, (float)this.lerpYRot, (float)this.lerpXRot); } } public ItemStack getPickResult() { return new ItemStack(this.getDropItem()); } public static enum Status { IN_WATER, UNDER_WATER, UNDER_FLOWING_WATER, ON_LAND, IN_AIR; } public static enum Type { OAK(Blocks.OAK_PLANKS, "oak"), SPRUCE(Blocks.SPRUCE_PLANKS, "spruce"), BIRCH(Blocks.BIRCH_PLANKS, "birch"), JUNGLE(Blocks.JUNGLE_PLANKS, "jungle"), ACACIA(Blocks.ACACIA_PLANKS, "acacia"), DARK_OAK(Blocks.DARK_OAK_PLANKS, "dark_oak"); private final String name; private final Block planks; private Type(Block p_38427_, String p_38428_) { this.name = p_38428_; this.planks = p_38427_; } public String getName() { return this.name; } public Block getPlanks() { return this.planks; } public String toString() { return this.name; } public static TutorialBoat.Type byId(int p_38431_) { TutorialBoat.Type[] aboat$type = values(); if (p_38431_ < 0 || p_38431_ >= aboat$type.length) { p_38431_ = 0; } return aboat$type[p_38431_]; } public static TutorialBoat.Type byName(String p_38433_) { TutorialBoat.Type[] aboat$type = values(); for(int i = 0; i < aboat$type.length; ++i) { if (aboat$type[i].getName().equals(p_38433_)) { return aboat$type[i]; } } return aboat$type[0]; } } } public class ModEntityType{ //動物 public static final EntityType<TutorialPig> TUTORIAL_PIG= EntityType.Builder.of(TutorialPig::new, MobCategory.CREATURE) .sized(0.9F, 0.9F).build(prefix("tutorial_pig")); public static final EntityType<TutorialHorse> TUTORIAL_HORSE= EntityType.Builder.of(TutorialHorse::new, MobCategory.CREATURE) .sized(0.9F, 0.9F).build(prefix("tutorial_horse")); //乗り物 public static final EntityType<TutorialBoat> TUTORIAL_BOAT= EntityType.Builder.of(TutorialBoat::new,MobCategory.MISC) .sized(1.375F, 0.5625F).clientTrackingRange(10).build(prefix("tutorial_boat")); private static String prefix(String path) { return TutorialMod.MOD_ID + "." + path; } @SubscribeEvent public static void registerEntity(RegistryEvent.Register<EntityType<?>> event) { event.getRegistry().register(TUTORIAL_PIG.setRegistryName("tutorial_pig")); event.getRegistry().register(TUTORIAL_HORSE.setRegistryName("tutorial_horse")); event.getRegistry().register(TUTORIAL_BOAT.setRegistryName("tutorial_boat")); SpawnPlacements.register(TUTORIAL_PIG, SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Animal::checkAnimalSpawnRules); SpawnPlacements.register(TUTORIAL_HORSE, SpawnPlacements.Type.ON_GROUND, Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, Animal::checkAnimalSpawnRules); } @SubscribeEvent public static void registerEntityAttribute(EntityAttributeCreationEvent event) { event.put(TUTORIAL_PIG, TutorialPig.createAttributes().build()); event.put(TUTORIAL_HORSE, AbstractHorse.createBaseHorseAttributes().build()); } } I copied the vanilla boat Entity and created it, but although I can generate it in the world, I cannot manipulate it.
  17. I Solved. ModEntityRenderer public static void registerLayerDefinition(EntityRenderersEvent.RegisterLayerDefinitions event) { LayerDefinition ModlayerTutorialHorse = LayerDefinition.create(TutorialHorseModel.createBodyMesh(CubeDeformation.NONE), 64, 64); ImmutableMap.Builder<ModelLayerLocation, LayerDefinition> builder = ImmutableMap.builder(); /* event.registerLayerDefinition(TUTORIAL_PIG_LAYER, TutorialPigModel::createBodyLayer); // event.registerLayerDefinition(TUTORIAL_HORSE_LAYER, TutorialHorseModel::createMesh); builder.put(HORSEE, ModlayerTutorialHorse); */ event.registerLayerDefinition(TUTORIAL_PIG_LAYER, TutorialPigModel::createBodyLayer); // event.registerLayerDefinition(TUTORIAL_HORSE_LAYER, TutorialHorseModel::createMesh); event.registerLayerDefinition(TUTORIAL_HORSE_LAYER, TutorialHorseModel::createBodyLayer); } TutorialHorseModel public static LayerDefinition createBodyLayer() { MeshDefinition meshdefinition = createBodyMesh( CubeDeformation.NONE); PartDefinition partdefinition = meshdefinition.getRoot(); partdefinition.addOrReplaceChild("head", CubeListBuilder.create().texOffs(0, 13).addBox(-3.0F, -11.0F, -2.0F, 6.0F, 5.0F, 7.0F, CubeDeformation.NONE), PartPose.ZERO); return LayerDefinition.create(meshdefinition, 64, 64); } public static MeshDefinition createBodyMesh(CubeDeformation p_170670_) { MeshDefinition meshdefinition = new MeshDefinition(); PartDefinition partdefinition = meshdefinition.getRoot(); Create "createBodyLayer" for HorseModel and change ModEntityRenderer Code.
  18. java.lang.IllegalArgumentException: Failed to create model for tutorialmod:tutorial_horse at net.minecraft.client.renderer.entity.EntityRenderers.lambda$createEntityRenderers$2(EntityRenderers.java:41) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at java.util.HashMap.forEach(HashMap.java:1421) ~[?:?] {} at net.minecraft.client.renderer.entity.EntityRenderers.createEntityRenderers(EntityRenderers.java:37) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.entity.EntityRenderDispatcher.onResourceManagerReload(EntityRenderDispatcher.java:333) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.server.packs.resources.ResourceManagerReloadListener.lambda$reload$0(ResourceManagerReloadListener.java:13) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:787) ~[?:?] {} at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?] {} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$3(SimpleReloadInstance.java:67) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:90) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$4(SimpleReloadInstance.java:66) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at java.util.concurrent.CompletableFuture$UniCompletion.claim(CompletableFuture.java:572) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:784) ~[?:?] {} at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?] {} at java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:614) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:795) ~[?:?] {} at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?] {} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$3(SimpleReloadInstance.java:67) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:90) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$4(SimpleReloadInstance.java:66) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at java.util.concurrent.CompletableFuture$UniCompletion.claim(CompletableFuture.java:572) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:784) ~[?:?] {} at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?] {} at java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:614) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:795) ~[?:?] {} at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?] {} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$3(SimpleReloadInstance.java:67) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:90) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$4(SimpleReloadInstance.java:66) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at java.util.concurrent.CompletableFuture$UniCompletion.claim(CompletableFuture.java:572) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:784) ~[?:?] {} at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?] {} at java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:614) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:795) ~[?:?] {} at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?] {} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$3(SimpleReloadInstance.java:67) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:90) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$4(SimpleReloadInstance.java:66) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at java.util.concurrent.CompletableFuture$UniCompletion.claim(CompletableFuture.java:572) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:784) ~[?:?] {} at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?] {} at java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:614) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:726) ~[?:?] {} at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?] {} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$3(SimpleReloadInstance.java:67) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:90) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$4(SimpleReloadInstance.java:66) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at java.util.concurrent.CompletableFuture$UniCompletion.claim(CompletableFuture.java:572) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:714) ~[?:?] {} at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?] {} at java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:614) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:726) ~[?:?] {} at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?] {} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$3(SimpleReloadInstance.java:67) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:90) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$4(SimpleReloadInstance.java:66) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at java.util.concurrent.CompletableFuture$UniCompletion.claim(CompletableFuture.java:572) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:714) ~[?:?] {} at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?] {} at java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:614) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:726) ~[?:?] {} at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?] {} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$3(SimpleReloadInstance.java:67) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:90) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$4(SimpleReloadInstance.java:66) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at java.util.concurrent.CompletableFuture$UniCompletion.claim(CompletableFuture.java:572) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:714) ~[?:?] {} at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?] {} at java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:614) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:726) ~[?:?] {} at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?] {} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$3(SimpleReloadInstance.java:67) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:90) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$4(SimpleReloadInstance.java:66) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at java.util.concurrent.CompletableFuture$UniCompletion.claim(CompletableFuture.java:572) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:714) ~[?:?] {} at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?] {} at java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:614) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:726) ~[?:?] {} at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?] {} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$3(SimpleReloadInstance.java:67) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:90) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$4(SimpleReloadInstance.java:66) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at java.util.concurrent.CompletableFuture$UniCompletion.claim(CompletableFuture.java:572) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:714) ~[?:?] {} at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?] {} at java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:614) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:726) ~[?:?] {} at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?] {} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$3(SimpleReloadInstance.java:67) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:90) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$4(SimpleReloadInstance.java:66) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at java.util.concurrent.CompletableFuture$UniCompletion.claim(CompletableFuture.java:572) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:714) ~[?:?] {} at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?] {} at java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:614) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:726) ~[?:?] {} at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?] {} at com.mojang.blaze3d.systems.RenderSystem.replayQueue(RenderSystem.java:172) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:runtimedistcleaner:A} at com.mojang.blaze3d.systems.RenderSystem.flipFrame(RenderSystem.java:161) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:runtimedistcleaner:A} at com.mojang.blaze3d.platform.Window.updateDisplay(Window.java:333) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.runTick(Minecraft.java:1062) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.run(Minecraft.java:660) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(Main.java:205) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:runtimedistcleaner:A} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {} at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {} at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {} at net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:38) ~[fmlloader-1.18-38.0.5.jar%230!:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.0.7.jar%2310!:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.0.7.jar%2310!:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.0.7.jar%2310!:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.0.7.jar%2310!:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.0.7.jar%2310!:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.0.7.jar%2310!:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.0.7.jar%2310!:?] {} at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:90) [bootstraplauncher-0.1.17.jar:?] {} Caused by: java.lang.IllegalArgumentException: No model for layer tutorialmod:tutorial_horse#tutorial_horse at net.minecraft.client.model.geom.EntityModelSet.bakeLayer(EntityModelSet.java:18) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.entity.EntityRendererProvider$Context.bakeLayer(EntityRendererProvider.java:50) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:runtimedistcleaner:A} at com.tutorial.tutorialmod.mobdata.TutorialHorse.TutorialHorseRenderer.<init>(TutorialHorseRenderer.java:42) ~[%2380!:?] {re:classloading} at net.minecraft.client.renderer.entity.EntityRenderers.lambda$createEntityRenderers$2(EntityRenderers.java:39) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} ... 115 more A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Render thread Stacktrace: at net.minecraft.client.renderer.entity.EntityRenderers.lambda$createEntityRenderers$2(EntityRenderers.java:41) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at java.util.HashMap.forEach(HashMap.java:1421) ~[?:?] {} at net.minecraft.client.renderer.entity.EntityRenderers.createEntityRenderers(EntityRenderers.java:37) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.entity.EntityRenderDispatcher.onResourceManagerReload(EntityRenderDispatcher.java:333) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.server.packs.resources.ResourceManagerReloadListener.lambda$reload$0(ResourceManagerReloadListener.java:13) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:787) ~[?:?] {} at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?] {} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$3(SimpleReloadInstance.java:67) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:90) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$4(SimpleReloadInstance.java:66) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at java.util.concurrent.CompletableFuture$UniCompletion.claim(CompletableFuture.java:572) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:784) ~[?:?] {} at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?] {} at java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:614) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:795) ~[?:?] {} at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?] {} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$3(SimpleReloadInstance.java:67) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:90) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$4(SimpleReloadInstance.java:66) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at java.util.concurrent.CompletableFuture$UniCompletion.claim(CompletableFuture.java:572) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:784) ~[?:?] {} at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?] {} at java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:614) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:795) ~[?:?] {} at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?] {} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$3(SimpleReloadInstance.java:67) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:90) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$4(SimpleReloadInstance.java:66) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at java.util.concurrent.CompletableFuture$UniCompletion.claim(CompletableFuture.java:572) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:784) ~[?:?] {} at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?] {} at java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:614) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:795) ~[?:?] {} at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?] {} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$3(SimpleReloadInstance.java:67) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:90) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$4(SimpleReloadInstance.java:66) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at java.util.concurrent.CompletableFuture$UniCompletion.claim(CompletableFuture.java:572) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniRun.tryFire(CompletableFuture.java:784) ~[?:?] {} at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?] {} at java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:614) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:726) ~[?:?] {} at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?] {} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$3(SimpleReloadInstance.java:67) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:90) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$4(SimpleReloadInstance.java:66) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at java.util.concurrent.CompletableFuture$UniCompletion.claim(CompletableFuture.java:572) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:714) ~[?:?] {} at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?] {} at java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:614) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:726) ~[?:?] {} at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?] {} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$3(SimpleReloadInstance.java:67) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:90) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$4(SimpleReloadInstance.java:66) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at java.util.concurrent.CompletableFuture$UniCompletion.claim(CompletableFuture.java:572) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:714) ~[?:?] {} at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?] {} at java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:614) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:726) ~[?:?] {} at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?] {} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$3(SimpleReloadInstance.java:67) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:90) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$4(SimpleReloadInstance.java:66) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at java.util.concurrent.CompletableFuture$UniCompletion.claim(CompletableFuture.java:572) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:714) ~[?:?] {} at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?] {} at java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:614) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:726) ~[?:?] {} at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?] {} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$3(SimpleReloadInstance.java:67) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:90) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$4(SimpleReloadInstance.java:66) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at java.util.concurrent.CompletableFuture$UniCompletion.claim(CompletableFuture.java:572) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:714) ~[?:?] {} at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?] {} at java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:614) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:726) ~[?:?] {} at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?] {} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$3(SimpleReloadInstance.java:67) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:90) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$4(SimpleReloadInstance.java:66) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at java.util.concurrent.CompletableFuture$UniCompletion.claim(CompletableFuture.java:572) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:714) ~[?:?] {} at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?] {} at java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:614) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:726) ~[?:?] {} at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?] {} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$3(SimpleReloadInstance.java:67) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:90) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:accesstransformer:B} at net.minecraft.server.packs.resources.SimpleReloadInstance.lambda$new$4(SimpleReloadInstance.java:66) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading} at java.util.concurrent.CompletableFuture$UniCompletion.claim(CompletableFuture.java:572) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:714) ~[?:?] {} at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) ~[?:?] {} at java.util.concurrent.CompletableFuture.postFire(CompletableFuture.java:614) ~[?:?] {} at java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:726) ~[?:?] {} at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482) ~[?:?] {} at com.mojang.blaze3d.systems.RenderSystem.replayQueue(RenderSystem.java:172) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:runtimedistcleaner:A} at com.mojang.blaze3d.systems.RenderSystem.flipFrame(RenderSystem.java:161) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:runtimedistcleaner:A} -- Overlay render details -- Details: Overlay name: net.minecraft.client.gui.screens.LoadingOverlay Stacktrace: at net.minecraft.client.renderer.GameRenderer.render(GameRenderer.java:877) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.runTick(Minecraft.java:1040) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.run(Minecraft.java:660) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(Main.java:205) ~[forge-1.18-38.0.5_mapped_official_1.18-recomp.jar%2376!:?] {re:classloading,pl:runtimedistcleaner:A} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] {} at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] {} at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] {} at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] {} at net.minecraftforge.fml.loading.targets.ForgeClientUserdevLaunchHandler.lambda$launchService$0(ForgeClientUserdevLaunchHandler.java:38) ~[fmlloader-1.18-38.0.5.jar%230!:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-9.0.7.jar%2310!:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:53) [modlauncher-9.0.7.jar%2310!:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:71) [modlauncher-9.0.7.jar%2310!:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:106) [modlauncher-9.0.7.jar%2310!:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:77) [modlauncher-9.0.7.jar%2310!:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) [modlauncher-9.0.7.jar%2310!:?] {} at cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) [modlauncher-9.0.7.jar%2310!:?] {} at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:90) [bootstraplauncher-0.1.17.jar:?] {} Caused by: java.lang.IllegalArgumentException: Failed to create model for tutorialmod:tutorial_horse Caused by: java.lang.IllegalArgumentException: No model for layer tutorialmod:tutorial_horse#tutorial_horse There is no model layer, so the model is supposed to be non-existent?
  19. I am trying to create a custom horse, but I am getting an error in bakeLayer. ModEntityRenderer @Mod.EventBusSubscriber( modid = TutorialMod.MOD_ID, value = {Dist.CLIENT}, bus = Mod.EventBusSubscriber.Bus.MOD ) @OnlyIn(Dist.CLIENT) public class ModEntityRenderers{ private static final Set<ModelLayerLocation> ALL_MODELS = Sets.newHashSet(); public static ModelLayerLocation TUTORIAL_PIG_LAYER = new ModelLayerLocation(new ResourceLocation(TutorialMod.MOD_ID, "tutorial_pig"), "tutorial_pig"); public static ModelLayerLocation TUTORIAL_HORSE_LAYER = new ModelLayerLocation(new ResourceLocation(TutorialMod.MOD_ID, "tutorial_horse"), "tutorial_horse"); public static final ModelLayerLocation HORSEE = register("tutorial_horse"); private static ModelLayerLocation register(String p_171294_) { return register(p_171294_, "main"); } private static ModelLayerLocation register(String p_171296_, String p_171297_) { ModelLayerLocation modellayerlocation = createLocation(p_171296_, p_171297_); if (!ALL_MODELS.add(modellayerlocation)) { throw new IllegalStateException("Duplicate registration for " + modellayerlocation); } else { return modellayerlocation; } } private static ModelLayerLocation createLocation(String p_171301_, String p_171302_) { return new ModelLayerLocation(new ResourceLocation("minecraft", p_171301_), p_171302_); } public static void init() { } //registry list @SubscribeEvent public static void registerEntityRenders(EntityRenderersEvent.RegisterRenderers event) { event.registerEntityRenderer(ModEntityType.TUTORIAL_PIG, TutorialPigRenderer::new); event.registerEntityRenderer(ModEntityType.TUTORIAL_HORSE, TutorialHorseRenderer::new); } //renderer list @SubscribeEvent public static void registerLayerDefinition(EntityRenderersEvent.RegisterLayerDefinitions event) { LayerDefinition ModlayerTutorialHorse = LayerDefinition.create(TutorialHorseModel.createBodyMesh(CubeDeformation.NONE), 64, 64); ImmutableMap.Builder<ModelLayerLocation, LayerDefinition> builder = ImmutableMap.builder(); event.registerLayerDefinition(TUTORIAL_PIG_LAYER, TutorialPigModel::createBodyLayer); // event.registerLayerDefinition(TUTORIAL_HORSE_LAYER, TutorialHorseModel::createMesh); builder.put(HORSEE, ModlayerTutorialHorse); } } Model @OnlyIn(Dist.CLIENT) public class TutorialHorseModel<T extends AbstractHorse> extends AgeableListModel<T> { private static final float DEG_125 = 2.1816616F; private static final float DEG_60 = ((float)Math.PI / 3F); private static final float DEG_45 = ((float)Math.PI / 4F); private static final float DEG_30 = ((float)Math.PI / 6F); private static final float DEG_15 = 0.2617994F; protected static final String HEAD_PARTS = "head_parts"; private static final String LEFT_HIND_BABY_LEG = "left_hind_baby_leg"; private static final String RIGHT_HIND_BABY_LEG = "right_hind_baby_leg"; private static final String LEFT_FRONT_BABY_LEG = "left_front_baby_leg"; private static final String RIGHT_FRONT_BABY_LEG = "right_front_baby_leg"; private static final String SADDLE = "saddle"; private static final String LEFT_SADDLE_MOUTH = "left_saddle_mouth"; private static final String LEFT_SADDLE_LINE = "left_saddle_line"; private static final String RIGHT_SADDLE_MOUTH = "right_saddle_mouth"; private static final String RIGHT_SADDLE_LINE = "right_saddle_line"; private static final String HEAD_SADDLE = "head_saddle"; private static final String MOUTH_SADDLE_WRAP = "mouth_saddle_wrap"; protected final ModelPart body; protected final ModelPart headParts; private final ModelPart rightHindLeg; private final ModelPart leftHindLeg; private final ModelPart rightFrontLeg; private final ModelPart leftFrontLeg; private final ModelPart rightHindBabyLeg; private final ModelPart leftHindBabyLeg; private final ModelPart rightFrontBabyLeg; private final ModelPart leftFrontBabyLeg; private final ModelPart tail; private final ModelPart[] saddleParts; private final ModelPart[] ridingParts; public TutorialHorseModel(ModelPart p_170668_) { super(true, 16.2F, 1.36F, 2.7272F, 2.0F, 20.0F); this.body = p_170668_.getChild("body"); this.headParts = p_170668_.getChild("head_parts"); this.rightHindLeg = p_170668_.getChild("right_hind_leg"); this.leftHindLeg = p_170668_.getChild("left_hind_leg"); this.rightFrontLeg = p_170668_.getChild("right_front_leg"); this.leftFrontLeg = p_170668_.getChild("left_front_leg"); this.rightHindBabyLeg = p_170668_.getChild("right_hind_baby_leg"); this.leftHindBabyLeg = p_170668_.getChild("left_hind_baby_leg"); this.rightFrontBabyLeg = p_170668_.getChild("right_front_baby_leg"); this.leftFrontBabyLeg = p_170668_.getChild("left_front_baby_leg"); this.tail = this.body.getChild("tail"); ModelPart modelpart = this.body.getChild("saddle"); ModelPart modelpart1 = this.headParts.getChild("left_saddle_mouth"); ModelPart modelpart2 = this.headParts.getChild("right_saddle_mouth"); ModelPart modelpart3 = this.headParts.getChild("left_saddle_line"); ModelPart modelpart4 = this.headParts.getChild("right_saddle_line"); ModelPart modelpart5 = this.headParts.getChild("head_saddle"); ModelPart modelpart6 = this.headParts.getChild("mouth_saddle_wrap"); this.saddleParts = new ModelPart[]{modelpart, modelpart1, modelpart2, modelpart5, modelpart6}; this.ridingParts = new ModelPart[]{modelpart3, modelpart4}; } public static MeshDefinition createBodyMesh(CubeDeformation p_170670_) { MeshDefinition meshdefinition = new MeshDefinition(); PartDefinition partdefinition = meshdefinition.getRoot(); PartDefinition partdefinition1 = partdefinition.addOrReplaceChild("body", CubeListBuilder.create().texOffs(0, 32).addBox(-5.0F, -8.0F, -17.0F, 10.0F, 10.0F, 22.0F, new CubeDeformation(0.05F)), PartPose.offset(0.0F, 11.0F, 5.0F)); PartDefinition partdefinition2 = partdefinition.addOrReplaceChild("head_parts", CubeListBuilder.create().texOffs(0, 35).addBox(-2.05F, -6.0F, -2.0F, 4.0F, 12.0F, 7.0F), PartPose.offsetAndRotation(0.0F, 4.0F, -12.0F, ((float)Math.PI / 6F), 0.0F, 0.0F)); PartDefinition partdefinition3 = partdefinition2.addOrReplaceChild("head", CubeListBuilder.create().texOffs(0, 13).addBox(-3.0F, -11.0F, -2.0F, 6.0F, 5.0F, 7.0F, p_170670_), PartPose.ZERO); partdefinition2.addOrReplaceChild("mane", CubeListBuilder.create().texOffs(56, 36).addBox(-1.0F, -11.0F, 5.01F, 2.0F, 16.0F, 2.0F, p_170670_), PartPose.ZERO); partdefinition2.addOrReplaceChild("upper_mouth", CubeListBuilder.create().texOffs(0, 25).addBox(-2.0F, -11.0F, -7.0F, 4.0F, 5.0F, 5.0F, p_170670_), PartPose.ZERO); partdefinition.addOrReplaceChild("left_hind_leg", CubeListBuilder.create().texOffs(48, 21).mirror().addBox(-3.0F, -1.01F, -1.0F, 4.0F, 11.0F, 4.0F, p_170670_), PartPose.offset(4.0F, 14.0F, 7.0F)); partdefinition.addOrReplaceChild("right_hind_leg", CubeListBuilder.create().texOffs(48, 21).addBox(-1.0F, -1.01F, -1.0F, 4.0F, 11.0F, 4.0F, p_170670_), PartPose.offset(-4.0F, 14.0F, 7.0F)); partdefinition.addOrReplaceChild("left_front_leg", CubeListBuilder.create().texOffs(48, 21).mirror().addBox(-3.0F, -1.01F, -1.9F, 4.0F, 11.0F, 4.0F, p_170670_), PartPose.offset(4.0F, 14.0F, -12.0F)); partdefinition.addOrReplaceChild("right_front_leg", CubeListBuilder.create().texOffs(48, 21).addBox(-1.0F, -1.01F, -1.9F, 4.0F, 11.0F, 4.0F, p_170670_), PartPose.offset(-4.0F, 14.0F, -12.0F)); CubeDeformation cubedeformation = p_170670_.extend(0.0F, 5.5F, 0.0F); partdefinition.addOrReplaceChild("left_hind_baby_leg", CubeListBuilder.create().texOffs(48, 21).mirror().addBox(-3.0F, -1.01F, -1.0F, 4.0F, 11.0F, 4.0F, cubedeformation), PartPose.offset(4.0F, 14.0F, 7.0F)); partdefinition.addOrReplaceChild("right_hind_baby_leg", CubeListBuilder.create().texOffs(48, 21).addBox(-1.0F, -1.01F, -1.0F, 4.0F, 11.0F, 4.0F, cubedeformation), PartPose.offset(-4.0F, 14.0F, 7.0F)); partdefinition.addOrReplaceChild("left_front_baby_leg", CubeListBuilder.create().texOffs(48, 21).mirror().addBox(-3.0F, -1.01F, -1.9F, 4.0F, 11.0F, 4.0F, cubedeformation), PartPose.offset(4.0F, 14.0F, -12.0F)); partdefinition.addOrReplaceChild("right_front_baby_leg", CubeListBuilder.create().texOffs(48, 21).addBox(-1.0F, -1.01F, -1.9F, 4.0F, 11.0F, 4.0F, cubedeformation), PartPose.offset(-4.0F, 14.0F, -12.0F)); partdefinition1.addOrReplaceChild("tail", CubeListBuilder.create().texOffs(42, 36).addBox(-1.5F, 0.0F, 0.0F, 3.0F, 14.0F, 4.0F, p_170670_), PartPose.offsetAndRotation(0.0F, -5.0F, 2.0F, ((float)Math.PI / 6F), 0.0F, 0.0F)); partdefinition1.addOrReplaceChild("saddle", CubeListBuilder.create().texOffs(26, 0).addBox(-5.0F, -8.0F, -9.0F, 10.0F, 9.0F, 9.0F, new CubeDeformation(0.5F)), PartPose.ZERO); partdefinition2.addOrReplaceChild("left_saddle_mouth", CubeListBuilder.create().texOffs(29, 5).addBox(2.0F, -9.0F, -6.0F, 1.0F, 2.0F, 2.0F, p_170670_), PartPose.ZERO); partdefinition2.addOrReplaceChild("right_saddle_mouth", CubeListBuilder.create().texOffs(29, 5).addBox(-3.0F, -9.0F, -6.0F, 1.0F, 2.0F, 2.0F, p_170670_), PartPose.ZERO); partdefinition2.addOrReplaceChild("left_saddle_line", CubeListBuilder.create().texOffs(32, 2).addBox(3.1F, -6.0F, -8.0F, 0.0F, 3.0F, 16.0F, p_170670_), PartPose.rotation((-(float)Math.PI / 6F), 0.0F, 0.0F)); partdefinition2.addOrReplaceChild("right_saddle_line", CubeListBuilder.create().texOffs(32, 2).addBox(-3.1F, -6.0F, -8.0F, 0.0F, 3.0F, 16.0F, p_170670_), PartPose.rotation((-(float)Math.PI / 6F), 0.0F, 0.0F)); partdefinition2.addOrReplaceChild("head_saddle", CubeListBuilder.create().texOffs(1, 1).addBox(-3.0F, -11.0F, -1.9F, 6.0F, 5.0F, 6.0F, new CubeDeformation(0.2F)), PartPose.ZERO); partdefinition2.addOrReplaceChild("mouth_saddle_wrap", CubeListBuilder.create().texOffs(19, 0).addBox(-2.0F, -11.0F, -4.0F, 4.0F, 5.0F, 2.0F, new CubeDeformation(0.2F)), PartPose.ZERO); partdefinition3.addOrReplaceChild("left_ear", CubeListBuilder.create().texOffs(19, 16).addBox(0.55F, -13.0F, 4.0F, 2.0F, 3.0F, 1.0F, new CubeDeformation(-0.001F)), PartPose.ZERO); partdefinition3.addOrReplaceChild("right_ear", CubeListBuilder.create().texOffs(19, 16).addBox(-2.55F, -13.0F, 4.0F, 2.0F, 3.0F, 1.0F, new CubeDeformation(-0.001F)), PartPose.ZERO); return meshdefinition; } public void setupAnim(T p_102785_, float p_102786_, float p_102787_, float p_102788_, float p_102789_, float p_102790_) { boolean flag = p_102785_.isSaddled(); boolean flag1 = p_102785_.isVehicle(); for(ModelPart modelpart : this.saddleParts) { modelpart.visible = flag; } for(ModelPart modelpart1 : this.ridingParts) { modelpart1.visible = flag1 && flag; } this.body.y = 11.0F; } public Iterable<ModelPart> headParts() { return ImmutableList.of(this.headParts); } protected Iterable<ModelPart> bodyParts() { return ImmutableList.of(this.body, this.rightHindLeg, this.leftHindLeg, this.rightFrontLeg, this.leftFrontLeg, this.rightHindBabyLeg, this.leftHindBabyLeg, this.rightFrontBabyLeg, this.leftFrontBabyLeg); } public void prepareMobModel(T p_102780_, float p_102781_, float p_102782_, float p_102783_) { super.prepareMobModel(p_102780_, p_102781_, p_102782_, p_102783_); float f = Mth.rotlerp(p_102780_.yBodyRotO, p_102780_.yBodyRot, p_102783_); float f1 = Mth.rotlerp(p_102780_.yHeadRotO, p_102780_.yHeadRot, p_102783_); float f2 = Mth.lerp(p_102783_, p_102780_.xRotO, p_102780_.getXRot()); float f3 = f1 - f; float f4 = f2 * ((float)Math.PI / 180F); if (f3 > 20.0F) { f3 = 20.0F; } if (f3 < -20.0F) { f3 = -20.0F; } if (p_102782_ > 0.2F) { f4 += Mth.cos(p_102781_ * 0.4F) * 0.15F * p_102782_; } float f5 = p_102780_.getEatAnim(p_102783_); float f6 = p_102780_.getStandAnim(p_102783_); float f7 = 1.0F - f6; float f8 = p_102780_.getMouthAnim(p_102783_); boolean flag = p_102780_.tailCounter != 0; float f9 = (float)p_102780_.tickCount + p_102783_; this.headParts.y = 4.0F; this.headParts.z = -12.0F; this.body.xRot = 0.0F; this.headParts.xRot = ((float)Math.PI / 6F) + f4; this.headParts.yRot = f3 * ((float)Math.PI / 180F); float f10 = p_102780_.isInWater() ? 0.2F : 1.0F; float f11 = Mth.cos(f10 * p_102781_ * 0.6662F + (float)Math.PI); float f12 = f11 * 0.8F * p_102782_; float f13 = (1.0F - Math.max(f6, f5)) * (((float)Math.PI / 6F) + f4 + f8 * Mth.sin(f9) * 0.05F); this.headParts.xRot = f6 * (0.2617994F + f4) + f5 * (2.1816616F + Mth.sin(f9) * 0.05F) + f13; this.headParts.yRot = f6 * f3 * ((float)Math.PI / 180F) + (1.0F - Math.max(f6, f5)) * this.headParts.yRot; this.headParts.y = f6 * -4.0F + f5 * 11.0F + (1.0F - Math.max(f6, f5)) * this.headParts.y; this.headParts.z = f6 * -4.0F + f5 * -12.0F + (1.0F - Math.max(f6, f5)) * this.headParts.z; this.body.xRot = f6 * (-(float)Math.PI / 4F) + f7 * this.body.xRot; float f14 = 0.2617994F * f6; float f15 = Mth.cos(f9 * 0.6F + (float)Math.PI); this.leftFrontLeg.y = 2.0F * f6 + 14.0F * f7; this.leftFrontLeg.z = -6.0F * f6 - 10.0F * f7; this.rightFrontLeg.y = this.leftFrontLeg.y; this.rightFrontLeg.z = this.leftFrontLeg.z; float f16 = ((-(float)Math.PI / 3F) + f15) * f6 + f12 * f7; float f17 = ((-(float)Math.PI / 3F) - f15) * f6 - f12 * f7; this.leftHindLeg.xRot = f14 - f11 * 0.5F * p_102782_ * f7; this.rightHindLeg.xRot = f14 + f11 * 0.5F * p_102782_ * f7; this.leftFrontLeg.xRot = f16; this.rightFrontLeg.xRot = f17; this.tail.xRot = ((float)Math.PI / 6F) + p_102782_ * 0.75F; this.tail.y = -5.0F + p_102782_; this.tail.z = 2.0F + p_102782_ * 2.0F; if (flag) { this.tail.yRot = Mth.cos(f9 * 0.7F); } else { this.tail.yRot = 0.0F; } this.rightHindBabyLeg.y = this.rightHindLeg.y; this.rightHindBabyLeg.z = this.rightHindLeg.z; this.rightHindBabyLeg.xRot = this.rightHindLeg.xRot; this.leftHindBabyLeg.y = this.leftHindLeg.y; this.leftHindBabyLeg.z = this.leftHindLeg.z; this.leftHindBabyLeg.xRot = this.leftHindLeg.xRot; this.rightFrontBabyLeg.y = this.rightFrontLeg.y; this.rightFrontBabyLeg.z = this.rightFrontLeg.z; this.rightFrontBabyLeg.xRot = this.rightFrontLeg.xRot; this.leftFrontBabyLeg.y = this.leftFrontLeg.y; this.leftFrontBabyLeg.z = this.leftFrontLeg.z; this.leftFrontBabyLeg.xRot = this.leftFrontLeg.xRot; boolean flag1 = p_102780_.isBaby(); this.rightHindLeg.visible = !flag1; this.leftHindLeg.visible = !flag1; this.rightFrontLeg.visible = !flag1; this.leftFrontLeg.visible = !flag1; this.rightHindBabyLeg.visible = flag1; this.leftHindBabyLeg.visible = flag1; this.rightFrontBabyLeg.visible = flag1; this.leftFrontBabyLeg.visible = flag1; this.body.y = flag1 ? 10.8F : 0.0F; } } Renderer @OnlyIn(Dist.CLIENT) public final class TutorialHorseRenderer extends ModAbstractHorseRenderer<TutorialHorse, TutorialHorseModel<TutorialHorse>> { private static final Map<Variant, ResourceLocation> LOCATION_BY_VARIANT = Util.make(Maps.newEnumMap(Variant.class), (p_114874_) -> { p_114874_.put(Variant.WHITE, new ResourceLocation("textures/entity/horse/horse_white.png")); p_114874_.put(Variant.CREAMY, new ResourceLocation("textures/entity/horse/horse_creamy.png")); p_114874_.put(Variant.CHESTNUT, new ResourceLocation("textures/entity/horse/horse_chestnut.png")); p_114874_.put(Variant.BROWN, new ResourceLocation("textures/entity/horse/horse_brown.png")); p_114874_.put(Variant.BLACK, new ResourceLocation("textures/entity/horse/horse_black.png")); p_114874_.put(Variant.GRAY, new ResourceLocation("textures/entity/horse/horse_gray.png")); p_114874_.put(Variant.DARKBROWN, new ResourceLocation("textures/entity/horse/horse_darkbrown.png")); }); public TutorialHorseRenderer(EntityRendererProvider.Context p_174167_) { super(p_174167_, new TutorialHorseModel<>(p_174167_.bakeLayer(ModEntityRenderers.HORSEE)), 1.1F); //this.addLayer(new HorseMarkingLayer(this)); //this.addLayer(new HorseArmorLayer(this, p_174167_.getModelSet())); } public ResourceLocation getTextureLocation(TutorialHorse p_114872_) { return LOCATION_BY_VARIANT.get(p_114872_.getVariant()); } } I'm trying to make the code equivalent to Vanilla, but I think I'm wrong. Please help me
  20. https://github.com/ocome85/ModArchive/tree/main/Custom Fishing Rod The extra files are a bit confusing, but I'll attach an example of a Custom Fishing Rod
  21. protected net.minecraft.world.entity.projectile.FishingHook m_37136_(Lnet/minecraft/world/entity/player/Player;)Z I was able to implement it by re-reading each one. I'm getting an Override error message, should I continue developing? It has taken me a long time to get to this point. Can I post the whole code in case someone else has a similar problem? (Fill in or Github link) I'm very grateful.  Thank you.
  22. Since shouldStopFishing is private, I thought I could make it protected and reference it. # Makes protected the 'COLOR_WHITE' field in Gui protected net.minecraft.client.gui.Gui f_168667_ # COLOR_WHITE If it is a field, should I use this example? But we don't know why. This may be my lack of knowledge about java. I'll check again.
  23. I tried to create it, but CustomFishingHook shouldStopFishing is not referenced. resources/META-INF/accesstransformer.cfg protected net.minecraft.world.entity.projectile.FishingHook protected net.minecraft.world.entity.projectile.FishingHook$shouldStopFishing CustomFishingHook public class CustomFishingHookaa extends FishingHook{ @Nullable public CustomFishingHookaa(EntityType<? extends CustomFishingHookaa> p_150138_, Level p_150139_, int p_150143_, int p_150144_) { super(p_150138_, p_150139_); this.noCulling = true; } public CustomFishingHookaa(Player p_37106_, Level p_37107_, int p_37108_, int p_37109_) { this(ModEntities.MODFISHING_BOBBER, p_37107_, p_37108_, p_37109_); this.setOwner(p_37106_); float f = p_37106_.getXRot(); float f1 = p_37106_.getYRot(); float f2 = Mth.cos(-f1 * ((float)Math.PI / 180F) - (float)Math.PI); float f3 = Mth.sin(-f1 * ((float)Math.PI / 180F) - (float)Math.PI); float f4 = -Mth.cos(-f * ((float)Math.PI / 180F)); float f5 = Mth.sin(-f * ((float)Math.PI / 180F)); double d0 = p_37106_.getX() - (double)f3 * 0.3D; double d1 = p_37106_.getEyeY(); double d2 = p_37106_.getZ() - (double)f2 * 0.3D; this.moveTo(d0, d1, d2, f1, f); Vec3 vec3 = new Vec3((double)(-f3), (double)Mth.clamp(-(f5 / f4), -5.0F, 5.0F), (double)(-f2)); double d3 = vec3.length(); vec3 = vec3.multiply(0.6D / d3 + 0.5D + this.random.nextGaussian() * 0.0045D, 0.6D / d3 + 0.5D + this.random.nextGaussian() * 0.0045D, 0.6D / d3 + 0.5D + this.random.nextGaussian() * 0.0045D); this.setDeltaMovement(vec3); this.setYRot((float)(Mth.atan2(vec3.x, vec3.z) * (double)(180F / (float)Math.PI))); this.setXRot((float)(Mth.atan2(vec3.y, vec3.horizontalDistance()) * (double)(180F / (float)Math.PI))); this.yRotO = this.getYRot(); this.xRotO = this.getXRot(); } public CustomFishingHookaa(EntityType<CustomFishingHookaa> customFishingHookEntityType, Level level) { this(customFishingHookEntityType,level, 0, 0); } protected boolean shouldStopFishing(Player p_37137_) { ItemStack itemstack = p_37137_.getMainHandItem(); ItemStack itemstack1 = p_37137_.getOffhandItem(); boolean flag = itemstack.getItem() instanceof Netherite_Rod; boolean flag1 = itemstack1.getItem() instanceof Netherite_Rod; if (!p_37137_.isRemoved() && p_37137_.isAlive() && (flag || flag1) && !(this.distanceToSqr(p_37137_) > 1024.0D)) { return false; } else { this.discard(); return true; } } } I've seen the documentation, but I'm not sure if it's correct.
  24. Thanks for the reply. I'll look into the countermeasure. Is the merge something that will be done soon? Or is there no specific time frame?
  25. https://github.com/MinecraftForge/MinecraftForge/pull/8168/files I am trying to use this, but when I create the CustomFishingHook, the call to super.tick goes wrong and does not work properly. I would like to know how to run the supertick (Projectile.tick) and what the solution is. https://github.com/ocome85/Fishing-Mod/blob/main/src/main/java/com/ocome/ocomefishingmod/item/CustomFishingHook.java#L252
×
×
  • Create New...

Important Information

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