Skip to content

Commit

Permalink
Update to 1.15.2
Browse files Browse the repository at this point in the history
  • Loading branch information
KnightMiner committed May 11, 2020
1 parent cb36693 commit 3a6f01e
Show file tree
Hide file tree
Showing 50 changed files with 364 additions and 319 deletions.
6 changes: 1 addition & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,8 @@ dependencies {
runtimeOnly fg.deobf("mezz.jei:jei-${config.minecraft_version}:${config.jei_version}")

compile fg.deobf("slimeknights.mantle:Mantle:${config.minecraft_version}-${config.mantle_version}")
//deobfCompile "mcp.mobius.waila:Hwyla:${config.hwyla_version}"
//deobfCompile("mcjty.theoneprobe:TheOneProbe-1.12:${config.probe_version}") {
// exclude group: 'cofh' // don't grab redstone flux too, don't use it
//}
//deobfCompile curse.resolve("leather-works", "2695934")
//deobfCompile "net.ilexiconn:llibrary:1.7.9-1.12.2"
//deobfCompile "net.ilexiconn:llibrary:1.7.9-1.12.2"
//deobfCompile curse.resolve("rats", "2732516")
//deobfCompile curse.resolve("the-twilight-forest", "2618264")
}
Expand Down
12 changes: 5 additions & 7 deletions build.properties
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
mod_version=1.0.2
minecraft_version=1.14.4
minecraft_base_version=1.14
forge_version=28.1.93
minecraft_version=1.15.2
minecraft_base_version=1.15
forge_version=31.1.0
forge_version_toml=278
mappings_version=20191128-1.14.3
mantle_version=1.4.32
mappings_version=20200328-1.15.1
mantle_version=1.5.15

jei_version=6.0.+
hwyla_version=1.10.5-B66_1.14.4
probe_version=1.4.30-6
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import net.minecraft.block.Blocks;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScreenManager;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.RenderTypeLookup;
import net.minecraft.client.renderer.color.BlockColors;
import net.minecraft.client.renderer.color.ItemColors;
import net.minecraft.client.renderer.model.ModelResourceLocation;
Expand All @@ -28,13 +30,47 @@
import net.minecraftforge.client.event.ColorHandlerEvent;
import net.minecraftforge.client.event.ModelBakeEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;

import java.util.concurrent.CompletableFuture;

