Skip to content

Commit

Permalink
Merge pull request #1381 from TeamLapen/1.21_neo42
Browse files Browse the repository at this point in the history
Update to Neoforge 42
  • Loading branch information
Cheaterpaul authored Jul 8, 2024
2 parents 3443133 + daa4d72 commit ac35739
Show file tree
Hide file tree
Showing 64 changed files with 261 additions and 355 deletions.
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ org.gradle.debug=false
# forge
minecraft_version=1.21
minecraft_version_range=[1.21,1.22)
forge_version=21.0.25-beta
forge_version_range=[21.0.25-beta,)
forge_version=21.0.76-beta
forge_version_range=[21.0.76-beta,)
loader_version_range=[1,)
parchment_minecraft_version=1.20.6
parchment_mappings_version=2024.05.01
Expand Down Expand Up @@ -38,11 +38,11 @@ classification="test"
#jei setting
include_jei=true
jei_mc_version=1.21
jei_version=19.0.0.9
jei_version=19.3.1.24

#guideapi setting
include_guideapi=false
guideapi_version=1.20.6-2.3.0-beta.1
include_guideapi=true
guideapi_version=1.21-2.3.0-beta.1

#terrablender setting
include_terrablender=true
Expand Down
6 changes: 0 additions & 6 deletions src/api/java/de/teamlapen/vampirism/api/VReference.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.material.Fluid;
import net.neoforged.neoforge.common.PlantType;
import net.neoforged.neoforge.registries.DeferredHolder;

