Skip to content

Commit

Permalink
Update to 1.19.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Dariensg committed Jun 12, 2023
1 parent 3ae7409 commit 0e884e2
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 28 deletions.
6 changes: 3 additions & 3 deletions build.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
VERSION=1.5.1
MINECRAFT_VERSION=1.19
FORGE_VERSION=41.1.0
MINECRAFT_VERSION=1.19.4
FORGE_VERSION=45.1.0
MAPPINGS_CHANNEL=official
MAPPINGS_VERSION=1.19
MAPPINGS_VERSION=1.19.4

# Do not edit anything below this line, it contains base information for the project.
GROUP=org.infernalstudios
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.infernalstudios.secondchanceforge;

import net.minecraft.tags.DamageTypeTags;
import org.infernalstudios.secondchanceforge.config.SecondChanceConfig;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
Expand Down Expand Up @@ -33,14 +34,14 @@ public void onEntityDamage(LivingDamageEvent event) {
}

private boolean canActivateSecondChance(DamageSource source) {
boolean activateForExplosion = SecondChanceConfig.CONFIG.secondChanceExplosions.get() && source.isExplosion();
boolean activateForExplosion = SecondChanceConfig.CONFIG.secondChanceExplosions.get() && source.is(DamageTypeTags.IS_EXPLOSION);
boolean activateForMob = SecondChanceConfig.CONFIG.secondChanceMobs.get() && source.getMsgId().equals("mob");
boolean activateForFallDamage = SecondChanceConfig.CONFIG.secondChanceFalls.get() && source.getMsgId().equals("fall");
boolean activateForAnvil = SecondChanceConfig.CONFIG.secondChanceAnvils.get() && source.getMsgId().equals("anvil");
boolean activateForLightning = SecondChanceConfig.CONFIG.secondChanceLightning.get() && source.getMsgId().equals("lightningBolt");
boolean activateForLightning = SecondChanceConfig.CONFIG.secondChanceLightning.get() && source.is(DamageTypeTags.IS_LIGHTNING);
boolean activateForElytraCrash = SecondChanceConfig.CONFIG.secondChanceElytraCrash.get() && source.getMsgId().equals("flyIntoWall");
boolean activateForFallingBlocks = SecondChanceConfig.CONFIG.secondChanceFallingBlocks.get() && source.getMsgId().equals("fallingBlock");
boolean activateForMagic = SecondChanceConfig.CONFIG.secondChanceMagic.get() && source.isMagic();
boolean activateForMagic = SecondChanceConfig.CONFIG.secondChanceMagic.get() && (source.getMsgId().equals("magic") || source.getMsgId().equals("indirect_magic"));
boolean activateForPlayer = SecondChanceConfig.CONFIG.secondChancePlayers.get() && source.getMsgId().equals("player");
boolean activateForTrident = SecondChanceConfig.CONFIG.secondChanceTridents.get() && source.getMsgId().equals("trident");
boolean activateForArrow = SecondChanceConfig.CONFIG.secondChanceArrows.get() && source.getMsgId().equals("arrow");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class SecondChanceSoundEvents {

public static final RegistryObject<SoundEvent> add(String id) {
ResourceLocation realId = new ResourceLocation(SecondChanceForge.MOD_ID, id);
return SOUND_EVENTS.register(id, () -> new SoundEvent(realId));
return SOUND_EVENTS.register(id, () -> SoundEvent.createVariableRangeEvent(realId));
}

public static void register(IEventBus eventBus) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,25 +186,25 @@ public void init() {
SecondChanceConfig.CONFIG.secondChanceRemainderPercent.get(), SecondChanceConfig.CONFIG.secondChanceRemainderPercent::set
));

addWidget(optionsRowList);
addRenderableWidget(optionsRowList);

addRenderableWidget(new Button((width - 200) / 2, height - 26, 200, 20, Component.translatable("gui.done"), button -> onClose()));
addRenderableWidget(Button.builder(Component.translatable("gui.done"), button -> onClose()).pos((width - 200) / 2, height - 26).size(200, 20).build());
}

@Override
public void render(PoseStack matrixStack, int mouseX, int mouseY, float partialTicks) {
renderBackground(matrixStack);

optionsRowList.render(matrixStack, mouseX, mouseY, partialTicks);

List<FormattedCharSequence> list = OptionsSubScreen.tooltipAt(optionsRowList, mouseX, mouseY);
if (list != null) {
this.renderTooltip(matrixStack, list, mouseX, mouseY);
}

// The parameter names for this function are wrong. The three integers at the end should be x, y, color
drawCenteredString(matrixStack, font, title, width / 2, 8, 0xFFFFFF);

super.render(matrixStack, mouseX, mouseY, partialTicks);
}
// @Override
// public void render(PoseStack matrixStack, int mouseX, int mouseY, float partialTicks) {
// renderBackground(matrixStack);
//
// optionsRowList.render(matrixStack, mouseX, mouseY, partialTicks);
//
// List<FormattedCharSequence> list = OptionsSubScreen.tooltipAt(optionsRowList, mouseX, mouseY);
// if (list != null) {
// this.renderTooltip(matrixStack, list, mouseX, mouseY);
// }
//
// // The parameter names for this function are wrong. The three integers at the end should be x, y, color
// drawCenteredString(matrixStack, font, title, width / 2, 8, 0xFFFFFF);
//
// super.render(matrixStack, mouseX, mouseY, partialTicks);
// }
}
6 changes: 3 additions & 3 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
modLoader="javafml" #mandatory

# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
loaderVersion="[41,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
loaderVersion="[45,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.

license="MIT"

Expand Down Expand Up @@ -58,12 +58,12 @@ Special Thanks:
[[dependencies.secondchanceforge]]
modId="forge"
mandatory=true
versionRange="[41,)"
versionRange="[45,)"
ordering="NONE"
side="BOTH"
[[dependencies.secondchanceforge]]
modId="minecraft"
mandatory=true
versionRange="[1.19,1.20)"
versionRange="[1.19.4,1.20)"
ordering="NONE"
side="BOTH"

0 comments on commit 0e884e2

Please sign in to comment.