Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import net.minecraftforge.client.event.*;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.event.config.ModConfigEvent;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;

public class ClientLifecycleSubscriber
{
Expand All @@ -29,28 +28,23 @@ public class ClientLifecycleSubscriber
* @param event event
*/
@SubscribeEvent
public static void onClientInit(final FMLClientSetupEvent event)
public static void onClientInit(final RegisterClientReloadListenersEvent event)
{
final ResourceManager rm = Minecraft.getInstance().getResourceManager();
if (rm instanceof final ReloadableResourceManager resourceManager)
event.registerReloadListener(new SimplePreparableReloadListener<>()
{
resourceManager.registerReloadListener(new SimplePreparableReloadListener<>()
@Override
protected Object prepare(final ResourceManager manager, final ProfilerFiller profiler)
{
return new Object();
}

@Override
protected Object prepare(final ResourceManager manager, final ProfilerFiller profiler)
{
return new Object();
}

@Override
protected void apply(final Object source, final ResourceManager manager, final ProfilerFiller profiler)
{
Log.getLogger().debug("Clearing blueprint renderer cache.");
BlueprintHandler.getInstance().clearCache();
}
});
}
@Override
protected void apply(final Object source, final ResourceManager manager, final ProfilerFiller profiler)
{
Log.getLogger().debug("Clearing blueprint renderer cache.");
BlueprintHandler.getInstance().clearCache();
}
});
}

@OnlyIn(Dist.CLIENT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -926,25 +926,24 @@ public ActionProcessingResult handle(
@Nullable final CompoundTag tileEntityData,
final IPlacementContext placementContext)
{
if (!handleBlockPlacement(world, pos, blockState))
{
return ActionProcessingResult.DENY;
}

try
{
// Try detecting inventory content.
ItemStackUtils.getItemStacksOfTileEntity(tileEntityData, blockState);
}
catch (final Exception ex)
{
// If we can't load the inventory content of the TE, return early, don't fill TE data.
// If we can't load the inventory content of the TE, don't fill TE data.
if (!handleBlockPlacement(world, pos, blockState))
{
return ActionProcessingResult.DENY;
}
return ActionProcessingResult.SUCCESS;
}

if (tileEntityData != null)
if (!handleBlockPlacement(world, pos, blockState, placementContext.getRotationMirror().getRotationMirror(), tileEntityData))
{
handleTileEntityPlacement(tileEntityData, world, pos, placementContext.getRotationMirror().getRotationMirror());
return ActionProcessingResult.DENY;
}

return ActionProcessingResult.SUCCESS;
Expand Down
Loading