Skip to content

Commit

Permalink
Added missing entities (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
Onako2 authored Jun 14, 2024
1 parent c47a9c5 commit 4763784
Show file tree
Hide file tree
Showing 8 changed files with 117 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/main/java/org/purpurmc/purpur/client/config/Seats.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@
@SuppressWarnings("CanBeFinal")
public class Seats {
public Seat axolotl = new Seat(0.0D, 0.0D, 0.0D);
public Seat armadillo = new Seat(0.0D, 0.0D, 0.0D);
public Seat allay = new Seat(0.0D, 0.0D, 0.0D);
public Seat bat = new Seat(0.0D, 0.0D, 0.0D);
public Seat bee = new Seat(0.0D, 0.0D, 0.0D);
public Seat blaze = new Seat(0.0D, 0.0D, 0.0D);
public Seat bogged = new Seat(0.0D, 0.0D, 0.0D);
public Seat breeze = new Seat(0.0D, 0.0D, 0.0D);
public Seat camel = new Seat(0.0D, 0.0D, 0.0D);
public Seat cat = new Seat(0.0D, 0.0D, 0.0D);
public Seat caveSpider = new Seat(0.0D, 0.0D, 0.0D);
public Seat chicken = new Seat(0.0D, 0.0D, 0.0D);
Expand Down Expand Up @@ -86,11 +90,16 @@ public class Seats {
public Seat zombifiedPiglin = new Seat(0.0D, 0.0D, 0.0D);

public void setAllSeats(double x, double y, double z) {
allay.setSeat(z, y, z);
armadillo.setSeat(z, y, z);
axolotl.setSeat(z, y, z);
allay.setSeat(z, y, z);
bat.setSeat(z, y, z);
bee.setSeat(z, y, z);
blaze.setSeat(z, y, z);
bogged.setSeat(z, y, z);
breeze.setSeat(z, y, z);
camel.setSeat(z, y, z);
cat.setSeat(z, y, z);
caveSpider.setSeat(z, y, z);
chicken.setSeat(z, y, z);
Expand Down Expand Up @@ -168,10 +177,14 @@ public void setAllSeats(double x, double y, double z) {
public Seat getSeat(Mob mob) {
return switch (mob) {
case ALLAY -> this.allay;
case ARMADILLO -> this.armadillo;
case AXOLOTL -> this.axolotl;
case BAT -> this.bat;
case BEE -> this.bee;
case BLAZE -> this.blaze;
case BOGGED -> this.bogged;
case BREEZE -> this.breeze;
case CAMEL -> this.camel;
case CAT -> this.cat;
case CAVE_SPIDER -> this.caveSpider;
case CHICKEN -> this.chicken;
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/purpurmc/purpur/client/entity/Mob.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
import net.minecraft.world.entity.EntityType;

public enum Mob {
ARMADILLO(EntityType.ARMADILLO, 13, 4),
ALLAY(EntityType.ALLAY, 9, 4),
AXOLOTL(EntityType.AXOLOTL, 0, 0),
BAT(EntityType.BAT, 1, 0),
BEE(EntityType.BEE, 2, 0),
BLAZE(EntityType.BLAZE, 3, 0),
BOGGED(EntityType.BOGGED, 14, 4),
BREEZE(EntityType.BREEZE, 15, 4),
CAMEL(EntityType.CAMEL, 0, 5),
CAT(EntityType.CAT, 4, 0),
CAVE_SPIDER(EntityType.CAVE_SPIDER, 5, 0),
CHICKEN(EntityType.CHICKEN, 6, 0),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.purpurmc.purpur.client.mixin.mob;

import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.animal.armadillo.Armadillo;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
import org.purpurmc.purpur.client.entity.RidableEntity;
import org.spongepowered.asm.mixin.Mixin;

@Mixin(Armadillo.class)
public abstract class MixinArmadillo extends Mob implements RidableEntity {
public MixinArmadillo(EntityType<? extends Armadillo> entityType, Level world) {
super(entityType, world);
}

@Override
public Vec3 getPassengerRidingPosition(Entity passenger) {
return super.getPassengerRidingPosition(passenger).add(getSeats().armadillo.x, getSeats().armadillo.y, getSeats().armadillo.z);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.purpurmc.purpur.client.mixin.mob;

import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.monster.Bogged;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
import org.purpurmc.purpur.client.entity.RidableEntity;
import org.spongepowered.asm.mixin.Mixin;

@Mixin(Bogged.class)
public abstract class MixinBogged extends Mob implements RidableEntity {
public MixinBogged(EntityType<? extends Bogged> entityType, Level world) {
super(entityType, world);
}

@Override
public Vec3 getPassengerRidingPosition(Entity passenger) {
return super.getPassengerRidingPosition(passenger).add(getSeats().bogged.x, getSeats().bogged.y, getSeats().bogged.z);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package org.purpurmc.purpur.client.mixin.mob;

import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.monster.breeze.Breeze;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
import org.purpurmc.purpur.client.entity.RidableEntity;
import org.spongepowered.asm.mixin.Mixin;

@Mixin(Breeze.class)
public abstract class MixinBreeze extends Mob implements RidableEntity {
public MixinBreeze(EntityType<? extends Breeze> entityType, Level world) {
super(entityType, world);
}

@Override
public Vec3 getPassengerRidingPosition(Entity passenger) {
return super.getPassengerRidingPosition(passenger).add(getSeats().breeze.x, getSeats().breeze.y, getSeats().breeze.z);
}
}
30 changes: 30 additions & 0 deletions src/main/java/org/purpurmc/purpur/client/mixin/mob/MixinCamel.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package org.purpurmc.purpur.client.mixin.mob;

import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.animal.camel.Camel;
import net.minecraft.world.entity.monster.breeze.Breeze;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.Vec3;
import org.purpurmc.purpur.client.entity.RidableEntity;
import org.purpurmc.purpur.client.mixin.accessor.AccessAbstractPiglin;
import org.spongepowered.asm.mixin.Mixin;

@Mixin(Breeze.class)
public abstract class MixinCamel extends Mob implements RidableEntity {
public MixinCamel(EntityType<? extends Camel> entityType, Level world) {
super(entityType, world);
}

@Override
public Vec3 getPassengerRidingPosition(Entity passenger) {
return super.getPassengerRidingPosition(passenger).add(getSeats().camel.x, getSeats().camel.y, getSeats().camel.z);
}

@Override
public boolean isNoAi() {
// silly hack to stop camel from standing up on preview screen
return ((AccessAbstractPiglin) this).getTimeInOverworld() < 0 || super.isNoAi();
}
}
Binary file modified src/main/resources/assets/purpurclient/textures/mobs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/main/resources/purpurclient.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@
"accessor.AccessMagmaCube",
"accessor.AccessSlime",
"mob.MixinAllay",
"mob.MixinArmadillo",
"mob.MixinAxolotl",
"mob.MixinBat",
"mob.MixinBee",
"mob.MixinBlaze",
"mob.MixinBogged",
"mob.MixinBreeze",
"mob.MixinCamel",
"mob.MixinCat",
"mob.MixinCaveSpider",
"mob.MixinChicken",
Expand Down

0 comments on commit 4763784

Please sign in to comment.