Skip to content

Commit

Permalink
Backported to 1.19.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Majrusz committed Jan 23, 2023
1 parent 8ea42fa commit 53a0f05
Show file tree
Hide file tree
Showing 28 changed files with 64 additions and 160 deletions.
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ apply plugin: 'org.spongepowered.mixin'

version = '1.6.1'
group = 'com.majruszsdifficulty'
archivesBaseName = 'majruszs-difficulty-1.19.3'
archivesBaseName = 'majruszs-difficulty-1.19.2'

// Mojang ships Java 16 to end users in 1.17+ instead of Java 8 in 1.16 or lower, so your mod should target Java 16.
java.toolchain.languageVersion = JavaLanguageVersion.of(17)

minecraft {
mappings channel: 'official', version: '1.19.3'
mappings channel: 'official', version: '1.19.2'

accessTransformer = file( 'src/main/resources/META-INF/accesstransformer.cfg' ) // Currently, this location cannot be changed from the default.

Expand Down Expand Up @@ -76,8 +76,8 @@ repositories {
}

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

// Example for how to get properties into the manifest for reading at runtime.
Expand Down
Binary file not shown.
127 changes: 0 additions & 127 deletions src/main/java/com/majruszsdifficulty/CreativeModeTabs.java

This file was deleted.

12 changes: 9 additions & 3 deletions src/main/java/com/majruszsdifficulty/Registries.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.mlib.commands.Command;
import com.mlib.config.ConfigGroup;
import com.mlib.gamemodifiers.GameModifier;
import com.mlib.items.CreativeModeTabHelper;
import com.mlib.registries.RegistryHelper;
import com.mlib.triggers.BasicTrigger;
import net.minecraft.advancements.CriteriaTriggers;
Expand All @@ -36,6 +37,7 @@
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.SpawnPlacements;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.SpawnEggItem;
import net.minecraft.world.level.Level;
Expand All @@ -62,7 +64,10 @@
import java.util.function.Supplier;
import java.util.stream.Stream;

import static com.majruszsdifficulty.MajruszsDifficulty.MOD_ID;
import static com.majruszsdifficulty.MajruszsDifficulty.SERVER_CONFIG;
import static net.minecraft.core.Registry.LOOT_FUNCTION_REGISTRY;
import static net.minecraft.core.Registry.LOOT_FUNCTION_TYPE;

public class Registries {
private static final RegistryHelper HELPER = new RegistryHelper( MajruszsDifficulty.MOD_ID );
Expand All @@ -82,7 +87,7 @@ public class Registries {
static final DeferredRegister< MobEffect > MOB_EFFECTS = HELPER.create( ForgeRegistries.Keys.MOB_EFFECTS );
static final DeferredRegister< ParticleType< ? > > PARTICLE_TYPES = HELPER.create( ForgeRegistries.Keys.PARTICLE_TYPES );
static final DeferredRegister< SoundEvent > SOUNDS_EVENTS = HELPER.create( ForgeRegistries.Keys.SOUND_EVENTS );
static final DeferredRegister< LootItemFunctionType > LOOT_FUNCTIONS = HELPER.create( net.minecraft.core.registries.Registries.LOOT_FUNCTION_TYPE );
static final DeferredRegister< LootItemFunctionType > LOOT_FUNCTIONS = HELPER.create( LOOT_FUNCTION_REGISTRY );

// Entities
public static final RegistryObject< EntityType< CreeperlingEntity > > CREEPERLING = ENTITY_TYPES.register( "creeperling", CreeperlingEntity.createSupplier() );
Expand Down Expand Up @@ -136,7 +141,7 @@ public class Registries {
static Supplier< SpawnEggItem > createEggSupplier( Supplier< ? extends EntityType< ? extends Mob > > type,
int backgroundColor, int highlightColor
) {
return ()->new ForgeSpawnEggItem( type, backgroundColor, highlightColor, new Item.Properties() );
return ()->new ForgeSpawnEggItem( type, backgroundColor, highlightColor, new Item.Properties().tab( ITEM_GROUP ) );
}

// Fake items (just to display icons etc.)
Expand All @@ -162,6 +167,7 @@ static Supplier< SpawnEggItem > createEggSupplier( Supplier< ? extends EntityTyp

// Misc
static final List< Command > COMMANDS;
public static final CreativeModeTab ITEM_GROUP = CreativeModeTabHelper.newTab( "majruszsdifficulty.primary", BATTLE_STANDARD );
public static UndeadArmyManager UNDEAD_ARMY_MANAGER;
public static GameDataSaver GAME_DATA_SAVER;

Expand All @@ -177,7 +183,7 @@ static Supplier< SpawnEggItem > createEggSupplier( Supplier< ? extends EntityTyp
public static final RegistryObject< SoundEvent > UNDEAD_ARMY_WAVE_STARTED = register( "undead_army.wave_started" );

static RegistryObject< SoundEvent > register( String name ) {
return SOUNDS_EVENTS.register( name, ()->SoundEvent.createVariableRangeEvent( getLocation( name ) ) );
return SOUNDS_EVENTS.register( name, ()->new SoundEvent( getLocation( name ) ) );
}

// Loot Functions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private void spawnCreeperlings( OnExplosion.Data data ) {
for( int i = 0; i < creeperlingsAmount; ++i ) {
BlockPos position = creeper.blockPosition().offset( Random.getRandomVector3i( -2, 2, -1, 1, -2, 2 ) );
CreeperlingEntity creeperling = Registries.CREEPERLING.get()
.spawn( level, ( CompoundTag )null, null, position, MobSpawnType.SPAWNER, true, true );
.spawn( level, ( CompoundTag )null, null, null, position, MobSpawnType.SPAWNER, true, true );
if( creeperling != null )
creeperling.setTarget( creeper.getTarget() );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private void spawnZombie( OnDeath.Data data ) {
assert data.level != null;
Player player = ( Player )data.target;
EntityType< ? extends Zombie > zombieType = getZombieType( data.attacker );
Zombie zombie = ( Zombie )zombieType.spawn( data.level, ( CompoundTag )null, null, player.blockPosition(), MobSpawnType.EVENT, true, true );
Zombie zombie = ( Zombie )zombieType.spawn( data.level, ( CompoundTag )null, null, null, player.blockPosition(), MobSpawnType.EVENT, true, true );
if( zombie == null )
return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private void spawnWitherSkeleton( OnDeath.Data data ) {
ParticleHandler.SOUL.spawn( data.level, position, 100, ParticleHandler.offset( 1.0f ) );
}
if( slider.isFinished() ) {
EntityType.WITHER_SKELETON.spawn( data.level, ( CompoundTag )null, null, new BlockPos( data.target.position() ), MobSpawnType.EVENT, true, true );
EntityType.WITHER_SKELETON.spawn( data.level, ( CompoundTag )null, null, null, new BlockPos( data.target.position() ), MobSpawnType.EVENT, true, true );
}
} );
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.majruszsdifficulty.items;

import com.majruszsdifficulty.Registries;
import com.mlib.Utility;
import com.mlib.items.ItemHelper;
import com.mlib.mobeffects.MobEffectHelper;
Expand All @@ -24,7 +25,7 @@ public class BadOmenPotionItem extends Item {
static final String TOOLTIP_ID = "item.majruszsdifficulty.bad_omen_potion.effect";

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

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class BandageItem extends Item {
static final String TOOLTIP_ID = "item.majruszsdifficulty.bandage.effect";

public BandageItem( Rarity rarity ) {
super( new Properties().stacksTo( 16 ).rarity( rarity ) );
super( new Properties().tab( Registries.ITEM_GROUP ).stacksTo( 16 ).rarity( rarity ) );
}

public BandageItem() {
Expand Down
22 changes: 21 additions & 1 deletion src/main/java/com/majruszsdifficulty/items/ClothItem.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
package com.majruszsdifficulty.items;

import com.majruszsdifficulty.Registries;
import net.minecraft.core.NonNullList;
import net.minecraft.util.Mth;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;

import java.util.stream.Stream;

/** Cloth required to make Undead Army Battle Standard. */
public class ClothItem extends Item {
public ClothItem() {
super( new Properties() );
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 @@ -6,6 +6,6 @@

public class EndShardItem extends Item {
public EndShardItem() {
super( new Properties().rarity( Rarity.UNCOMMON ) );
super( new Properties().tab( Registries.ITEM_GROUP ).rarity( Rarity.UNCOMMON ) );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class EndShardLocatorItem extends Item {
private static final float INVALID_DISTANCE = 9001.0f;

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

@OnlyIn( Dist.CLIENT )
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.majruszsdifficulty.items;

import com.majruszsdifficulty.Registries;
import com.mlib.effects.SoundHandler;
import com.mlib.gamemodifiers.contexts.OnPlayerInteract;
import net.minecraft.stats.Stats;
Expand All @@ -11,7 +12,7 @@

public class EnderPouchItem extends Item {
public EnderPouchItem() {
super( new Properties().stacksTo( 1 ).rarity( Rarity.UNCOMMON ) );
super( new Properties().tab( Registries.ITEM_GROUP ).stacksTo( 1 ).rarity( Rarity.UNCOMMON ) );

new OnPlayerInteract.Context( this::openEnderChest )
.addCondition( data->data.itemStack.getItem() instanceof EnderPouchItem );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
public class EnderiumArmorItem extends ArmorItem {
public EnderiumArmorItem( EquipmentSlot slot ) {
super( CustomArmorMaterial.END, slot, new Item.Properties()
.tab( Registries.ITEM_GROUP )
.rarity( Rarity.UNCOMMON )
.fireResistant() );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

public class EnderiumAxeItem extends AxeItem {
public EnderiumAxeItem() {
super( CustomItemTier.END, 6.0f, -3.1f, new Properties().rarity( Rarity.UNCOMMON ).fireResistant() );
super( CustomItemTier.END, 6.0f, -3.1f, new Properties().tab( Registries.ITEM_GROUP ).rarity( Rarity.UNCOMMON ).fireResistant() );
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.majruszsdifficulty.items;

import com.majruszsdifficulty.Registries;
import com.mlib.annotations.AutoInstance;
import com.mlib.gamemodifiers.contexts.OnFarmlandTillCheck;
import com.mlib.gamemodifiers.contexts.OnItemAttributeTooltip;
Expand All @@ -11,7 +12,7 @@

public class EnderiumHoeItem extends HoeItem {
public EnderiumHoeItem() {
super( CustomItemTier.END, -5, 0.0f, new Properties().rarity( Rarity.UNCOMMON ).fireResistant() );
super( CustomItemTier.END, -5, 0.0f, new Properties().tab( Registries.ITEM_GROUP ).rarity( Rarity.UNCOMMON ).fireResistant() );
}

@AutoInstance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

public class EnderiumIngotItem extends Item {
public EnderiumIngotItem() {
super( new Properties().rarity( Rarity.UNCOMMON ) );
super( new Properties().tab( Registries.ITEM_GROUP ).rarity( Rarity.UNCOMMON ) );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

public class EnderiumPickaxeItem extends PickaxeItem {
public EnderiumPickaxeItem() {
super( CustomItemTier.END, 1, -2.8f, new Properties().rarity( Rarity.UNCOMMON ).fireResistant() );
super( CustomItemTier.END, 1, -2.8f, new Properties().tab( Registries.ITEM_GROUP ).rarity( Rarity.UNCOMMON ).fireResistant() );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

public class EnderiumShovelItem extends ShovelItem {
public EnderiumShovelItem() {
super( CustomItemTier.END, 1.5f, -3.0f, new Properties().rarity( Rarity.UNCOMMON ).fireResistant() );
super( CustomItemTier.END, 1.5f, -3.0f, new Properties().tab( Registries.ITEM_GROUP ).rarity( Rarity.UNCOMMON ).fireResistant() );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

public class EnderiumSwordItem extends SwordItem {
public EnderiumSwordItem() {
super( CustomItemTier.END, 4, -2.6f, new Properties().rarity( Rarity.UNCOMMON ).fireResistant() );
super( CustomItemTier.END, 4, -2.6f, new Properties().tab( Registries.ITEM_GROUP ).rarity( Rarity.UNCOMMON ).fireResistant() );
}
}
Loading

0 comments on commit 53a0f05

Please sign in to comment.