|
2 | 2 |
|
3 | 3 | import net.infstudio.goki.GokiStats; |
4 | 4 | import net.infstudio.goki.common.config.GokiConfig; |
| 5 | +import net.infstudio.goki.common.init.GokiSounds; |
| 6 | +import net.infstudio.goki.common.init.MinecraftEffects; |
5 | 7 | import net.infstudio.goki.common.network.packet.PacketStatAlter; |
6 | 8 | 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; |
10 | 9 | import net.infstudio.goki.common.stats.StatBase; |
11 | | -import net.infstudio.goki.common.stats.tool.StatMiningMagician; |
| 10 | +import net.infstudio.goki.common.stats.StatSpecial; |
12 | 11 | 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; |
14 | 15 | import net.minecraft.block.Block; |
15 | 16 | import net.minecraft.entity.Entity; |
16 | 17 | import net.minecraft.entity.EntityLivingBase; |
17 | 18 | import net.minecraft.entity.player.EntityPlayer; |
18 | 19 | import net.minecraft.entity.player.EntityPlayerMP; |
19 | 20 | import net.minecraft.item.ItemBlock; |
20 | 21 | import net.minecraft.item.ItemStack; |
21 | | -import net.minecraft.potion.Potion; |
22 | 22 | import net.minecraft.potion.PotionEffect; |
23 | 23 | import net.minecraft.util.DamageSource; |
24 | 24 | import net.minecraft.util.ResourceLocation; |
25 | 25 | import net.minecraft.util.SoundCategory; |
26 | | -import net.minecraft.util.SoundEvent; |
27 | 26 | import net.minecraft.util.text.TextComponentTranslation; |
28 | | -import net.minecraftforge.event.RegistryEvent; |
29 | 27 | import net.minecraftforge.event.entity.EntityJoinWorldEvent; |
30 | 28 | import net.minecraftforge.event.entity.living.*; |
31 | 29 | import net.minecraftforge.event.entity.player.PlayerEvent; |
32 | 30 | import net.minecraftforge.event.world.BlockEvent; |
33 | | -import net.minecraftforge.fml.common.Mod; |
34 | 31 | import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; |
35 | 32 | import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerRespawnEvent; |
36 | 33 | import net.minecraftforge.fml.common.registry.ForgeRegistries; |
|
41 | 38 |
|
42 | 39 | @GameRegistry.ObjectHolder("gokistats") |
43 | 40 | 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 | | - |
57 | 41 | @SubscribeEvent |
58 | 42 | public void harvestBlock(BlockEvent.HarvestDropsEvent event) { |
59 | 43 | EntityPlayer player = event.getHarvester(); |
@@ -84,7 +68,7 @@ public void harvestBlock(BlockEvent.HarvestDropsEvent event) { |
84 | 68 | } |
85 | 69 | } |
86 | 70 | 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); |
88 | 72 | } |
89 | 73 | } |
90 | 74 |
|
@@ -122,7 +106,7 @@ public void harvestBlock(BlockEvent.HarvestDropsEvent event) { |
122 | 106 | } |
123 | 107 | } |
124 | 108 | 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); |
126 | 110 | } |
127 | 111 | } |
128 | 112 | } |
@@ -243,12 +227,12 @@ public void entityHurt(LivingHurtEvent event) { |
243 | 227 | EntityPlayer player = (EntityPlayer) victim; |
244 | 228 |
|
245 | 229 | 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)) { |
247 | 231 | // Avoid damage |
248 | 232 | event.setCanceled(true); |
249 | 233 |
|
250 | 234 | player.addPotionEffect( |
251 | | - new PotionEffect(Potion.getPotionFromResourceLocation("minecraft:strength"), 20, 2) |
| 235 | + new PotionEffect(MinecraftEffects.STRENGTH, 20, 2) |
252 | 236 | ); |
253 | 237 |
|
254 | 238 | victim.addTag("knockback"); |
@@ -295,7 +279,7 @@ public void entityHurt(LivingHurtEvent event) { |
295 | 279 | float reapChance = reap + reapBonus; |
296 | 280 | if (player.getRNG().nextFloat() <= reapChance) { |
297 | 281 | 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); |
299 | 283 | event.setAmount(100000.0F); |
300 | 284 | } |
301 | 285 | } |
|
0 commit comments