Skip to content

Commit

Permalink
Adjusted backported changes to 1.19.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Majrusz committed Mar 2, 2023
1 parent 737af8d commit e97ebbd
Show file tree
Hide file tree
Showing 11 changed files with 55 additions and 191 deletions.
6 changes: 1 addition & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ apply plugin: 'eclipse'
apply plugin: 'maven-publish'
apply plugin: 'org.spongepowered.mixin'

<<<<<<< HEAD
version = '1.6.1'
=======
version = '1.7.0'
>>>>>>> 5bfad34a (Removed unfinished tag)
group = 'com.majruszsdifficulty'
archivesBaseName = 'majruszs-difficulty-1.19.2'

Expand Down Expand Up @@ -80,7 +76,7 @@ repositories {

dependencies {
minecraft 'net.minecraftforge:forge:1.19.2-43.2.0'
implementation fg.deobf( 'com.mlib:majrusz-library-1.19.2:3.1.0' )
implementation fg.deobf( 'com.mlib:majrusz-library-1.19.2:3.2.0' )
}

// Example for how to get properties into the manifest for reading at runtime.
Expand Down
Binary file removed libs/majrusz-library-1.19.2-3.1.0.jar
Binary file not shown.
Binary file not shown.
162 changes: 0 additions & 162 deletions src/main/java/com/majruszsdifficulty/CreativeModeTabs.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.ai.goal.Goal;
import net.minecraft.world.entity.ai.navigation.PathNavigation;
import net.minecraft.world.phys.Vec3;

public class UndeadArmyAttackPositionGoal extends Goal {
final Mob undead;
Expand Down Expand Up @@ -55,7 +56,7 @@ private boolean hasAnyTarget() {
}

private double getDistanceToAttackPosition() {
return VectorHelper.distanceHorizontal( this.undead.position(), this.attackPosition.getCenter() );
return VectorHelper.distanceHorizontal( this.undead.position(), new Vec3( this.attackPosition.getX() + 0.5, this.attackPosition.getY() + 0.5, this.attackPosition.getZ() + 0.5 ) );
}
}

39 changes: 38 additions & 1 deletion src/main/java/com/majruszsdifficulty/items/CerberusFangItem.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,46 @@
package com.majruszsdifficulty.items;

import com.majruszsdifficulty.Registries;
import net.minecraft.core.NonNullList;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.alchemy.Potion;
import net.minecraft.world.item.alchemy.PotionUtils;

import java.util.stream.Stream;

public class CerberusFangItem extends Item {
public CerberusFangItem() {
super( new Properties() );
super( new Properties().tab( Registries.ITEM_GROUP ) );
}

@Override
public void fillItemCategory( CreativeModeTab creativeModeTab, NonNullList< ItemStack > itemStacks ) {
super.fillItemCategory( creativeModeTab, itemStacks );

if( !this.allowedIn( creativeModeTab ) ) {
return;
}

Stream.of(
newItemStackWithPotion( Items.TIPPED_ARROW, Registries.WITHER_POTION.get() ),
newItemStackWithPotion( Items.TIPPED_ARROW, Registries.WITHER_POTION_LONG.get() ),
newItemStackWithPotion( Items.TIPPED_ARROW, Registries.WITHER_POTION_STRONG.get() ),
newItemStackWithPotion( Items.POTION, Registries.WITHER_POTION.get() ),
newItemStackWithPotion( Items.POTION, Registries.WITHER_POTION_LONG.get() ),
newItemStackWithPotion( Items.POTION, Registries.WITHER_POTION_STRONG.get() ),
newItemStackWithPotion( Items.SPLASH_POTION, Registries.WITHER_POTION.get() ),
newItemStackWithPotion( Items.SPLASH_POTION, Registries.WITHER_POTION_LONG.get() ),
newItemStackWithPotion( Items.SPLASH_POTION, Registries.WITHER_POTION_STRONG.get() ),
newItemStackWithPotion( Items.LINGERING_POTION, Registries.WITHER_POTION.get() ),
newItemStackWithPotion( Items.LINGERING_POTION, Registries.WITHER_POTION_LONG.get() ),
newItemStackWithPotion( Items.LINGERING_POTION, Registries.WITHER_POTION_STRONG.get() )
).forEach( itemStacks::add );
}

private static ItemStack newItemStackWithPotion( Item item, Potion potion ) {
return PotionUtils.setPotion( new ItemStack( item ), potion );
}
}
13 changes: 0 additions & 13 deletions src/main/java/com/majruszsdifficulty/items/ClothItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,4 @@ public class ClothItem extends Item {
public ClothItem() {
super( new Properties().tab( Registries.ITEM_GROUP ) );
}

@Override
public void fillItemCategory( CreativeModeTab itemGroup, NonNullList< ItemStack > itemStacks ) {
if( !this.allowedIn( itemGroup ) )
return;

Stream.of(
UndeadArmorItem.constructItem( UndeadArmorItem.HELMET_ID ),
UndeadArmorItem.constructItem( UndeadArmorItem.CHESTPLATE_ID ),
UndeadArmorItem.constructItem( UndeadArmorItem.LEGGINGS_ID ),
UndeadArmorItem.constructItem( UndeadArmorItem.BOOTS_ID )
).forEach( itemStacks::add );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static ItemStack randomItemStack( int bonusCount ) {
}

public SoulJarItem() {
super( new Properties().stacksTo( 1 ).rarity( Rarity.UNCOMMON ) );
super( new Properties().stacksTo( 1 ).rarity( Rarity.UNCOMMON ).tab( Registries.ITEM_GROUP ) );
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

public class TatteredArmorItem extends ArmorItem {
public TatteredArmorItem( EquipmentSlot slot ) {
super( CustomArmorMaterial.UNDEAD, slot, new Item.Properties().rarity( Rarity.UNCOMMON ) );
super( CustomArmorMaterial.UNDEAD, slot, new Item.Properties().rarity( Rarity.UNCOMMON ).tab( Registries.ITEM_GROUP ) );
}

@Nullable
Expand Down
13 changes: 7 additions & 6 deletions src/main/java/com/majruszsdifficulty/models/CerberusModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.mlib.animations.Frame;
import com.mlib.animations.InterpolationType;
import com.mlib.math.VectorHelper;
import com.mojang.math.Vector3f;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.HierarchicalModel;
import net.minecraft.client.model.geom.ModelPart;
Expand All @@ -14,7 +15,6 @@
import net.minecraft.util.Mth;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import org.joml.Vector3f;

@OnlyIn( Dist.CLIENT )
public class CerberusModel< Type extends CerberusEntity > extends HierarchicalModel< Type > {
Expand Down Expand Up @@ -332,11 +332,12 @@ public void setupAnim( Type cerberus, float limbSwing, float limbSwingAmount, fl
this.jawLower1.xRot = this.jawLower2.xRot = this.jawLower3.xRot = breathJawRotation;

// bite anims (side necks)
Vector3f neckRotation = new Vector3f( BITE_SIDE_NECK_ROTATION.apply( biteRatio, ageInTicks ) ).mul( ( float )Math.PI / 180.0f );
this.neck1.xRot = neckRotation.x;
this.neck1.zRot = neckRotation.z;
this.neck3.xRot = neckRotation.x;
this.neck3.zRot = -neckRotation.z;
Vector3f neckRotation = BITE_SIDE_NECK_ROTATION.apply( biteRatio, ageInTicks );
neckRotation.mul( ( float )Math.PI / 180.0f );
this.neck1.xRot = neckRotation.x();
this.neck1.zRot = neckRotation.z();
this.neck3.xRot = neckRotation.x();
this.neck3.zRot = -neckRotation.z();
}

private float getPlayerDistance( Type cerberus ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.phys.Vec3;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -96,7 +97,10 @@ public void setState( Phase.State state, int ticksLeft ) {
}

public double distanceTo( BlockPos position ) {
return VectorHelper.distanceHorizontal( position.getCenter(), this.positionToAttack.getCenter() );
return VectorHelper.distanceHorizontal(
new Vec3( position.getX() + 0.5, position.getY() + 0.5, position.getZ() + 0.5 ),
new Vec3( this.positionToAttack.getX() + 0.5, this.positionToAttack.getY() + 0.5, this.positionToAttack.getZ() + 0.5 )
);
}

public boolean hasFinished() {
Expand Down

0 comments on commit e97ebbd

Please sign in to comment.