Skip to content

Commit b680156

Browse files
committed
Fixed #14
Upgrade gradle to 4.8
1 parent 967d02c commit b680156

7 files changed

Lines changed: 47 additions & 32 deletions

File tree

gradle/wrapper/gradle-wrapper.jar

-4 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

src/main/java/net/infstudio/goki/GokiStats.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
import net.infstudio.goki.common.config.ConfigManager;
66
import net.infstudio.goki.common.config.Configurable;
77
import net.infstudio.goki.common.config.GokiConfig;
8-
import net.infstudio.goki.common.handlers.CommonHandler;
9-
import net.infstudio.goki.common.handlers.GokiKeyHandler;
10-
import net.infstudio.goki.common.handlers.TickHandler;
8+
import net.infstudio.goki.common.init.MinecraftEffects;
119
import net.infstudio.goki.common.network.packet.*;
1210
import net.infstudio.goki.common.stats.StatBase;
1311
import net.infstudio.goki.common.stats.Stats;
@@ -35,7 +33,7 @@ public class GokiStats {
3533
public static CommonProxy proxy;
3634

3735
private static Class<?>[] loadClasses = {
38-
Stats.class, CommonHandler.class, GokiKeyHandler.class, TickHandler.class
36+
Stats.class, MinecraftEffects.class
3937
};
4038

4139
@Mod.EventHandler

src/main/java/net/infstudio/goki/common/CommonProxy.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public void registerKeybinding() {
1212
}
1313

1414
public void registerHandlers() {
15+
MinecraftForge.EVENT_BUS.register(new GokiStats());
1516
MinecraftForge.EVENT_BUS.register(new CommonHandler());
1617
MinecraftForge.EVENT_BUS.register(new TickHandler());
1718

src/main/java/net/infstudio/goki/common/handlers/CommonHandler.java

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,32 @@
22

33
import net.infstudio.goki.GokiStats;
44
import net.infstudio.goki.common.config.GokiConfig;
5+
import net.infstudio.goki.common.init.GokiSounds;
6+
import net.infstudio.goki.common.init.MinecraftEffects;
57
import net.infstudio.goki.common.network.packet.PacketStatAlter;
68
import net.infstudio.goki.common.network.packet.PacketSyncStatConfig;
7-
import net.infstudio.goki.common.utils.DataHelper;
8-
import net.infstudio.goki.common.stats.tool.IDMDTuple;
9-
import net.infstudio.goki.common.stats.StatSpecial;
109
import net.infstudio.goki.common.stats.StatBase;
11-
import net.infstudio.goki.common.stats.tool.StatMiningMagician;
10+
import net.infstudio.goki.common.stats.StatSpecial;
1211
import net.infstudio.goki.common.stats.Stats;
13-
import net.infstudio.goki.common.utils.Reference;
12+
import net.infstudio.goki.common.stats.tool.IDMDTuple;
13+
import net.infstudio.goki.common.stats.tool.StatMiningMagician;
14+
import net.infstudio.goki.common.utils.DataHelper;
1415
import net.minecraft.block.Block;
1516
import net.minecraft.entity.Entity;
1617
import net.minecraft.entity.EntityLivingBase;
1718
import net.minecraft.entity.player.EntityPlayer;
1819
import net.minecraft.entity.player.EntityPlayerMP;
1920
import net.minecraft.item.ItemBlock;
2021
import net.minecraft.item.ItemStack;
21-
import net.minecraft.potion.Potion;
2222
import net.minecraft.potion.PotionEffect;
2323
import net.minecraft.util.DamageSource;
2424
import net.minecraft.util.ResourceLocation;
2525
import net.minecraft.util.SoundCategory;
26-
import net.minecraft.util.SoundEvent;
2726
import net.minecraft.util.text.TextComponentTranslation;
28-
import net.minecraftforge.event.RegistryEvent;
2927
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
3028
import net.minecraftforge.event.entity.living.*;
3129
import net.minecraftforge.event.entity.player.PlayerEvent;
3230
import net.minecraftforge.event.world.BlockEvent;
33-
import net.minecraftforge.fml.common.Mod;
3431
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
3532
import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerRespawnEvent;
3633
import net.minecraftforge.fml.common.registry.ForgeRegistries;
@@ -41,19 +38,6 @@
4138

4239
@GameRegistry.ObjectHolder("gokistats")
4340
public class CommonHandler {
44-
public static final SoundEvent TREASURE = null;
45-
public static final SoundEvent MAGICIAN = null;
46-
public static final SoundEvent REAPER = null;
47-
48-
@SubscribeEvent
49-
public void registerSounds(RegistryEvent.Register<SoundEvent> event) {
50-
event.getRegistry().registerAll(
51-
new SoundEvent(new ResourceLocation("gokistats:treasure")),
52-
new SoundEvent(new ResourceLocation("gokistats:magician")),
53-
new SoundEvent(new ResourceLocation("gokistats:reaper"))
54-
);
55-
}
56-
5741
@SubscribeEvent
5842
public void harvestBlock(BlockEvent.HarvestDropsEvent event) {
5943
EntityPlayer player = event.getHarvester();
@@ -84,7 +68,7 @@ public void harvestBlock(BlockEvent.HarvestDropsEvent event) {
8468
}
8569
}
8670
if (treasureFound) {
87-
player.world.playSound(player, event.getPos(), TREASURE, SoundCategory.BLOCKS, 1.0F, 1.0F);
71+
player.world.playSound(player, event.getPos(), GokiSounds.TREASURE, SoundCategory.BLOCKS, 1.0F, 1.0F);
8872
}
8973
}
9074

@@ -122,7 +106,7 @@ public void harvestBlock(BlockEvent.HarvestDropsEvent event) {
122106
}
123107
}
124108
if (magicHappened) {
125-
player.world.playSound(player, event.getPos(), MAGICIAN, SoundCategory.BLOCKS, 0.3f, 1.0f);
109+
player.world.playSound(player, event.getPos(), GokiSounds.MAGICIAN, SoundCategory.BLOCKS, 0.3f, 1.0f);
126110
}
127111
}
128112
}
@@ -243,12 +227,12 @@ public void entityHurt(LivingHurtEvent event) {
243227
EntityPlayer player = (EntityPlayer) victim;
244228

245229
if (!source.isFireDamage() && !source.isDamageAbsolute()) {
246-
if (player.getEntityWorld().rand.nextFloat() <= Stats.ROLL.getBonus(player)) {
230+
if (player.getEntityWorld().rand.nextFloat() >= 1.0f - Stats.ROLL.getBonus(player)) {
247231
// Avoid damage
248232
event.setCanceled(true);
249233

250234
player.addPotionEffect(
251-
new PotionEffect(Potion.getPotionFromResourceLocation("minecraft:strength"), 20, 2)
235+
new PotionEffect(MinecraftEffects.STRENGTH, 20, 2)
252236
);
253237

254238
victim.addTag("knockback");
@@ -295,7 +279,7 @@ public void entityHurt(LivingHurtEvent event) {
295279
float reapChance = reap + reapBonus;
296280
if (player.getRNG().nextFloat() <= reapChance) {
297281
player.onEnchantmentCritical(victim);
298-
player.world.playSound(player, event.getEntity().getPosition(), REAPER, SoundCategory.MASTER, 1.0f, 1.0f);
282+
player.world.playSound(player, event.getEntity().getPosition(), GokiSounds.REAPER, SoundCategory.MASTER, 1.0f, 1.0f);
299283
event.setAmount(100000.0F);
300284
}
301285
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package net.infstudio.goki.common.init;
2+
3+
import net.minecraft.util.ResourceLocation;
4+
import net.minecraft.util.SoundEvent;
5+
import net.minecraftforge.event.RegistryEvent;
6+
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
7+
import net.minecraftforge.fml.common.registry.GameRegistry;
8+
9+
@GameRegistry.ObjectHolder("gokistats")
10+
public class GokiSounds {
11+
public static final SoundEvent TREASURE = null;
12+
public static final SoundEvent MAGICIAN = null;
13+
public static final SoundEvent REAPER = null;
14+
15+
@SubscribeEvent
16+
public void registerSounds(RegistryEvent.Register<SoundEvent> event) {
17+
event.getRegistry().registerAll(
18+
new SoundEvent(new ResourceLocation("gokistats:treasure")),
19+
new SoundEvent(new ResourceLocation("gokistats:magician")),
20+
new SoundEvent(new ResourceLocation("gokistats:reaper"))
21+
);
22+
}
23+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package net.infstudio.goki.common.init;
2+
3+
import net.minecraft.potion.Potion;
4+
import net.minecraftforge.fml.common.registry.GameRegistry;
5+
6+
@GameRegistry.ObjectHolder("minecraft")
7+
public interface MinecraftEffects {
8+
Potion STRENGTH = null;
9+
}

0 commit comments

Comments
 (0)