forked from seymourimadeit/Piglin-Proliferation
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Internal changes to how item properties are registered - Allowed users to define items for other modded ziglin variants in datamaps
- Loading branch information
1 parent
dd4c915
commit 3cdedf4
Showing
8 changed files
with
70 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
- Neoforge changes 2 electric boogalo | ||
- Enabled buckler launch by default | ||
- Internal changes to how item properties are registered | ||
- Allowed users to define items for other modded ziglin variants in datamaps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/main/java/tallestred/piglinproliferation/PiglinProliferationClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package tallestred.piglinproliferation; | ||
|
||
import net.minecraft.client.renderer.item.CompassItemPropertyFunction; | ||
import net.minecraft.client.renderer.item.ItemProperties; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.neoforged.api.distmarker.Dist; | ||
import net.neoforged.bus.api.IEventBus; | ||
import net.neoforged.fml.ModContainer; | ||
import net.neoforged.fml.common.Mod; | ||
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent; | ||
import tallestred.piglinproliferation.common.items.BucklerItem; | ||
import tallestred.piglinproliferation.common.items.PPItems; | ||
import tallestred.piglinproliferation.common.items.component.PPComponents; | ||
import tallestred.piglinproliferation.common.items.component.TravelersCompassTracker; | ||
|
||
@Mod(value = PiglinProliferation.MODID, dist = Dist.CLIENT) | ||
public class PiglinProliferationClient { | ||
public PiglinProliferationClient(IEventBus modEventBus, Dist dist, ModContainer container) { | ||
modEventBus.addListener(this::doClientStuff); | ||
} | ||
|
||
private void doClientStuff(final FMLClientSetupEvent event) { | ||
event.enqueueWork(() -> { | ||
ItemProperties.register(PPItems.BUCKLER.get(), ResourceLocation.parse("blocking"), | ||
(stack, clientWorld, livingEntity, useTime) -> { | ||
boolean active = livingEntity != null && livingEntity.isUsingItem() | ||
&& livingEntity.getUseItem() == stack | ||
|| livingEntity != null && BucklerItem.isReady(stack); | ||
return livingEntity != null && active ? 1.0F : 0.0F; | ||
}); | ||
ItemProperties.register(PPItems.TRAVELERS_COMPASS.get(), ResourceLocation.parse("angle"), new CompassItemPropertyFunction((level, itemStack, player) -> { | ||
TravelersCompassTracker tracker = itemStack.get(PPComponents.TRAVELERS_COMPASS_TRACKER); | ||
if (tracker != null) | ||
return tracker.target(); | ||
return null; //TODO not sure | ||
})); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters