Skip to content

Commit

Permalink
v1.3.2 (i)
Browse files Browse the repository at this point in the history
- 1.20.1 Fabric Port of Bygone Nether v1.3.2
  • Loading branch information
izofar committed Sep 23, 2023
1 parent 06217b1 commit 844f57a
Show file tree
Hide file tree
Showing 64 changed files with 302 additions and 502 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.0-SNAPSHOT'
id 'fabric-loom' version '1.3-SNAPSHOT'
id 'maven-publish'
}

Expand Down Expand Up @@ -48,7 +48,7 @@ java {

jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
rename { "${it}_${project.base.archivesName.get()}"}
}
}

Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# Check these on https://fabricmc.net/develop
minecraft_version=1.19.2
parchment_mappings = 1.19.2:2022.11.27
minecraft_version=1.20.1
parchment_mappings = 1.20.1:2023.09.03
loader_version=0.14.12

# Mod Properties
mod_version = 1.3.2
maven_group = com.izofar
archives_base_name = bygonenether-1.19
archives_base_name = bygonenether-1.20

# Dependencies
fabric_version=0.72.0+1.19.2
modmenu_version = 4.1.2
fabric_version=0.85.0+1.20.1
modmenu_version = 7.2.2
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
5 changes: 4 additions & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,13 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/izofar/bygonenether/BygoneNetherMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class BygoneNetherMod implements ModInitializer {
public void onInitialize() {
ModItems.registerItems();
ModBlocks.registerBlocks();
ModCreativeModeTabs.registerCreativeModeTabs();
ModEntityTypes.registerEntityTypes();
ModStructures.registerStructures();
ModSensorTypes.registerSensorTypes();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,6 @@ private static Direction getConnectedDirection(BlockState state) {
};
}

@Override
public PushReaction getPistonPushReaction(BlockState state) {
return PushReaction.DESTROY;
}

@Nullable
@Override
public BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) {
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/com/izofar/bygonenether/client/model/WexModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import net.fabricmc.api.Environment;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.*;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.HumanoidArm;

Expand All @@ -24,6 +26,15 @@ public WexModel(ModelPart part) {
this.leftWing = part.getChild("left_wing");
}

public static LayerDefinition createBodyLayer() {
MeshDefinition meshDefinition = HumanoidModel.createMesh(CubeDeformation.NONE, 0.0F);
PartDefinition partDefinition = meshDefinition.getRoot();
partDefinition.addOrReplaceChild("right_leg", CubeListBuilder.create().texOffs(32, 0).addBox(-1.0F, -1.0F, -2.0F, 6.0F, 10.0F, 4.0F), PartPose.offset(-1.9F, 12.0F, 0.0F));
partDefinition.addOrReplaceChild("right_wing", CubeListBuilder.create().texOffs(0, 32).addBox(-20.0F, 0.0F, 0.0F, 20.0F, 12.0F, 1.0F), PartPose.ZERO);
partDefinition.addOrReplaceChild("left_wing", CubeListBuilder.create().texOffs(0, 32).mirror().addBox(0.0F, 0.0F, 0.0F, 20.0F, 12.0F, 1.0F), PartPose.ZERO);
return LayerDefinition.create(meshDefinition, 64, 64);
}

@Override
protected Iterable<ModelPart> bodyParts() {
return Iterables.concat(super.bodyParts(), ImmutableList.of(this.rightWing, this.leftWing));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.rendering.v1.BuiltinItemRendererRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry;
import net.fabricmc.fabric.api.event.client.ClientSpriteRegistryCallback;
import net.minecraft.client.model.ShieldModel;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.blockentity.BannerRenderer;
Expand Down Expand Up @@ -50,11 +49,6 @@ public static void stitchTextureModelLayer() {
return InteractionResult.PASS;
});

ClientSpriteRegistryCallback.event(TextureAtlas.LOCATION_BLOCKS).register((atlasTexture, registry) -> {
registry.register(GILDED_NETHERITE_SHIELD_BASE_LOCATION);
registry.register(GILDED_NETHERITE_SHIELD_BASE_NOPATTERN_LOCATION);
});

BuiltinItemRendererRegistry.INSTANCE.register(ModItems.GILDED_NETHERITE_SHIELD, (stack, transformType, poseStack, buffer, packedLight, packedOverlay) -> renderByItem(stack, poseStack, buffer, packedLight, packedOverlay));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.izofar.bygonenether.entity.PiglinHunter;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.model.HumanoidArmorModel;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.model.geom.ModelLayers;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
Expand All @@ -19,7 +20,7 @@ public class PiglinHunterRenderer extends HumanoidMobRenderer<PiglinHunter, Pigl

public PiglinHunterRenderer(EntityRendererProvider.Context context) {
super(context, new PiglinHunterModel(PiglinHunterModel.createBodyLayer().bakeRoot()), 0.5F, 1.0019531F, 1.0F, 1.0019531F);
this.addLayer(new HumanoidArmorLayer(this, new HumanoidModel<>(context.bakeLayer(ModelLayers.PIGLIN_INNER_ARMOR)), new HumanoidModel<>(context.bakeLayer(ModelLayers.PIGLIN_OUTER_ARMOR))));
this.addLayer(new HumanoidArmorLayer(this, new HumanoidModel<>(context.bakeLayer(ModelLayers.PIGLIN_INNER_ARMOR)), new HumanoidArmorModel<>(context.bakeLayer(ModelLayers.PIGLIN_OUTER_ARMOR)), context.getModelManager()));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.mojang.blaze3d.vertex.PoseStack;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.model.geom.ModelLayers;
import net.minecraft.client.renderer.entity.EntityRendererProvider;
import net.minecraft.client.renderer.entity.HumanoidMobRenderer;
import net.minecraft.core.BlockPos;
Expand All @@ -19,7 +18,7 @@ public class WexRenderer extends HumanoidMobRenderer<Wex, WexModel> {
private static final ResourceLocation WEX_CHARGING_LOCATION = new ResourceLocation(BygoneNetherMod.MODID, "textures/entity/wex/wex_charging.png");

public WexRenderer(EntityRendererProvider.Context context) {
super(context, new WexModel(context.bakeLayer(ModelLayers.VEX)), 0.3F);
super(context, new WexModel(WexModel.createBodyLayer().bakeRoot()), 0.3F);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.izofar.bygonenether.client.renderer.layers;

import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Vector3f;
import com.mojang.math.Axis;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.Minecraft;
Expand All @@ -26,11 +26,11 @@ public void render(PoseStack stack, MultiBufferSource buffer, int packedLight, T
if (blockstate != null) {
stack.pushPose();
stack.translate(0.0D, 0.6875D, -0.75D);
stack.mulPose(Vector3f.XP.rotationDegrees(20.0F));
stack.mulPose(Vector3f.YP.rotationDegrees(45.0F));
stack.mulPose(Axis.XP.rotationDegrees(20.0F));
stack.mulPose(Axis.YP.rotationDegrees(45.0F));
stack.translate(0.25D, 0.1875D, 0.25D);
stack.scale(-0.5F, -0.5F, 0.5F);
stack.mulPose(Vector3f.YP.rotationDegrees(90.0F));
stack.mulPose(Axis.YP.rotationDegrees(90.0F));
Minecraft.getInstance().getBlockRenderer().renderSingleBlock(blockstate, stack, buffer, packedLight, OverlayTexture.NO_OVERLAY);
stack.popPose();
}
Expand Down
27 changes: 22 additions & 5 deletions src/main/java/com/izofar/bygonenether/entity/PiglinHunter.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.ai.attributes.AttributeInstance;
import net.minecraft.world.entity.ai.attributes.AttributeModifier;
import net.minecraft.world.entity.ai.attributes.Attributes;
Expand All @@ -20,6 +21,7 @@
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.ShieldItem;
import net.minecraft.world.level.Level;

import java.util.UUID;
Expand Down Expand Up @@ -49,7 +51,7 @@ protected void registerGoals() {
@Override
public void tick() {
super.tick();
if (!this.level.isClientSide) {
if (!this.level().isClientSide) {
this.decrementShieldCooldown();
}
}
Expand Down Expand Up @@ -87,13 +89,28 @@ public void knockback(double strength, double x, double z) {
if (!this.isUsingShield()) {
super.knockback(strength, x, z);
} else {
this.playSound(SoundEvents.SHIELD_BLOCK, 1.0F, 0.8F + this.level.random.nextFloat() * 0.4F);
this.playSound(SoundEvents.SHIELD_BLOCK, 1.0F, 0.8F + this.level().random.nextFloat() * 0.4F);
}
}

@Override
protected void blockUsingShield(LivingEntity attacker) {
super.blockUsingShield(attacker);
if (IShieldedMob.canDisableShield(this.useItem)) {
this.disableShield();
}
}

private void disableShield() {
this.setShieldCooldown(60);
this.stopUsingShield();
this.level().broadcastEntityEvent(this, (byte)30);
this.playSound(SoundEvents.SHIELD_BREAK, 0.8F, 0.8F + this.level().random.nextFloat() * 0.4F);
}

@Override
public boolean isShieldDisabled() {
return false;
return this.getShieldCooldown() > 0;
}

@Override
Expand All @@ -103,7 +120,7 @@ public void startUsingShield() {
}

for (InteractionHand interactionhand : InteractionHand.values()) {
if (this.getItemInHand(interactionhand).is(ModItems.GILDED_NETHERITE_SHIELD)) {
if (this.getItemInHand(interactionhand).getItem() instanceof ShieldItem) {
this.startUsingItem(interactionhand);
this.setUsingShield(true);
this.setShieldMainhand(interactionhand == InteractionHand.MAIN_HAND);
Expand All @@ -122,7 +139,7 @@ public void stopUsingShield() {
}

for (InteractionHand interactionhand : InteractionHand.values()) {
if (this.getItemInHand(interactionhand).is(ModItems.GILDED_NETHERITE_SHIELD)) {
if (this.getItemInHand(interactionhand).getItem() instanceof ShieldItem) {
this.stopUsingItem();
this.setUsingShield(false);
AttributeInstance attributeinstance = this.getAttribute(Attributes.MOVEMENT_SPEED);
Expand Down
20 changes: 10 additions & 10 deletions src/main/java/com/izofar/bygonenether/entity/PiglinPrisoner.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public PiglinPrisoner(EntityType<? extends AbstractPiglin> entitytype, Level wor
@Override
public void tick () {
super.tick();
if (this.level.isClientSide && !this.hasTempter && this.getTempter() != null) {
if (this.level().isClientSide && !this.hasTempter && this.getTempter() != null) {
this.hasTempter = true;
this.spawnHeartParticles();
}
Expand Down Expand Up @@ -155,9 +155,9 @@ public void readAdditionalSaveData(CompoundTag tag) {

@Override
protected void customServerAiStep() {
this.level.getProfiler().push("piglinBrain");
this.getBrain().tick((ServerLevel)this.level, this);
this.level.getProfiler().pop();
this.level().getProfiler().push("piglinBrain");
this.getBrain().tick((ServerLevel)this.level(), this);
this.level().getProfiler().pop();
PiglinPrisonerAi.updateActivity(this);
if (this.isBeingRescued) {
this.timeBeingRescued ++;
Expand Down Expand Up @@ -233,7 +233,7 @@ public InteractionResult mobInteract(Player player, InteractionHand hand) {
InteractionResult interactionresult = super.mobInteract(player, hand);
if (interactionresult.consumesAction()) {
return interactionresult;
} else if (!this.level.isClientSide) {
} else if (!this.level().isClientSide) {
return PiglinPrisonerAi.mobInteract(this, player, hand);
} else {
boolean flag = PiglinPrisonerAi.canAdmire(this, player.getItemInHand(hand)) && this.getArmPose() != PiglinArmPose.ADMIRING_ITEM;
Expand Down Expand Up @@ -330,7 +330,7 @@ public PiglinArmPose getArmPose() {
@Override
public boolean hurt(DamageSource source, float amount) {
boolean flag = super.hurt(source, amount);
if (this.level.isClientSide) {
if (this.level().isClientSide) {
return false;
} else {
if (flag && source.getEntity() instanceof LivingEntity) {
Expand All @@ -355,7 +355,7 @@ public void holdInOffHand(ItemStack stack) {

@Override
public boolean wantsToPickUp(ItemStack itemstack) {
return level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && this.canPickUpLoot() && PiglinPrisonerAi.wantsToPickup(this, itemstack);
return level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) && this.canPickUpLoot() && PiglinPrisonerAi.wantsToPickup(this, itemstack);
}

public boolean canReplaceCurrentItem(ItemStack replacementStack) {
Expand Down Expand Up @@ -389,7 +389,7 @@ protected void pickUpItem(ItemEntity itemEntity) {

@Override
protected SoundEvent getAmbientSound() {
return this.level.isClientSide ? null : PiglinPrisonerAi.getSoundForCurrentActivity(this).orElse(null);
return this.level().isClientSide ? null : PiglinPrisonerAi.getSoundForCurrentActivity(this).orElse(null);
}

@Override
Expand Down Expand Up @@ -420,7 +420,7 @@ protected void playConvertedSound() {
public Player getTempter() {
try {
UUID uuid = this.getTempterUUID();
return uuid == null ? null : this.level.getPlayerByUUID(uuid);
return uuid == null ? null : this.level().getPlayerByUUID(uuid);
} catch (IllegalArgumentException illegalargumentexception) {
return null;
}
Expand All @@ -441,7 +441,7 @@ public void spawnHeartParticles() {
double d0 = this.random.nextGaussian() * 0.02D;
double d1 = this.random.nextGaussian() * 0.02D;
double d2 = this.random.nextGaussian() * 0.02D;
this.level.addParticle(ParticleTypes.HEART, this.getRandomX(1.0D), this.getRandomY() + 1.0D, this.getRandomZ(1.0D), d0, d1, d2);
this.level().addParticle(ParticleTypes.HEART, this.getRandomX(1.0D), this.getRandomY() + 1.0D, this.getRandomZ(1.0D), d0, d1, d2);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,25 @@ protected Item getDefaultItem() {
@Override
protected void onHitEntity(EntityHitResult result) {
super.onHitEntity(result);
result.getEntity().hurt(DamageSource.thrown(this, this.getOwner()), 0.0F);
result.getEntity().hurt(this.damageSources().thrown(this, this.getOwner()), 0.0F);
}

@Override
protected void onHit(HitResult result) {
super.onHit(result);

for (int i = 0; i < 32; ++i) {
this.level.addParticle(ParticleTypes.PORTAL, this.getX(), this.getY() + this.random.nextDouble() * 2.0D, this.getZ(), this.random.nextGaussian(), 0.0D, this.random.nextGaussian());
this.level().addParticle(ParticleTypes.PORTAL, this.getX(), this.getY() + this.random.nextDouble() * 2.0D, this.getZ(), this.random.nextGaussian(), 0.0D, this.random.nextGaussian());
}

if (!this.level.isClientSide && !this.isRemoved()) {
if (!this.level().isClientSide && !this.isRemoved()) {
Entity entity = this.getOwner();
if (entity instanceof ServerPlayer serverplayer) {
if (serverplayer.connection.getConnection().isConnected() && serverplayer.level == this.level && !serverplayer.isSleeping()) {
if (this.random.nextFloat() < 0.05F && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)) {
Endermite endermite = EntityType.ENDERMITE.create(this.level);
if (serverplayer.connection.isAcceptingMessages() && serverplayer.level() == this.level() && !serverplayer.isSleeping()) {
if (this.random.nextFloat() < 0.05F && this.level().getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING)) {
Endermite endermite = EntityType.ENDERMITE.create(this.level());
endermite.moveTo(entity.getX(), entity.getY(), entity.getZ(), entity.getYRot(), entity.getXRot());
this.level.addFreshEntity(endermite);
this.level().addFreshEntity(endermite);
}

if (entity.isPassenger()) {
Expand All @@ -68,11 +68,11 @@ protected void onHit(HitResult result) {
entity.teleportTo(this.getX(), this.getY(), this.getZ());
entity.resetFallDistance();

if (this.getLevel().getBlockState(this.blockPosition()).is(Blocks.WATER)) {
if (this.level().getBlockState(this.blockPosition()).is(Blocks.WATER)) {
serverplayer.addEffect(new MobEffectInstance(MobEffects.WATER_BREATHING, 300));
} else if (entity.isInLava() || this.getLevel().getBlockState(this.blockPosition()).is(Blocks.LAVA)) {
} else if (entity.isInLava() || this.level().getBlockState(this.blockPosition()).is(Blocks.LAVA)) {
serverplayer.addEffect(new MobEffectInstance(MobEffects.FIRE_RESISTANCE, 900));
} else if (!this.isOnGround()) {
} else if (!this.onGround()) {
serverplayer.addEffect(new MobEffectInstance(MobEffects.SLOW_FALLING, 160));
serverplayer.addEffect(new MobEffectInstance(MobEffects.ABSORPTION, 300, 1));
}
Expand Down Expand Up @@ -103,7 +103,7 @@ public void tick() {
@Override
public Entity changeDimension(ServerLevel serverlevel) {
Entity entity = this.getOwner();
if (entity != null && entity.level.dimension() != serverlevel.dimension()) {
if (entity != null && entity.level().dimension() != serverlevel.dimension()) {
this.setOwner(null);
}
return super.changeDimension(serverlevel);
Expand Down
Loading

0 comments on commit 844f57a

Please sign in to comment.