import java.util.function.Supplier;
Expand All @@ -25,11 +24,6 @@ public class VReference {
*/
public static final int FOOD_TO_FLUID_BLOOD = 100;

/**
* Plant type for plants that grow on cursed earth;
*/
public static final PlantType VAMPIRE_PLANT_TYPE = PlantType.get("vampirism_vampire");

public static final Supplier<Fluid> BLOOD = DeferredHolder.create(Registries.FLUID, VResourceLocation.mod("blood"));

/**
Expand Down
5 changes: 5 additions & 0 deletions src/generated/resources/data/c/tags/block/crops/garlic.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"vampirism:garlic"
]
}
2 changes: 1 addition & 1 deletion src/generated/resources/data/c/tags/item/crops/garlic.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"values": [
"vampirism:item_garlic"
"vampirism:garlic"
]
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"values": {
"vampirism:item_garlic": {
"vampirism:garlic": {
"chance": 0.65
},
"vampirism:vampire_orchid": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"icon": {
"count": 1,
"id": "vampirism:item_garlic"
"id": "vampirism:garlic"
},
"title": {
"translate": "advancement.vampirism.become_hunter"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"hidden": true,
"icon": {
"count": 1,
"id": "vampirism:item_garlic"
"id": "vampirism:garlic"
},
"title": {
"translate": "advancement.vampirism.max_level_hunter"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"conditions": {
"items": [
{
"items": "vampirism:item_garlic"
"items": "vampirism:garlic"
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"entries": [
{
"type": "minecraft:item",
"name": "vampirism:item_garlic"
"name": "vampirism:garlic"
}
],
"rolls": 1.0
Expand Down Expand Up @@ -41,7 +41,7 @@
}
}
],
"name": "vampirism:item_garlic"
"name": "vampirism:garlic"
}
],
"rolls": 1.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
},
{
"type": "minecraft:item",
"name": "vampirism:item_garlic",
"name": "vampirism:garlic",
"weight": 5
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
},
{
"type": "minecraft:item",
"name": "vampirism:item_garlic",
"name": "vampirism:garlic",
"weight": 20
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
},
{
"type": "minecraft:item",
"name": "vampirism:item_garlic",
"name": "vampirism:garlic",
"weight": 20
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
{
"type": "minecraft:item",
"name": "vampirism:item_garlic",
"name": "vampirism:garlic",
"weight": 40
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"function": "minecraft:enchanted_count_increase"
}
],
"name": "vampirism:item_garlic",
"name": "vampirism:garlic",
"weight": 4
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"function": "minecraft:enchanted_count_increase"
}
],
"name": "vampirism:item_garlic",
"name": "vampirism:garlic",
"weight": 4
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
{
"type": "minecraft:item",
"name": "vampirism:item_garlic",
"name": "vampirism:garlic",
"weight": 20
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"entries": [
{
"type": "minecraft:item",
"name": "vampirism:item_garlic",
"name": "vampirism:garlic",
"weight": 15
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"entries": [
{
"type": "minecraft:item",
"name": "vampirism:item_garlic",
"name": "vampirism:garlic",
"weight": 20
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"entries": [
{
"type": "minecraft:item",
"name": "vampirism:item_garlic",
"name": "vampirism:garlic",
"weight": 50
},
{
Expand Down
4 changes: 2 additions & 2 deletions src/lib/java/de/teamlapen/lib/entity/EntityEventHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.neoforge.attachment.AttachmentType;
import net.neoforged.neoforge.event.entity.EntityJoinLevelEvent;
import net.neoforged.neoforge.event.entity.living.LivingAttackEvent;
import net.neoforged.neoforge.event.entity.living.LivingDeathEvent;
import net.neoforged.neoforge.event.entity.living.LivingIncomingDamageEvent;
import net.neoforged.neoforge.event.entity.player.PlayerEvent;
import net.neoforged.neoforge.event.tick.EntityTickEvent;
import net.neoforged.neoforge.event.tick.PlayerTickEvent;
Expand Down Expand Up @@ -48,7 +48,7 @@ public void onEntityJoinWorld(@NotNull EntityJoinLevelEvent event) {
}

@SubscribeEvent
public void onLivingAttack(@NotNull LivingAttackEvent event) {
public void onLivingAttack(@NotNull LivingIncomingDamageEvent event) {
if (event.getEntity() instanceof Player) {
for (AttachmentType<IPlayerEventListener> listener : listeners) {
boolean cancel = Optional.ofNullable(event.getEntity().getData(listener)).map(cap -> cap.onEntityAttacked(event.getSource(), event.getAmount())).orElse(false);
Expand Down
6 changes: 0 additions & 6 deletions src/main/java/de/teamlapen/vampirism/VampirismMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import de.teamlapen.lib.lib.storage.IAttachedSyncable;
import de.teamlapen.lib.lib.util.IInitListener;
import de.teamlapen.lib.util.Color;
import de.teamlapen.lib.util.OptifineHandler;
import de.teamlapen.vampirism.api.VReference;
import de.teamlapen.vampirism.api.VampirismAPI;
import de.teamlapen.vampirism.api.VampirismRegistries;
Expand Down Expand Up @@ -51,7 +50,6 @@
import de.teamlapen.vampirism.mixin.accessor.ReloadableServerResourcesAccessor;
import de.teamlapen.vampirism.mixin.accessor.TagManagerAccessor;
import de.teamlapen.vampirism.modcompat.IMCHandler;
//import de.teamlapen.vampirism.modcompat.TerraBlenderCompat;
import de.teamlapen.vampirism.modcompat.TerraBlenderCompat;
import de.teamlapen.vampirism.network.ModPacketDispatcher;
import de.teamlapen.vampirism.proxy.IProxy;
Expand All @@ -65,7 +63,6 @@
import net.minecraft.ChatFormatting;
import net.minecraft.core.Direction;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.crafting.ShapedRecipePattern;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.IEventBus;
Expand All @@ -85,8 +82,6 @@
import net.neoforged.neoforge.items.IItemHandler;
import net.neoforged.neoforge.items.wrapper.InvWrapper;
import net.neoforged.neoforge.registries.NewRegistryEvent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

Expand Down Expand Up @@ -305,7 +300,6 @@ private void setup(final @NotNull FMLCommonSetupEvent event) {
event.enqueueWork(ModStats::registerFormatter);
event.enqueueWork(CodecModifications::changeMobEffectCodec);
event.enqueueWork(ModVillage::villagerTradeSetup);
event.enqueueWork(ModTiles::registerTileExtensionsUnsafe);
event.enqueueWork(ModItems::registerDispenserBehaviourUnsafe);
TelemetryCollector.execute();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public void loadAdditional(@NotNull CompoundTag compound, HolderLookup.Provider
super.loadAdditional(compound, provider);
this.color = compound.contains("color") ? DyeColor.byId(compound.getInt("color")) : DyeColor.BLACK;
this.lidPos = compound.getFloat("lidPos");
this.playLidSoundFlag = this.lidPos==0;
}

@Override
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/de/teamlapen/vampirism/blocks/CursedGrass.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,9 @@
import net.minecraft.world.level.levelgen.feature.configurations.RandomPatchConfiguration;
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
import net.minecraft.world.phys.BlockHitResult;
import net.neoforged.neoforge.common.IPlantable;
import net.neoforged.neoforge.common.PlantType;
import net.neoforged.neoforge.common.ToolAction;
import net.neoforged.neoforge.common.ToolActions;
import net.neoforged.neoforge.common.ItemAbilities;
import net.neoforged.neoforge.common.ItemAbility;
import net.neoforged.neoforge.common.util.TriState;
import org.jetbrains.annotations.NotNull;

import javax.annotation.Nullable;
Expand Down Expand Up @@ -81,10 +80,11 @@ public void randomTick(@NotNull BlockState p_222508_, @NotNull ServerLevel p_222
}

@Override
public boolean canSustainPlant(@NotNull BlockState state, @NotNull BlockGetter world, @NotNull BlockPos pos, @NotNull Direction direction, @NotNull IPlantable plantable) {
return plantable.getPlantType(world, pos) == PlantType.PLAINS || plantable instanceof BushBlock || plantable.getPlantType(world, pos).equals(VReference.VAMPIRE_PLANT_TYPE);
public TriState canSustainPlant(BlockState state, BlockGetter level, BlockPos soilPosition, Direction facing, BlockState plant) {
return super.canSustainPlant(state, level, soilPosition, facing, plant);
}


@Override
public boolean isValidBonemealTarget(@NotNull LevelReader level, @NotNull BlockPos pPos, @NotNull BlockState pState) {
return true;
Expand Down Expand Up @@ -165,7 +165,7 @@ public void onHolyWaterEffect(Level level, BlockState state, BlockPos pos, ItemS
}

@Override
public @Nullable BlockState getToolModifiedState(BlockState state, UseOnContext context, ToolAction toolAction, boolean simulate) {
return toolAction == ToolActions.SHOVEL_FLATTEN ? ModBlocks.CURSED_EARTH_PATH.get().defaultBlockState() : super.getToolModifiedState(state, context, toolAction, simulate);
public @Nullable BlockState getToolModifiedState(BlockState state, UseOnContext context, ItemAbility toolAction, boolean simulate) {
return toolAction == ItemAbilities.SHOVEL_FLATTEN ? ModBlocks.CURSED_EARTH_PATH.get().defaultBlockState() : super.getToolModifiedState(state, context, toolAction, simulate);
}
}
3 changes: 2 additions & 1 deletion src/main/java/de/teamlapen/vampirism/blocks/GarlicBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import de.teamlapen.vampirism.api.EnumStrength;
import de.teamlapen.vampirism.api.VReference;
import de.teamlapen.vampirism.api.entity.vampire.IVampire;
import de.teamlapen.vampirism.core.ModBlocks;
import de.teamlapen.vampirism.core.ModItems;
import de.teamlapen.vampirism.util.DamageHandler;
import de.teamlapen.vampirism.util.Helper;
Expand Down Expand Up @@ -70,6 +71,6 @@ public VoxelShape getShape(@NotNull BlockState state, @NotNull BlockGetter world
@NotNull
@Override
protected ItemLike getBaseSeedId() {
return ModItems.ITEM_GARLIC.get();
return ModBlocks.GARLIC;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.MapColor;
import net.neoforged.neoforge.common.ToolAction;
import net.neoforged.neoforge.common.ToolActions;
import net.neoforged.neoforge.common.ItemAbilities;
import net.neoforged.neoforge.common.ItemAbility;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

Expand All @@ -29,8 +29,8 @@ public StrippableLogBlock(MapColor color1, MapColor color2, @NotNull Supplier<?
}

@Override
public @Nullable BlockState getToolModifiedState(BlockState state, UseOnContext context, ToolAction toolAction, boolean simulate) {
if (toolAction == ToolActions.AXE_STRIP) {
public @Nullable BlockState getToolModifiedState(BlockState state, UseOnContext context, ItemAbility toolAction, boolean simulate) {
if (toolAction == ItemAbilities.AXE_STRIP) {
return getStrippedState(state, context.getLevel(), context.getClickedPos());
}
return super.getToolModifiedState(state, context, toolAction, simulate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import de.teamlapen.vampirism.client.gui.overlay.*;
import de.teamlapen.vampirism.client.renderer.RenderHandler;
import de.teamlapen.vampirism.client.renderer.VampirismClientEntityRegistry;
import de.teamlapen.vampirism.core.ModRecipes;
import de.teamlapen.vampirism.proxy.ClientProxy;
import de.teamlapen.vampirism.proxy.IProxy;
import net.minecraft.client.Minecraft;
Expand All @@ -23,7 +22,6 @@
import net.neoforged.fml.ModContainer;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent;
import net.neoforged.neoforge.common.NeoForge;
import net.neoforged.neoforge.event.AddReloadListenerEvent;
import net.neoforged.neoforge.registries.datamaps.DataMapsUpdatedEvent;
Expand All @@ -49,6 +47,7 @@ public VampirismModClient(IEventBus modEventBus, ModContainer modContainer) {
ClientRegistryHandler.init(modEventBus);
this.overlay = new VampirismHUDOverlay(Minecraft.getInstance());
this.renderHandler = new RenderHandler(Minecraft.getInstance());
this.modEventBus.register(this);

NeoForge.EVENT_BUS.addListener(this::onAddReloadListenerEvent);
NeoForge.EVENT_BUS.addListener(this::onDataMapsUpdated);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package de.teamlapen.vampirism.client.gui.components;

import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.Button;
Expand All @@ -17,10 +18,13 @@ public CooldownButton(int x, int y, int width, int height, @NotNull Component ti
@Override
public void renderWidget(@NotNull GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) {
Minecraft minecraft = Minecraft.getInstance();
guiGraphics.blitWithBorder(SPRITES.get(false, false), this.getX(), this.getY(), 0, 0, this.width, this.height, 200, 20, 3);
int width = (int) ((1f - progress) * this.width);
int s = Mth.clamp(width / 2, 0, 3);
guiGraphics.blitWithBorder(SPRITES.get(this.active, this.isHovered), this.getX(), this.getY(), 0, 0, width, this.height, 200, 20, s);
guiGraphics.setColor(1.0F, 1.0F, 1.0F, this.alpha);
RenderSystem.enableBlend();
RenderSystem.enableDepthTest();
guiGraphics.blitSprite(SPRITES.get(this.active, this.isHoveredOrFocused()), this.getX(), this.getY(), this.getWidth(), this.getHeight());
int width = (int) ((1f - this.progress) * this.getWidth());
guiGraphics.blitSprite(SPRITES.get(true, this.isHoveredOrFocused() && progress == 0f), this.getX(), this.getY(), width, this.getHeight());
guiGraphics.setColor(1.0F, 1.0F, 1.0F, 1.0F);
int i = getFGColor();
this.renderString(guiGraphics, minecraft.font, i | Mth.ceil(this.alpha * 255.0F) << 24);
}
Expand Down
Loading

0 comments on commit ac35739

Please sign in to comment.