Skip to content

Commit

Permalink
Merge pull request #104 from Jiingy/1.20
Browse files Browse the repository at this point in the history
1.20
  • Loading branch information
MrCheeze446 authored Jun 8, 2023
2 parents b0787d5 + a4005dd commit 5e1d156
Show file tree
Hide file tree
Showing 15 changed files with 291 additions and 314 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ dependencies {

// api
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modCompileOnly "dev.emi:emi:${emi_version}:api"
modLocalRuntime "dev.emi:emi:${emi_version}"
// modCompileOnly "dev.emi:emi:${emi_version}:api"
// modLocalRuntime "dev.emi:emi:${emi_version}"

// mixin extras
implementation("com.github.LlamaLad7:MixinExtras:0.1.1")
Expand Down
1 change: 1 addition & 0 deletions src/main/java/jingy/jineric/base/JinericMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public void onInitialize() {
LOGGER.info("Jineric Mod Main - Starting initialization");
JinericRegistries.registerJinericMod();
JinericItemGroups.registerItemGroups();
JinericItemGroups.registerJinericItemGroups();
JinericPaintingVariant.registerPaintingMotives();
JinericStats.registerStats();
JinericBlockEntityType.registerBlockEntities();
Expand Down
22 changes: 11 additions & 11 deletions src/main/java/jingy/jineric/base/plugins/JinericEmiPlugin.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package jingy.jineric.base.plugins;

import dev.emi.emi.api.EmiPlugin;
import dev.emi.emi.api.EmiRegistry;

public class JinericEmiPlugin implements EmiPlugin {
@Override
public void register(EmiRegistry registry) {

}
}
//package jingy.jineric.base.plugins;
//
//import dev.emi.emi.api.EmiPlugin;
//import dev.emi.emi.api.EmiRegistry;
//
//public class JinericEmiPlugin implements EmiPlugin {
// @Override
// public void register(EmiRegistry registry) {
//
// }
//}
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ protected void mobTick() {

@Override
public void tickMovement() {
if (this.world.isClient) {
if (this.getWorld().isClient) {
this.eatGrassTimer = Math.max(0, this.eatGrassTimer -1);
}
super.tickMovement();
Expand Down Expand Up @@ -152,7 +152,7 @@ public float getHeadPitch() {
public ActionResult interactMob(PlayerEntity player, Hand hand) {
ItemStack itemStack = player.getStackInHand(hand);
if (itemStack.isOf(Items.SHEARS)) {
if (!this.world.isClient && this.isShearable()) {
if (!this.getWorld().isClient && this.isShearable()) {
this.sheared(SoundCategory.PLAYERS);
this.emitGameEvent(GameEvent.SHEAR, player);
itemStack.damage(1, player, playerx -> playerx.sendToolBreakStatus(hand));
Expand All @@ -167,7 +167,7 @@ public ActionResult interactMob(PlayerEntity player, Hand hand) {

@Override
public void sheared(SoundCategory shearedSoundCategory) {
this.world.playSoundFromEntity((PlayerEntity)null, this, SoundEvents.ENTITY_SHEEP_SHEAR, shearedSoundCategory, 1.0F, 1.0F);
this.getWorld().playSoundFromEntity((PlayerEntity)null, this, SoundEvents.ENTITY_SHEEP_SHEAR, shearedSoundCategory, 1.0F, 1.0F);
this.setSheared(true);
int i = 1 + this.random.nextInt(3);

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/jingy/jineric/item/JinericElytraItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public boolean useCustomElytra(LivingEntity entity, ItemStack chestStack, boolea
public void doVanillaElytraTick(LivingEntity entity, ItemStack chestStack) {
int nextRoll = entity.getRoll() + 1;

if (!entity.world.isClient && nextRoll % 10 == 0) {
if (!entity.getWorld().isClient && nextRoll % 10 == 0) {
if ((nextRoll / 10) % 2 == 0) {
chestStack.damage(1, entity, p -> p.sendEquipmentBreakStatus(EquipmentSlot.CHEST));
}
Expand Down
473 changes: 239 additions & 234 deletions src/main/java/jingy/jineric/item/JinericItemGroups.java

Large diffs are not rendered by default.

30 changes: 7 additions & 23 deletions src/main/java/jingy/jineric/mixin/EnchantingTableBlockMixin.java
Original file line number Diff line number Diff line change
@@ -1,36 +1,20 @@
package jingy.jineric.mixin;

import jingy.jineric.tag.JinericBlockTags;
import net.minecraft.block.BlockState;
import net.minecraft.block.BlockWithEntity;
import net.minecraft.block.EnchantingTableBlock;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.EnchantingTableBlockEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(EnchantingTableBlock.class)
public abstract class EnchantingTableBlockMixin extends BlockWithEntity {
public EnchantingTableBlockMixin(Settings settings) {
super(settings);
}

@Inject(method = "canAccessBookshelf(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/BlockPos;)Z", at = @At("HEAD"), cancellable = true)
private static void jineric$canAccessBookshelf(World world, BlockPos tablePos, BlockPos bookshelfOffset, CallbackInfoReturnable<Boolean> cir) {
if (world.getBlockState(tablePos.add(bookshelfOffset)).isIn(JinericBlockTags.WOODEN_BOOKSHELVES)
&& world.isAir(tablePos.add(bookshelfOffset.getX() / 2, bookshelfOffset.getY(), bookshelfOffset.getZ() / 2))) {
cir.setReturnValue(true);
}
}

@Nullable
@Override
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
return new EnchantingTableBlockEntity(pos, state);
}
// @Inject(method = "canAccessBookshelf(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/BlockPos;)Z", at = @At("HEAD"), cancellable = true)
// private static void jineric$canAccessBookshelf(World world, BlockPos tablePos, BlockPos bookshelfOffset, CallbackInfoReturnable<Boolean> cir) {
// if (world.getBlockState(tablePos.add(bookshelfOffset)).isIn(JinericBlockTags.WOODEN_BOOKSHELVES)
// && world.isAir(tablePos.add(bookshelfOffset.getX() / 2, bookshelfOffset.getY(), bookshelfOffset.getZ() / 2))) {
// cir.setReturnValue(true);
// }
// }
}
6 changes: 3 additions & 3 deletions src/main/java/jingy/jineric/mixin/LivingEntityMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ public LivingEntityMixin(EntityType<?> type, World world) {
protected void jineric$handleSoulSpeedForSlabsAndFences(CallbackInfoReturnable<Boolean> cir) {
// check feet pos block
BlockPos pos = getBlockPos();
if (world.getBlockState(pos).isIn(BlockTags.SOUL_SPEED_BLOCKS)) {
if (getWorld().getBlockState(pos).isIn(BlockTags.SOUL_SPEED_BLOCKS)) {
cir.setReturnValue(true);
}
// check head pos block
if (world.getBlockState(pos.up()).isIn(BlockTags.SOUL_SPEED_BLOCKS)) {
if (getWorld().getBlockState(pos.up()).isIn(BlockTags.SOUL_SPEED_BLOCKS)) {
cir.setReturnValue(true);
}
}
Expand All @@ -42,7 +42,7 @@ public LivingEntityMixin(EntityType<?> type, World world) {
@SuppressWarnings("InvalidInjectorMethodSignature")
public float jineric$setSlipperiness(float p) {
BlockPos pos = getBlockPos();
BlockState state = world.getBlockState(pos);
BlockState state = getWorld().getBlockState(pos);
if (isOnGround() && JinericBlocks.isSlipperyBlock(state)) {
// if Y is a perfect integer, we're on a full block.
// Otherwise, get friction from the block the entity is in, not on.
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/jingy/jineric/mixin/TurtleEntityMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public boolean canBeSaddled() {
public void saddle(@Nullable SoundCategory sound) {
this.jineric$saddledComponent.setSaddled(true);
if (sound != null) {
this.world.playSoundFromEntity((PlayerEntity)null, this, SoundEvents.ENTITY_STRIDER_SADDLE, sound, 0.5F, 1.0F);
this.getWorld().playSoundFromEntity((PlayerEntity)null, this, SoundEvents.ENTITY_STRIDER_SADDLE, sound, 0.5F, 1.0F);
}
}

Expand All @@ -89,7 +89,7 @@ public SoundEvent getSaddleSound() {

@Override
public void onTrackedDataSet(TrackedData<?> data) {
if (BOOST_TIME.equals(data) && this.world.isClient) {
if (BOOST_TIME.equals(data) && this.getWorld().isClient) {
this.jineric$saddledComponent.boost();
}

Expand All @@ -100,11 +100,11 @@ public void onTrackedDataSet(TrackedData<?> data) {
public ActionResult interactMob(PlayerEntity player, Hand hand) {
boolean bl = this.isBreedingItem(player.getStackInHand(hand));
if (!bl && this.isSaddled() && !this.hasPassengers() && !player.shouldCancelInteraction()) {
if (!this.world.isClient) {
if (!this.getWorld().isClient) {
player.startRiding(this);
}

return ActionResult.success(this.world.isClient);
return ActionResult.success(this.getWorld().isClient);
} else {
ActionResult actionResult = super.interactMob(player, hand);
if (!actionResult.isAccepted()) {
Expand Down
16 changes: 0 additions & 16 deletions src/main/java/jingy/jineric/registry/JinericBlockMaterials.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class JinericBlockSettings extends Blocks {

public static FabricBlockSettings soulSandstoneSettings() {
return FabricBlockSettings
.of(Material.STONE)
.copyOf(STONE)
.requiresTool()
.strength(0.8f, 4f)
.sounds(JinericBlockSoundGroup.SOUL_SANDSTONE)
Expand All @@ -24,14 +24,13 @@ public static FabricBlockSettings soulSandstoneSettings() {
}

public static FabricBlockSettings obsidianSettings() {
return FabricBlockSettings
.of(JinericBlockMaterials.OBSIDIAN, MapColor.BLACK)
return FabricBlockSettings.copyOf(OBSIDIAN)
.requiresTool()
.strength(50.0F, 1200.0F).sounds(BlockSoundGroup.STONE);
}
public static FabricBlockSettings redstoneCampfireSettings() {
return FabricBlockSettings
.of(Material.WOOD, MapColor.BROWN)
.copyOf(OAK_WOOD)
.strength(2.0F)
.sounds(BlockSoundGroup.WOOD)
.luminance(createLightLevelFromLitBlockState(7))
Expand All @@ -40,7 +39,7 @@ public static FabricBlockSettings redstoneCampfireSettings() {

public static LeavesBlock JinericLeavesBlock(BlockSoundGroup soundGroup) {
return new LeavesBlock(
AbstractBlock.Settings.of(Material.LEAVES)
AbstractBlock.Settings.copy(OAK_LEAVES)
.strength(0.2F)
.ticksRandomly()
.sounds(soundGroup)
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/jingy/jineric/screen/RefineryScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import jingy.jineric.base.JinericMain;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.ingame.AbstractFurnaceScreen;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
Expand All @@ -18,7 +18,7 @@ public RefineryScreen(RefineryScreenHandler handler, PlayerInventory inventory,
}

@Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
super.render(matrices, mouseX, mouseY, delta);
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
super.render(context, mouseX, mouseY, delta);
}
}
15 changes: 7 additions & 8 deletions src/main/java/jingy/jineric/screen/ShulkerChestScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import com.mojang.blaze3d.systems.RenderSystem;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
Expand All @@ -17,7 +17,6 @@ public class ShulkerChestScreen extends HandledScreen<ShulkerChestScreenHandler>

public ShulkerChestScreen(ShulkerChestScreenHandler handler, PlayerInventory inventory, Text title) {
super(handler, inventory, title);
this.passEvents = false;
this.backgroundWidth = 176;
this.backgroundHeight = 276;
this.playerInventoryTitleY = 182;
Expand All @@ -26,19 +25,19 @@ public ShulkerChestScreen(ShulkerChestScreenHandler handler, PlayerInventory inv
}

@Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
this.renderBackground(matrices);
super.render(matrices, mouseX, mouseY, delta);
this.drawMouseoverTooltip(matrices, mouseX, mouseY);
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
this.renderBackground(context);
super.render(context, mouseX, mouseY, delta);
this.drawMouseoverTooltip(context, mouseX, mouseY);
}

@Override
protected void drawBackground(MatrixStack matrices, float delta, int mouseX, int mouseY) {
protected void drawBackground(DrawContext context, float delta, int mouseX, int mouseY) {
RenderSystem.setShader(GameRenderer::getPositionTexProgram);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.setShaderTexture(0, TEXTURE);
int x = (width - backgroundWidth) / 2;
int y = (height - backgroundHeight) / 2;
drawTexture(matrices, x, y, 0, 0, this.backgroundWidth, this.backgroundHeight, 256, 320);
context.drawTexture(TEXTURE, x, y, 0, 0, this.backgroundWidth, this.backgroundHeight, 256, 320);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"values": [
"#jineric:wooden_bookshelves"
]
}
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"depends": {
"fabricloader": ">=0.14",
"fabric": "*",
"minecraft": "~1.19.3",
"minecraft": ">1.19.3",
"java": ">=17"
},
"accessWidener": "jineric.accesswidener",
Expand Down

0 comments on commit 5e1d156

Please sign in to comment.