public class BuildingClientProxy extends ClientProxy {
public static final Minecraft mc = Minecraft.getInstance();

@SubscribeEvent
public void clientSetup(FMLClientSetupEvent event) {
// set render types
RenderType cutout = RenderType.getCutout();
RenderType cutoutMipped = RenderType.getCutoutMipped();
// shelves
RenderTypeLookup.setRenderLayer(InspirationsBuilding.shelf_normal, cutout);
RenderTypeLookup.setRenderLayer(InspirationsBuilding.shelf_rainbow, cutout);
RenderTypeLookup.setRenderLayer(InspirationsBuilding.shelf_tomes, cutout);
RenderTypeLookup.setRenderLayer(InspirationsBuilding.shelf_ancient, cutout);
// ropes
RenderTypeLookup.setRenderLayer(InspirationsBuilding.rope, cutout);
RenderTypeLookup.setRenderLayer(InspirationsBuilding.vine, cutout);
RenderTypeLookup.setRenderLayer(InspirationsBuilding.ironBars, cutoutMipped);
// doors
RenderTypeLookup.setRenderLayer(InspirationsBuilding.glassDoor, cutoutMipped);
RenderTypeLookup.setRenderLayer(InspirationsBuilding.glassTrapdoor, cutoutMipped);
// flower
RenderTypeLookup.setRenderLayer(InspirationsBuilding.flower_cyan, cutout);
RenderTypeLookup.setRenderLayer(InspirationsBuilding.flower_paeonia, cutout);
RenderTypeLookup.setRenderLayer(InspirationsBuilding.flower_rose, cutout);
RenderTypeLookup.setRenderLayer(InspirationsBuilding.flower_syringa, cutout);
RenderTypeLookup.setRenderLayer(InspirationsBuilding.potted_cyan, cutout);
RenderTypeLookup.setRenderLayer(InspirationsBuilding.potted_syringa, cutout);
RenderTypeLookup.setRenderLayer(InspirationsBuilding.potted_paeonia, cutout);
RenderTypeLookup.setRenderLayer(InspirationsBuilding.potted_rose, cutout);
// enlightened bushes
RenderTypeLookup.setRenderLayer(InspirationsBuilding.blueEnlightenedBush, cutoutMipped);
RenderTypeLookup.setRenderLayer(InspirationsBuilding.greenEnlightenedBush, cutoutMipped);
RenderTypeLookup.setRenderLayer(InspirationsBuilding.redEnlightenedBush, cutoutMipped);
RenderTypeLookup.setRenderLayer(InspirationsBuilding.whiteEnlightenedBush, cutoutMipped);
}

@SubscribeEvent
public void commonSetup(FMLCommonSetupEvent event) {

Expand Down Expand Up @@ -186,7 +222,7 @@ private static void replaceBookshelfModel(ModelBakeEvent event, BookshelfBlock s
}
for(Direction facing : Direction.Plane.HORIZONTAL){
ModelResourceLocation location = new ModelResourceLocation(shelf.getRegistryName(), String.format("facing=%s", facing.getName()));
replaceModel(event, location, BookshelfModel::new);
replaceModel(event, location, (loader, model) -> new BookshelfModel(location, loader, model));
}
replaceTexturedModel(event, new ModelResourceLocation(shelf.getRegistryName(), "inventory"), "texture",true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import knightminer.inspirations.common.Config;
import net.minecraft.block.BlockState;
import net.minecraft.block.SoundType;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.RenderTypeLookup;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResultType;
Expand Down Expand Up @@ -47,7 +49,7 @@ public static void toggleRopeLadder(PlayerInteractEvent.RightClickBlock event) {

private static boolean removeRopeLadder(World world, BlockPos pos, BlockState state, PlayerEntity player) {
// only remove rungs when sneaking
if (!player.isSneaking()) {
if (!player.isCrouching()) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import net.minecraft.state.StateContainer;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.Mirror;
Expand Down Expand Up @@ -77,13 +77,6 @@ public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return new BookshelfTileEntity();
}

@Deprecated
@Nullable
@Override
public TileEntity createNewTileEntity(@Nonnull IBlockReader world) {
return new BookshelfTileEntity();
}

@Nullable
@Override
public BlockState getStateForPlacement(BlockItemUseContext context) {
Expand Down Expand Up @@ -126,40 +119,41 @@ public void fillItemGroup(@Nonnull ItemGroup group, @Nonnull NonNullList<ItemSta

/* Activation */

@Deprecated
@Override
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult trace) {
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult trace) {
Direction facing = state.get(FACING);

// skip opposite, not needed as the back is never clicked for books
if(facing.getOpposite() == trace.getFace()) {
return false;
return ActionResultType.PASS;
}

// if sneaking, just do the GUI
if(player.isSneaking()) {
return world.isRemote || openGui(player, world, pos);
if(player.isCrouching()) {
return (world.isRemote || openGui(player, world, pos)) ? ActionResultType.SUCCESS : ActionResultType.PASS;
}

// if we did not click a book, just do the GUI as well
int book = bookClicked(facing, pos, trace.getHitVec());
if(book == -1) {
return world.isRemote || openGui(player, world, pos);
return (world.isRemote || openGui(player, world, pos)) ? ActionResultType.SUCCESS : ActionResultType.PASS;
}

TileEntity te = world.getTileEntity(pos);
if(te instanceof BookshelfTileEntity) {
// try interacting
if(((BookshelfTileEntity) te).interact(player, hand, book)) {
return true;
return ActionResultType.SUCCESS;
}

// if the offhand can interact, return false so we can process it later
if(InspirationsRegistry.isBook(player.getHeldItemOffhand())) {
return false;
return ActionResultType.PASS;
}
}

return true;
return ActionResultType.SUCCESS;
}

private static int bookClicked(Direction facing, BlockPos pos, Vec3d clickWorld) {
Expand Down Expand Up @@ -279,13 +273,6 @@ public int getComparatorInputOverride(BlockState state, World world, BlockPos po
/*
* Block properties
*/

@Nonnull
@Override
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}

@Override
public BlockState rotate(BlockState state, IWorld world, BlockPos pos, Rotation direction) {
return state.with(FACING, direction.rotate(state.get(FACING)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.IBlockReader;
Expand Down Expand Up @@ -64,12 +63,6 @@ public boolean causesSuffocation(@Nonnull BlockState state, @Nonnull IBlockReade
return false;
}

@Nonnull
@Override
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT_MIPPED;
}

@Deprecated
@Override
public boolean canEntitySpawn(BlockState state, @Nonnull IBlockReader worldIn, @Nonnull BlockPos pos, EntityType<?> type) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import net.minecraft.world.storage.loot.ConstantRange;
import net.minecraft.world.storage.loot.LootPool;
import net.minecraft.world.storage.loot.LootTable;
Expand Down Expand Up @@ -83,10 +84,9 @@ public boolean canGrow(IBlockReader world, BlockPos pos, BlockState state, boole
public boolean canUseBonemeal(World worldIn, Random rand, BlockPos pos, BlockState state) {
return true;
}



@Override
public void grow(World world, Random rand, BlockPos pos, BlockState state) {
public void grow(ServerWorld world, Random rand, BlockPos pos, BlockState state) {
// should not happen, but catch anyways
if(largePlant == null) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tags.BlockTags;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.IStringSerializable;
Expand Down Expand Up @@ -140,16 +139,16 @@ public BlockState updatePostPlacement(@Nonnull BlockState state, Direction facin
// right click with a rope to extend downwards
@Deprecated
@Override
public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
public ActionResultType onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
// no need to check verticals, one is not possible and the other normal block placement
if (hit.getFace().getAxis().isVertical()) {
return false;
return ActionResultType.PASS;
}

ItemStack stack = player.getHeldItem(hand);
// check if the item is the same type as us
if (Block.getBlockFromItem(stack.getItem()) != this) {
return false;
return ActionResultType.PASS;
}

// find the first block at the bottom of the rope
Expand All @@ -167,7 +166,7 @@ public boolean onBlockActivated(BlockState state, World world, BlockPos pos, Pla
}
}

return true;
return ActionResultType.SUCCESS;
}

// when breaking, place all items from ropes below at the position of this rope
Expand Down Expand Up @@ -210,12 +209,6 @@ public boolean isLadder(BlockState state, IWorldReader world, BlockPos pos, Livi
return true;
}

@Nonnull
@Override
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}


/* Bounds */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.IUnbakedModel;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.renderer.model.ModelBakery;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.data.IModelData;

import javax.annotation.Nonnull;
Expand All @@ -25,8 +25,8 @@ public class BookshelfModel extends TextureModel {

/** Book model cache, for internal use only */
public static final Cache<BookshelfCacheKey, IBakedModel> BOOK_CACHE = CacheBuilder.newBuilder().maximumSize(30).build();
public BookshelfModel(IBakedModel standard, IUnbakedModel model) {
super(standard, model, DefaultVertexFormats.BLOCK, "texture", false);
public BookshelfModel(ResourceLocation location, ModelBakery loader, IBakedModel standard) {
super(location, loader, standard, "texture", false);
}

@Nonnull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,25 @@
import slimeknights.mantle.inventory.MultiModuleContainer;

public class BookshelfContainer extends MultiModuleContainer<BookshelfTileEntity> {
public static class Factory implements IContainerFactory<BookshelfContainer> {
@Override
public BookshelfContainer create(int windowId, PlayerInventory inv, PacketBuffer data) {
// Create the container on the clientside.
BlockPos pos = data.readBlockPos();
TileEntity te = inv.player.world.getTileEntity(pos);
if (te instanceof BookshelfTileEntity) {
return new BookshelfContainer(windowId, inv, (BookshelfTileEntity) te);
}
throw new AssertionError(String.format("No bookshelf at %s!", pos));
}
}

public BookshelfContainer(int winId, PlayerInventory inventoryPlayer, BookshelfTileEntity shelf) {
super(InspirationsBuilding.contBookshelf, winId, shelf);
super(InspirationsBuilding.contBookshelf, winId, inventoryPlayer, shelf);
for(int i = 0; i < 7; i++) {
this.addSlot(new SlotBookshelf(tile, i, 26 + (i*18), 18));
}
for(int i = 0; i < 7; i++) {
this.addSlot(new SlotBookshelf(tile, i+7, 26 + (i*18), 44));
}
addInventorySlots();
}

addPlayerInventory(inventoryPlayer, 8, 74);
@Override
protected int getInventoryXOffset() {
return 8;
}

@Override
protected int getInventoryYOffset() {
return 74;
}

public static class SlotBookshelf extends Slot {
Expand All @@ -52,4 +48,17 @@ public boolean isItemValid(ItemStack stack) {
return InspirationsRegistry.isBook(stack);
}
}

public static class Factory implements IContainerFactory<BookshelfContainer> {
@Override
public BookshelfContainer create(int windowId, PlayerInventory inv, PacketBuffer data) {
// Create the container on the clientside.
BlockPos pos = data.readBlockPos();
TileEntity te = inv.player.world.getTileEntity(pos);
if (te instanceof BookshelfTileEntity) {
return new BookshelfContainer(windowId, inv, (BookshelfTileEntity) te);
}
throw new AssertionError(String.format("No bookshelf at %s!", pos));
}
}
}
Loading

0 comments on commit 3a6f01e

Please sign in to comment.