Skip to content

Commit

Permalink
Merge pull request #1 from Bigjango13/7.2
Browse files Browse the repository at this point in the history
Update to 7.2pr2 and bugfixes
  • Loading branch information
kleiders3010 authored Jul 1, 2024
2 parents 9c9a4ac + b6d9b61 commit ee884f3
Show file tree
Hide file tree
Showing 18 changed files with 74 additions and 56 deletions.
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
org.gradle.jvmargs=-Xmx2G

# BTA
bta_version=7.2-pre1
bta_version=7.2-pre2

# Loader & Mod Menu
loader_version=0.15.6-babric.6-bta
mod_menu_version=2.0.6

# HalpLibe
halplibe_version=4.0.6
halplibe_version=4.1.3

# Mod
mod_version=1.5.1
Expand Down
10 changes: 3 additions & 7 deletions src/main/java/kleiders/jurisretro/JurisRetroMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,25 @@


public class JurisRetroMod implements ModInitializer, GameStartEntrypoint, RecipeEntrypoint {
public static final String MOD_ID = "juris_retro";
public static final String MOD_ID = "jurisretro";
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
@Override
public void onInitialize() {
LOGGER.info(MOD_ID + "initialized.");
}




@Override
public void beforeGameStart() {
new JurisRetroModItems().initializeItems();
PacketChangeData.addIdClassMapping(216, true, false, PacketChangeData.class);
PacketChangeData.addIdClassMapping(217, true, false, PacketRideEntity.class);
PacketChangeSize.addIdClassMapping(218, true, false, PacketChangeSize.class);
new JurisRetroModItems().initializeItems();
new JurisRetroModEntities().initializeEntities();
}


@Override
public void afterGameStart() {

new JurisRetroModEntities().initializeEntities();
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/kleiders/jurisretro/JurisRetroModItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void initializeItems() {
.setIcon("jurisretro:item/chicken_pig_egg")
.build(new ItemEgg("chicken_pig_egg", nextItemID("chicken_pig_egg")) {
@Override
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) {
public ItemStack onUseItem(ItemStack itemstack, World world, EntityPlayer entityplayer) {
itemstack.consumeItem(entityplayer);
world.playSoundAtEntity(entityplayer, entityplayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!world.isClientSide) {
Expand Down
10 changes: 6 additions & 4 deletions src/main/java/kleiders/jurisretro/entities/EntityIceSpell.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import kleiders.jurisretro.JurisRetroModItems;
import kleiders.jurisretro.interfaces.EntityExtensions;
import net.minecraft.core.Global;
import net.minecraft.core.HitResult;
import net.minecraft.core.block.Block;
import net.minecraft.core.entity.EntityLiving;
Expand Down Expand Up @@ -41,7 +42,7 @@ public void tick() {
super.tick();
Random random = new Random();
for (int index0 = 0; index0 < 5; index0++) {
if (!this.world.isClientSide && MinecraftServer.getInstance() != null) {
if (Global.isServer && MinecraftServer.getInstance() != null) {
MinecraftServer.getInstance().playerList.sendPacketToAllPlayersInDimension(new Packet63SpawnParticleEffect("snowshovel",
this.x + (random.nextFloat() * 0.3) - (random.nextFloat() * 0.3), this.y + 0.1 + (random.nextFloat() * 0.3) - (random.nextFloat() * 0.3),
this.z + (random.nextFloat() * 0.3) - (random.nextFloat() * 0.3), 0, -0.06, 0, 0), world.dimension.id);
Expand All @@ -57,16 +58,17 @@ public void onHit(HitResult hitResult) {
if (hitResult.entity != null) {
if (hitResult.entity.hurt(this.owner, this.damage, DamageType.COMBAT)) {
((EntityExtensions) hitResult.entity).getExtraCustomData().putDouble("iceSlowness", 150);
((EntityExtensions) hitResult.entity).syncExtraCustomData();
if (hitResult.entity instanceof EntityIceZombie) {
((EntityExtensions) hitResult.entity).getExtraCustomData().putDouble("iceTicks", 300);
((EntityExtensions) hitResult.entity).syncExtraCustomData();
}
if (Global.isServer) {
((EntityExtensions) hitResult.entity).syncExtraCustomData();
}
}
}
Random random = new Random();
for (int index0 = 0; index0 < 50; index0++) {
if (!this.world.isClientSide && MinecraftServer.getInstance() != null) {
if (Global.isServer && MinecraftServer.getInstance() != null) {
MinecraftServer.getInstance().playerList.sendPacketToAllPlayersInDimension(new Packet63SpawnParticleEffect("snowshovel",
this.x + (random.nextFloat() * 0.55) - (random.nextFloat() * 0.55), this.y + 0.1 + (random.nextFloat() * 0.55) - (random.nextFloat() * 0.55),
this.z + (random.nextFloat() * 0.55) - (random.nextFloat() * 0.55), (random.nextFloat() * 0.05) - (random.nextFloat() * 0.05), -0.05, (random.nextFloat() * 0.05) - (random.nextFloat() * 0.05), 0), world.dimension.id);
Expand Down
26 changes: 19 additions & 7 deletions src/main/java/kleiders/jurisretro/items/AirSpellItem.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package kleiders.jurisretro.items;

import net.minecraft.core.Global;
import net.minecraft.core.entity.Entity;
import net.minecraft.core.entity.player.EntityPlayer;
import net.minecraft.core.item.Item;
Expand All @@ -22,20 +23,31 @@ public AirSpellItem(String name, int id) {
super(name, id);
}

public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) {
ItemStack retVal = super.onItemRightClick(itemstack, world, entityplayer);
public ItemStack onUseItem(ItemStack itemstack, World world, EntityPlayer entityplayer) {
ItemStack retVal = super.onUseItem(itemstack, world, entityplayer);

//world.netHandler.addToSendQueue(new Packet14BlockDig(1, x, y, z, side));

itemstack.consumeItem(entityplayer);
for (int index0 = 0; index0 < 90; index0++) {
Random random = new Random();
if (!world.isClientSide && MinecraftServer.getInstance() != null) {
MinecraftServer.getInstance().playerList.sendPacketToAllPlayersInDimension(new Packet63SpawnParticleEffect("explode", entityplayer.x + (random.nextFloat() * 3) - (random.nextFloat() * 3), entityplayer.y - 0.25 + (random.nextFloat() * 0.2) - (random.nextFloat() * 0.2),
entityplayer.z + (random.nextFloat() * 3) - (random.nextFloat() * 3), 0, 0.12, 0, 0), world.dimension.id);
if (Global.isServer && MinecraftServer.getInstance() != null) {
MinecraftServer.getInstance().playerList.sendPacketToAllPlayersInDimension(
new Packet63SpawnParticleEffect(
"explode",
entityplayer.x + (random.nextFloat() * 3) - (random.nextFloat() * 3),
entityplayer.y - 0.25 + (random.nextFloat() * 0.2) - (random.nextFloat() * 0.2),
entityplayer.z + (random.nextFloat() * 3) - (random.nextFloat() * 3), 0, 0.12, 0, 0),
world.dimension.id
);
} else {
world.spawnParticle("explode", entityplayer.x + (random.nextFloat() * 3) - (random.nextFloat() * 3), entityplayer.y - 1 + (random.nextFloat() * 0.2) - (random.nextFloat() * 0.2),
entityplayer.z + (random.nextFloat() * 3) - (random.nextFloat() * 3), 0, 0.12,0, 0);
world.spawnParticle(
"explode",
entityplayer.x + (random.nextFloat() * 3) - (random.nextFloat() * 3),
entityplayer.y - 1 + (random.nextFloat() * 0.2) - (random.nextFloat() * 0.2),
entityplayer.z + (random.nextFloat() * 3) - (random.nextFloat() * 3),
0, 0.12, 0, 0
);
}
}
world.playSoundEffect(entityplayer, SoundCategory.ENTITY_SOUNDS, entityplayer.x, entityplayer.y, entityplayer.z, "random.pop", 1, 1);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package kleiders.jurisretro.items;

import kleiders.jurisretro.interfaces.EntityExtensions;
import net.minecraft.core.Global;
import net.minecraft.core.entity.player.EntityPlayer;
import net.minecraft.core.item.Item;
import net.minecraft.core.item.ItemStack;
Expand All @@ -17,13 +18,13 @@ public TransformationSpellItem(String name, int id) {
super(name, id);
}

public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) {
ItemStack retVal = super.onItemRightClick(itemstack, world, entityplayer);
public ItemStack onUseItem(ItemStack itemstack, World world, EntityPlayer entityplayer) {
ItemStack retVal = super.onUseItem(itemstack, world, entityplayer);

itemstack.consumeItem(entityplayer);
for (int index0 = 0; index0 < 90; index0++) {
Random random = new Random();
if (!world.isClientSide && MinecraftServer.getInstance() != null) {
if (Global.isServer && MinecraftServer.getInstance() != null) {
MinecraftServer.getInstance().playerList.sendPacketToAllPlayersInDimension(new Packet63SpawnParticleEffect("explode", entityplayer.x + (random.nextFloat() * 1) - (random.nextFloat() * 1), entityplayer.y - 0.25 + (random.nextFloat() * 0.4) - (random.nextFloat() * 0.3),
entityplayer.z + (random.nextFloat() * 1) - (random.nextFloat() * 1), 0, 0.12, 0, 0), world.dimension.id);
} else {
Expand All @@ -33,7 +34,9 @@ public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer
}
world.playSoundEffect(entityplayer, SoundCategory.ENTITY_SOUNDS, entityplayer.x, entityplayer.y, entityplayer.z, "mob.chicken", 1, 1);
((EntityExtensions) entityplayer).getExtraCustomData().putDouble("chickenTime", ((EntityExtensions) entityplayer).getExtraCustomData().getDouble("chickenTime") + 1200);
((EntityExtensions) entityplayer).syncExtraCustomData();
if (Global.isServer) {
((EntityExtensions) entityplayer).syncExtraCustomData();
}
return retVal;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(EntityCamera.class)
@Mixin(value = EntityCamera.class, remap=false)
public class EntityCameraMixin {
@Shadow
public EntityLiving entity;
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/kleiders/jurisretro/mixin/EntityMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.mojang.nbt.CompoundTag;
import kleiders.jurisretro.interfaces.EntityExtensions;
import kleiders.jurisretro.packets.PacketChangeData;
import net.minecraft.core.Global;
import net.minecraft.core.entity.Entity;
import net.minecraft.core.util.phys.AABB;
import net.minecraft.core.world.World;
Expand All @@ -15,7 +16,7 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(Entity.class)
@Mixin(value = Entity.class, remap = false)
public class EntityMixin implements EntityExtensions {
@Shadow
public World world;
Expand Down Expand Up @@ -52,7 +53,7 @@ public class EntityMixin implements EntityExtensions {
@Unique
@Override
public void syncExtraCustomData() {
if (!this.world.isClientSide && MinecraftServer.getInstance() != null) {
if (Global.isServer && MinecraftServer.getInstance() != null) {
MinecraftServer.getInstance().playerList.sendPacketToAllPlayersInDimension(new PacketChangeData(((Entity) (Object) this), juris$extraCustomData), this.world.dimension.id);
}
}
Expand Down
19 changes: 11 additions & 8 deletions src/main/java/kleiders/jurisretro/mixin/EntityPlayerMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import kleiders.jurisretro.interfaces.EntityExtensions;
import kleiders.jurisretro.packets.PacketChangeSize;
import kleiders.jurisretro.packets.PacketRideEntity;
import net.minecraft.core.Global;
import net.minecraft.core.entity.Entity;
import net.minecraft.core.entity.EntityLiving;
import net.minecraft.core.entity.monster.EntityZombie;
Expand Down Expand Up @@ -42,7 +43,7 @@ public void interact(EntityPlayer otherplayer, CallbackInfoReturnable<Boolean> c
EntityPlayer player = ((EntityPlayer) (Object) this);
if (((EntityExtensions) player).getExtraCustomData().getDouble("chickenTime") > 0 && ((EntityExtensions) otherplayer).getExtraCustomData().getDouble("chickenTime") <= 0) {
otherplayer.startRiding(player);
if (!player.world.isClientSide && MinecraftServer.getInstance() != null) {
if (Global.isServer && MinecraftServer.getInstance() != null) {
MinecraftServer.getInstance().playerList.sendPacketToAllPlayersInDimension(new PacketRideEntity(otherplayer, player), player.world.dimension.id);
}
}
Expand Down Expand Up @@ -80,7 +81,9 @@ private void injected(Entity attacker, int damage, DamageType type, CallbackInfo
if (cir.getReturnValue() && attacker instanceof EntityIceZombie) {
EntityPlayer player = ((EntityPlayer) (Object) this);
((EntityExtensions) player).getExtraCustomData().putDouble("iceSlowness", 100);
((EntityExtensions) player).syncExtraCustomData();
if (Global.isServer) {
((EntityExtensions) player).syncExtraCustomData();
}
}
}

Expand All @@ -92,14 +95,14 @@ public void modifySpeed(CallbackInfo ci) {
((EntityExtensions) player).getExtraCustomData().putDouble("iceSlowness", ((EntityExtensions) player).getExtraCustomData().getDouble("iceSlowness") - 1);
player.speed *= 0.8;
Random random = new Random();
if (!player.world.isClientSide && MinecraftServer.getInstance() != null) {
if (Global.isServer && MinecraftServer.getInstance() != null) {
MinecraftServer.getInstance().playerList.sendPacketToAllPlayersInDimension(new Packet63SpawnParticleEffect("snowshovel", player.x + (random.nextFloat() * 1) - (random.nextFloat() * 1), player.y + 0.25 + (random.nextFloat() * 0.2) - (random.nextFloat() * 0.2),
player.z + (random.nextFloat() * 1) - (random.nextFloat() * 1), 0, -0.12, 0, 0), world.dimension.id);
} else {
player.world.spawnParticle("snowshovel", player.x + (random.nextFloat() * 1) - (random.nextFloat() * 1), player.y - 0.25 + (random.nextFloat() * 0.2) - (random.nextFloat() * 0.2),
player.z + (random.nextFloat() * 1) - (random.nextFloat() * 1), 0, -0.12,0, 0);
}
if (((EntityExtensions) player).getExtraCustomData().getDouble("iceSlowness") <= 0) {
if (((EntityExtensions) player).getExtraCustomData().getDouble("iceSlowness") <= 0 && Global.isServer) {
((EntityExtensions) player).syncExtraCustomData();
}
}
Expand All @@ -112,9 +115,9 @@ private void onDwarf(CallbackInfo ci) {
((EntityExtensions) player).getExtraCustomData().putDouble("chickenTime", ((EntityExtensions) player).getExtraCustomData().getDouble("chickenTime") - 1);
if (!isChicken) {
this.setSize(0.6F, 0.7F);
((EntityExtensions) player).syncExtraCustomData();
isChicken = true;
if (!player.world.isClientSide && MinecraftServer.getInstance() != null) {
if (Global.isServer && MinecraftServer.getInstance() != null) {
((EntityExtensions) player).syncExtraCustomData();
MinecraftServer.getInstance().playerList.sendPacketToAllPlayersInDimension(new PacketChangeSize(player, true), player.world.dimension.id);
}
}
Expand All @@ -123,8 +126,8 @@ private void onDwarf(CallbackInfo ci) {
this.setSize(0.6F, 1.8F);
isChicken = false;
isDwarf = false;
((EntityExtensions) player).syncExtraCustomData();
if (!player.world.isClientSide && MinecraftServer.getInstance() != null) {
if (Global.isServer && MinecraftServer.getInstance() != null) {
((EntityExtensions) player).syncExtraCustomData();
MinecraftServer.getInstance().playerList.sendPacketToAllPlayersInDimension(new PacketChangeSize(player, false), player.world.dimension.id);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(EntityPlayerSP.class)
@Mixin(value = EntityPlayerSP.class, remap = false)
public class EntityPlayerSPMixin {
@Inject(method = "checkInTile", remap = false, at = @At("HEAD"), cancellable = true)
public void shouldBeFree(CallbackInfoReturnable<Boolean> cir) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(EntityTrackerEntry.class)
@Mixin(value = EntityTrackerEntry.class, remap = false)
public class EntityTrackerEntryMixin {
@Shadow
public Entity trackedEntity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(EntityTracker.class)
@Mixin(value = EntityTracker.class, remap = false)
public class EntityTrackerMixin {

@Inject(method = "trackEntity", remap = false, at = @At("HEAD"), cancellable = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(EntityZombie.class)
@Mixin(value = EntityZombie.class, remap = false)
public class EntityZombieMixin {

@Redirect(method = "onLivingUpdate", remap = false, at = @At(value = "FIELD", target = "Lnet/minecraft/core/entity/monster/EntityZombie;remainingFireTicks:I"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import kleiders.jurisretro.JurisRetroMod;
import kleiders.jurisretro.JurisRetroModItems;
import kleiders.jurisretro.interfaces.EntityExtensions;
import net.minecraft.core.Global;
import net.minecraft.core.block.Block;
import net.minecraft.core.entity.EntityLiving;
import net.minecraft.core.entity.player.EntityPlayer;
Expand Down Expand Up @@ -51,7 +52,7 @@ public void modifySpeed(float moveStrafing, float moveForward, CallbackInfo ci)
living.speed *= 0.4;
Random random = new Random();
float height = living.bbHeight;
if (!living.world.isClientSide && MinecraftServer.getInstance() != null) {
if (Global.isServer && MinecraftServer.getInstance() != null) {
MinecraftServer.getInstance().playerList.sendPacketToAllPlayersInDimension(new Packet63SpawnParticleEffect("snowshovel", living.x + (random.nextFloat() * 1) - (random.nextFloat() * 1), living.y + (height / 2) + (random.nextFloat() * (height / 2)) - (random.nextFloat() * (height / 2)),
living.z + (random.nextFloat() * 1) - (random.nextFloat() * 1), 0, -0.12, 0, 0), living.world.dimension.id);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(NetClientHandler.class)
@Mixin(value = NetClientHandler.class, remap = false)
public abstract class NetClientHandlerMixin implements NetHandlerPacketsExtensions {
@Shadow
public abstract Entity getEntityByID(int i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;

@Mixin(NetHandler.class)
@Mixin(value = NetHandler.class, remap = false)
public class NetHandlerMixin implements NetHandlerPacketsExtensions {


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyVariable;

@Mixin(WorldRenderer.class)
@Mixin(value = WorldRenderer.class, remap = false)
public class WorldRendererMixin {
@Shadow
public Minecraft mc;
Expand Down
24 changes: 12 additions & 12 deletions src/main/resources/lang/jurisretro/en_US.lang
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
item.juris_retro.air_spell.name=Air Spell
item.juris_retro.air_spell.desc=Push enemies away!
item.juris_retro.chicken_pig_egg.name=Chicken Pig Egg
item.juris_retro.chicken_pig_egg.desc=Can be used to make a Transformation Spell.
item.juris_retro.transformation_spell.name=Transformation Spell
item.juris_retro.transformation_spell.desc=Transforms you into a Chicken Pig for 1 minute. Can Stack.
item.juris_retro.spider_boots.name=Spider Boots
item.juris_retro.spider_boots.desc=Climb like a Spider!
item.juris_retro.spider_mother_leather.name=Spider Mother Leather
item.juris_retro.spider_mother_leather.desc=A flat Spider Mother. Can be used to make Boots.
item.juris_retro.ice_spell.name=Ice Spell
item.juris_retro.ice_spell.desc=Shoots an Ice Block that slows enemies on hit.
item.jurisretro.air_spell.name=Air Spell
item.jurisretro.air_spell.desc=Push enemies away!
item.jurisretro.chicken_pig_egg.name=Chicken Pig Egg
item.jurisretro.chicken_pig_egg.desc=Can be used to make a Transformation Spell.
item.jurisretro.transformation_spell.name=Transformation Spell
item.jurisretro.transformation_spell.desc=Transforms you into a Chicken Pig for 1 minute. Can Stack.
item.jurisretro.spider_boots.name=Spider Boots
item.jurisretro.spider_boots.desc=Climb like a Spider!
item.jurisretro.spider_mother_leather.name=Spider Mother Leather
item.jurisretro.spider_mother_leather.desc=A flat Spider Mother. Can be used to make Boots.
item.jurisretro.ice_spell.name=Ice Spell
item.jurisretro.ice_spell.desc=Shoots an Ice Block that slows enemies on hit.
section.jurisretro.chicken_pig.name=Chicken Pig
section.jurisretro.chicken_pig.desc=A strange but calm mix between a Chicken and a Pig.
section.jurisretro.spider_mother.name=Spider Mother
Expand Down

0 comments on commit ee884f3

Please sign in to comment.